| polyparse {ivmte} | R Documentation | 
Parsing marginal treatment response formulas
Description
This function takes in an MTR formula, and then parses the formula
such that it becomes a polynomial in the unobservable u. It
then breaks these polynomials into monomials, and then integrates
each of them with respect to u. Each integral corresponds to
E[md | D, X, Z].
Usage
polyparse(
  formula,
  data,
  uname = "u",
  env = parent.frame(),
  as.function = FALSE
)
Arguments
formula | 
 the MTR.  | 
data | 
 
  | 
uname | 
 variable name for unobservable used in declaring the MTR.  | 
env | 
 environment, the original environment in which the formula was declared.  | 
as.function | 
 boolean, if   | 
Value
A list (of lists) of monomials corresponding to the
original MTR (for each observation); a list (of lists) of the
integrated monomials; a vector for the degree of each of the
original monomials in the MTR; and a vector for the names of
each variable entering into the MTR (note x^2 + x has
only one term, x).
Examples
dtm <- ivmte:::gendistMosquito()
## Declare MTR functions
formula1 = ~ 1 + u
formula0 = ~ 1 + u
## Construct MTR polynomials
polynomials0 <- polyparse(formula = formula0,
                          data = dtm,
                          uname = u,
                          as.function = FALSE)
polynomials1 <- polyparse(formula = formula0,
                          data = dtm,
                          uname = u,
                          as.function = FALSE)