The estimated coefficients at level \(i\) are obtained by adding together the fixed effects estimates and the corresponding random effects estimates at grouping levels less or equal to \(i\). The resulting estimates are returned as a data frame, with rows corresponding to groups and columns to coefficients. Optionally, the returned data frame may be augmented with covariates summarized over groups.

# S3 method for class 'lme'
coef(object, augFrame, level, data, which, FUN, 
       omitGroupingFactor, subset, ...)

Arguments

object

an object inheriting from class "lme", representing a fitted linear mixed-effects model.

augFrame

an optional logical value. If TRUE, the returned data frame is augmented with variables defined in data; else, if FALSE, only the coefficients are returned. Defaults to FALSE.

level

an optional positive integer giving the level of grouping to be used in extracting the coefficients from an object with multiple nested grouping levels. Defaults to the highest or innermost level of grouping.

data

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.

which

an optional positive integer or character vector specifying which columns of data should be used in the augmentation of the returned data frame. Defaults to all columns in data.

FUN

an optional summary function or a list of summary functions to be applied to group-varying variables, when collapsing 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.

omitGroupingFactor

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.

subset

an optional expression specifying a subset

...

some methods for this generic require additional arguments. None are used in this method.

Value

a data frame inheriting from class "coef.lme" with the estimated coefficients at level level and, optionally, other covariates summarized over groups. The returned object also inherits from classes "ranef.lme" and "data.frame".

References

Pinheiro, J. C. and Bates, D. M. (2000), Mixed-Effects Models in S and S-PLUS, Springer, New York, esp. pp. 455-457.

Author

José Pinheiro and Douglas Bates bates@stat.wisc.edu

Examples

fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)
coef(fm1)
#>     (Intercept)       age
#> M16    16.57335 0.5913314
#> M05    15.58444 0.6857855
#> M02    16.03361 0.6746930
#> M11    17.65160 0.5413593
#> M07    16.15314 0.6950852
#> M08    17.62141 0.5654490
#> M03    16.58721 0.6960375
#> M12    15.76312 0.7747492
#> M13    12.63157 1.0738537
#> M14    17.66546 0.6460654
#> M09    16.31672 0.7960938
#> M15    16.22614 0.8683628
#> M06    17.97875 0.7433765
#> M04    19.76156 0.5943004
#> M01    17.81269 0.8758697
#> M10    19.41435 0.8713318
#> F10    14.47973 0.4095945
#> F09    16.47016 0.4421435
#> F06    16.14053 0.4736282
#> F01    16.27515 0.4819755
#> F05    17.27792 0.4922276
#> F07    16.57335 0.5913314
#> F02    15.74926 0.6700431
#> F08    18.01143 0.4857849
#> F03    15.98832 0.7108275
#> F04    17.83027 0.6303230
#> F11    17.97875 0.7433765
coef(fm1, augFrame = TRUE)
#>     (Intercept)       age distance    Sex
#> M16    16.57335 0.5913314   23.000   Male
#> M05    15.58444 0.6857855   23.000   Male
#> M02    16.03361 0.6746930   23.375   Male
#> M11    17.65160 0.5413593   23.625   Male
#> M07    16.15314 0.6950852   23.750   Male
#> M08    17.62141 0.5654490   23.875   Male
#> M03    16.58721 0.6960375   24.250   Male
#> M12    15.76312 0.7747492   24.250   Male
#> M13    12.63157 1.0738537   24.250   Male
#> M14    17.66546 0.6460654   24.875   Male
#> M09    16.31672 0.7960938   25.125   Male
#> M15    16.22614 0.8683628   25.875   Male
#> M06    17.97875 0.7433765   26.375   Male
#> M04    19.76156 0.5943004   26.625   Male
#> M01    17.81269 0.8758697   27.750   Male
#> M10    19.41435 0.8713318   29.500   Male
#> F10    14.47973 0.4095945   18.500 Female
#> F09    16.47016 0.4421435   21.125 Female
#> F06    16.14053 0.4736282   21.125 Female
#> F01    16.27515 0.4819755   21.375 Female
#> F05    17.27792 0.4922276   22.625 Female
#> F07    16.57335 0.5913314   23.000 Female
#> F02    15.74926 0.6700431   23.000 Female
#> F08    18.01143 0.4857849   23.375 Female
#> F03    15.98832 0.7108275   23.750 Female
#> F04    17.83027 0.6303230   24.875 Female
#> F11    17.97875 0.7433765   26.375 Female