parse.formula
will evaluate a function describe.model
,
where model
is given as an input to parse.formula
.If the describe.model
function has more than one parameter for
which ExpVar = TRUE
and DepVar = TRUE
, then the
user-specified equations must have labels to match those parameters,
else parse.formula
should return an error. In addition, if the
formula entries are not unambiguous, then parse.formula
returns an error.
parse.formula(formula, model, data = NULL)
formula
objectsc("multiple", "list")
. Let's say that the name of the model is
"bivariate.probit"
, and the corresponding describe function is
describe.bivariate.probit
, which identifies mu1
and
mu2
as systematic components, and an ancillary parameter rho
, which
may be parameterized, but is estimated as a scalar by default.parse.formula
Same covariates, cbind(y1, y2) ~ x1 + x2 * x3 list(mu1 = y1 ~ x1 + x2 * x3,
separate effects mu2 = y2 ~ x1 + x2 * x3,
rho = ~ 1)
With rho
as a list(cbind(y1, y2) ~ x1 + x2, list(mu1 = y1 ~ x1 + x2,
systematic equation rho = ~ x4 + x5) mu2 = y2 ~ x1 + x2,
rho = ~ x4 + x5)
With constraints list(mu1 = y1 ~ x1 + tag(x2, "x2"), list(mu1 = y1 ~ x1 + tag(x2, "x2"),
(same variable) mu2 = y2 ~ x3 + tag(x2, "x2")) mu2 = y2 ~ x3 + tag(x2, "x2"),
rho = ~ 1)
With constraints list(mu1 = y1 ~ x1 + tag(x2, "z1"), list(mu1 = y1 ~ x1 + tag(x2, "z1"),
(different variables) mu2 = y2 ~ x3 + tag(x4, "z1")) mu2 = y2 ~ x3 + tag(x4, "z1"),
rho = ~ 1)
}
parse.par
, model.frame.multiple
,
model.matrix.multiple
, and the full Zelig manual at
data(sanction)
formulae <- list(cbind(import, export) ~ coop + cost + target)
fml <- parse.formula(formulae, model = "bivariate.probit")
D <- model.frame(fml, data = sanction)
Run the code above in your browser using DataLab