
Last chance! 50% off unlimited learning
Sale ends in
terms
holds information about a
model. Usually the model was specified in terms of a
formula
and that formula was used to determine the terms
object.terms.formula
. The object has a number of attributes
and they are used to construct the model frame: numeric(0)
.list
of the variables in the model.term.labels
indicating the order of interaction for each term.offset
terms there
is an offset
attribute indicating which variable(s) are offsetsspecials
argument was given to
terms.formula
there is a specials
attribute, a
pairlist of vectors (one for each specified special function) giving
numeric indices of the arguments of the list returned as the
variables
attribute which contain these special functions..MFclass
) of the variables used in a fit.makepredictcall
.c("terms", "formula")
.terms
, formula
.## use of specials (as used for gam() in packages mgcv and gam)
(tf <- terms(y ~ x + x:z + s(x), specials = "s"))
## Note that the "factors" attribute has variables as row names
## and term labels as column names, both as character vectors.
attr(tf, "specials") # index 's' variable(s)
rownames(attr(tf, "factors"))[attr(tf, "specials")$s]
## we can keep the order by
terms(y ~ x + x:z + s(x), specials = "s", keep.order = TRUE)
Run the code above in your browser using DataLab