Learn R Programming

LMMstar (version 1.1.0)

model.matrix.lmm: Design Matrix for Linear Mixed Model

Description

Extract or construct design matrices for Linear Mixed Model.

Usage

# S3 method for lmm
model.matrix(
  object,
  newdata = NULL,
  effects = "mean",
  simplify = TRUE,
  drop.X = NULL,
  na.rm = TRUE,
  ...
)

Value

When simplify is FALSE, a list with the followin elements:

  • mean: design matrix for the mean model

  • Y: vector of outcome values

  • vcov: list of elements for the variance and correlation models.

  • index.cluster: list containing, for each cluster, the location of the corresponding observations in the processed dataset.

  • index.clusterTime: list containing, for each cluster, the repetition index corresponding observations.

  • index.clusterStrata: list containing, for each cluster, the strata index corresponding observations.

  • param: data.frame describing the modle parameters.

  • drop.X: logical value indicating whether columns in the design matrix should be dropped if it has not full rank.

  • precompute.XX, precompute.XY: moments of X and Y

When simplify is TRUE, this list will be simplified into a list with three elements:

  • mean: design matrix for the mean model

  • variance: design matrix for the variance model

  • correlation: design matrix for the correlation model

or a single design matrixx.

Arguments

object

an lmm object

newdata

[data.frame] dataset relative to which the design matrix should be constructed.

effects

[character] design matrix relative to the mean model ("mean"), variance model ("variance"), correlation model ("correlation"), or all the previous ("all"). Can also be "index" to only output the normalize data and the cluster, time, strata indexes.

simplify

[logical] simplify the data format of the output (matrix instead of a list of matrix) when possible.

drop.X

[logical] when the design matrix does not have full rank, should columns be dropped?

na.rm

[logical] Should row containing missing values for the variables used in the linear mixed model be removed?

...

Not used. For compatibility with the generic method.