Learn R Programming

vcrpart (version 0.2-1)

vcrpart-formula: Special terms for formulas.

Description

Special terms for formulas assigned to tvcm, fvcm and olmm.

Usage

fe(formula, intercept = TRUE)
re(formula, intercept = TRUE)
vc(..., by, intercept = missing(by), nuisance = character())
ce(formula)
ce(formula)

Arguments

formula
a symbolic description for the corresponding component of the formula component. See examples.
intercept
logical or character vector. intercept = TRUE (default) indicates that an intercept is incorporated. intercept = FALSE replaces the otherwise allowed "-1" term, that is ignored by
...
the names of moderators i.e. partitioning variables, separated by commas. It is also possibly to assign a character vector that includes all the variable names.
by
a symbolic description for predictors the effect of which is moderated by the variables in .... See tvcmand the examples below. Note that the by variable must be numeric and fact
nuisance
character vector of variables in by which have to be estimated separately for each partition but the algorithm should not focus on this variable when searching for splits.

Value

  • a list used by tvcm, fvcm and olmm for constructing the model formulas.

Details

Special formula terms to define fixed effects fe, varying coefficients vc and random effects re. The use of these formula terms ensures that fvcm, tvcm and olmm fit the intended model. Some examples are given below and in the corresponding documentation pages.

Variables which are not defined within one of these three special terms will be assigned to the fixed effect predictor equation. The deletion of the intercept can be indicated by a -1 or vc(intercept = FALSE). The terms ce (category-specific effects) and ge (global effect or proportional odds effect) are mainly designed for olmm. Notice that tvcm may changes, for internal reasons, the order of the terms in the specified formula. At present, the term ".", which is generally use to extract all variables of the data, is ignored. On the other hand, vc interprets character vectors, assigned as unnamed arguments, as lists of variables of moderators to be extracted from data.

See Also

tvcm, fvcm, olmm

Examples

Run this code
## Formula for a model with 2 fixed effects (x1 and x2) and a random
## intercept.

formula <- y ~ fe(x1 + x2) + re(1|id)

## Formula for a model with 1 fixed effect and a varying coefficient term
## with 2 moderators and 2 varying coefficient predictors. 'tvcm' will
## fit one common partition for the two moderated predictors 'x2' and
## 'x3'.

formula <- y ~ x1 + vc(z1, z1, by = x2 + x3, intercept = TRUE)

## Similar formula as above, but the predictors 'x2' and 'x3' have
## separate 'vc' terms. 'tvcm' will fit a separate partition for each 
## 'vc' term

formula <- y ~ x1 + vc(z1, z1, by = x2 + x3, intercept = TRUE)

Run the code above in your browser using DataLab