coef.lmList.Rd
The coefficients of each lm
object in the object
list are
extracted and organized into a data frame, with rows corresponding to
the lm
components and columns corresponding to the
coefficients. Optionally, the returned data frame may be augmented
with covariates summarized over the groups associated with the
lm
components.
# S3 method for class 'lmList'
coef(object, augFrame, data, which, FUN,
omitGroupingFactor, ...)
an object inheriting from class "lmList"
, representing
a list of lm
objects with a common model.
an optional logical value. If TRUE
, the returned
data frame is augmented with variables defined in the data frame used
to produce object
; else, if FALSE
, only the coefficients
are returned. Defaults to FALSE
.
an optional data frame with the variables to be used for
augmenting the returned data frame when augFrame =
TRUE
. Defaults to the data frame used to fit object
.
an optional positive integer or character vector
specifying which columns of the data frame used to produce object
should be used in the augmentation of the returned data
frame. Defaults to all variables in the data.
an optional summary function or a list of summary functions
to be applied to group-varying variables, when collapsing the data
by groups. Group-invariant variables are always summarized by the
unique value that they assume within that group. If FUN
is a
single function it will be applied to each non-invariant variable by
group to produce the summary for that variable. If FUN
is a
list of functions, the names in the list should designate classes of
variables in the frame such as ordered
, factor
, or
numeric
. The indicated function will be applied to any
group-varying variables of that class. The default functions to be
used are mean
for numeric factors, and Mode
for both
factor
and ordered
. The Mode
function, defined
internally in gsummary
, returns the modal or most popular
value of the variable. It is different from the mode
function
that returns the S-language mode of the variable.
an optional logical value. When TRUE
the grouping factor itself will be omitted from the group-wise
summary of data
but the levels of the grouping factor will
continue to be used as the row names for the returned data frame.
Defaults to FALSE
.
some methods for this generic require additional arguments. None are used in this method.
a data frame inheriting from class "coef.lmList"
with the estimated
coefficients for each "lm"
component of object
and,
optionally, other covariates summarized over the groups corresponding
to the "lm"
components. The returned object also inherits from
classes "ranef.lmList"
and "data.frame"
.
Pinheiro, J. C. and Bates, D. M. (2000), Mixed-Effects Models in S and S-PLUS, Springer, New York, esp. pp. 457-458.
fm1 <- lmList(distance ~ age|Subject, data = Orthodont)
coef(fm1)
#> (Intercept) age
#> M16 16.95 0.550
#> M05 13.65 0.850
#> M02 14.85 0.775
#> M11 20.05 0.325
#> M07 14.95 0.800
#> M08 19.75 0.375
#> M03 16.00 0.750
#> M12 13.25 1.000
#> M13 2.80 1.950
#> M14 19.10 0.525
#> M09 14.40 0.975
#> M15 13.50 1.125
#> M06 18.95 0.675
#> M04 24.70 0.175
#> M01 17.30 0.950
#> M10 21.25 0.750
#> F10 13.55 0.450
#> F09 18.10 0.275
#> F06 17.00 0.375
#> F01 17.25 0.375
#> F05 19.60 0.275
#> F07 16.95 0.550
#> F02 14.20 0.800
#> F08 21.45 0.175
#> F03 14.40 0.850
#> F04 19.65 0.475
#> F11 18.95 0.675
coef(fm1, augFrame = TRUE)
#> (Intercept) age distance Sex
#> M16 16.95 0.550 23.000 Male
#> M05 13.65 0.850 23.000 Male
#> M02 14.85 0.775 23.375 Male
#> M11 20.05 0.325 23.625 Male
#> M07 14.95 0.800 23.750 Male
#> M08 19.75 0.375 23.875 Male
#> M03 16.00 0.750 24.250 Male
#> M12 13.25 1.000 24.250 Male
#> M13 2.80 1.950 24.250 Male
#> M14 19.10 0.525 24.875 Male
#> M09 14.40 0.975 25.125 Male
#> M15 13.50 1.125 25.875 Male
#> M06 18.95 0.675 26.375 Male
#> M04 24.70 0.175 26.625 Male
#> M01 17.30 0.950 27.750 Male
#> M10 21.25 0.750 29.500 Male
#> F10 13.55 0.450 18.500 Female
#> F09 18.10 0.275 21.125 Female
#> F06 17.00 0.375 21.125 Female
#> F01 17.25 0.375 21.375 Female
#> F05 19.60 0.275 22.625 Female
#> F07 16.95 0.550 23.000 Female
#> F02 14.20 0.800 23.000 Female
#> F08 21.45 0.175 23.375 Female
#> F03 14.40 0.850 23.750 Female
#> F04 19.65 0.475 24.875 Female
#> F11 18.95 0.675 26.375 Female