Data
is partitioned according to the levels of the grouping
factor g
and individual lm
fits are obtained for each
data
partition, using the model defined in object
.lmList(formula, data, level, subset, na.action, pool)
lmList
,
a linear formula object of the form y ~ x1+...+xn | g
.
In the formula object, y
represents the response, x1,...,xn
the covariates, and
g
the grouping factor speciobject
.data
should be used in the fit. This can be a logical
vector, or a numeric vector indicating which observation numbers are
to be included, or a character vector of theNA
s. The default action (na.fail
) causes
lmList
to print an error message and terminate if there are any
incomplete observations.pool
in
calculations of standard deviations or standard errors for summaries.lm
objects with as
many components as the number of groups defined by the grouping factor.lm
(fm1 <- lmList(breaks ~ wool | tension, warpbreaks))
Run the code above in your browser using DataLab