coef.lmm: Extract Coefficients From a Linear Mixed Model

View source: R/coef.R

coef.lmmR Documentation

Extract Coefficients From a Linear Mixed Model

Description

Extract coefficients from a linear mixed model.

Usage

## S3 method for class 'lmm'
coef(
  object,
  effects = NULL,
  p = NULL,
  transform.sigma = "none",
  transform.k = "none",
  transform.rho = "none",
  transform.names = TRUE,
  ...
)

Arguments

object

a lmm object.

effects

[character] Should all coefficients be output ("all"), or only coefficients relative to the mean ("mean" or "fixed"), or only coefficients relative to the variance structure ("variance"), or only coefficients relative to the correlation structure ("correlation"). Can also be "ranef" to output random effect (only for CS structure).

p

[numeric vector] value of the model coefficients to be used. Only relevant if differs from the fitted values.

transform.sigma

[character] Transformation used on the variance coefficient for the reference level. One of "none", "log", "square", "logsquare" - see details.

transform.k

[character] Transformation used on the variance coefficients relative to the other levels. One of "none", "log", "square", "logsquare", "sd", "logsd", "var", "logvar" - see details.

transform.rho

[character] Transformation used on the correlation coefficients. One of "none", "atanh", "cov" - see details.

transform.names

[logical] Should the name of the coefficients be updated to reflect the transformation that has been used?

...

Not used. For compatibility with the generic method.

Details

transform.sigma:

  • "none" ouput residual standard error.

  • "log" ouput log-transformed residual standard error.

  • "square" ouput residual variance.

  • "logsquare" ouput log-transformed residual variance.

transform.k:

  • "none" ouput ratio between the residual standard error of the current level and the reference level.

  • "log" ouput log-transformed ratio between the residual standard errors.

  • "square" ouput ratio between the residual variances.

  • "logsquare" ouput log-transformed ratio between the residual variances.

  • "sd" ouput residual standard error of the current level.

  • "logsd" ouput residual log-transformed standard error of the current level.

  • "var" ouput residual variance of the current level.

  • "logvar" ouput residual log-transformed variance of the current level.

transform.rho:

  • "none" ouput correlation coefficient.

  • "atanh" ouput correlation coefficient after tangent hyperbolic transformation.

  • "cov" ouput covariance coefficient.

When using a (pure) compound symmetry covariance structure (structure = "CS"), estimated random effects can be extracted by setting argument effects to "ranef".

Value

A vector with the value of the model coefficients.

See Also

confint.lmm or model.tables.lmm for a data.frame containing estimates with their uncertainty.

Examples

## simulate data in the long format
set.seed(10)
dL <- sampleRem(100, n.times = 3, format = "long")

## fit linear mixed model
eUN.lmm <- lmm(Y ~ X1 + X2 + X5, repetition = ~visit|id, structure = "UN", data = dL, df = FALSE)

## output coefficients
coef(eUN.lmm)
coef(eUN.lmm, effects = "mean")
coef(eUN.lmm, transform.sigma = "none", transform.k = "none", transform.rho = "none")

LMMstar documentation built on Nov. 9, 2023, 1:06 a.m.