model.frame.lmm {LMMstar}R Documentation

Extracting the Model Frame from a Linear Mixed Model

Description

Variables needed to fit the Linear Mixed Model.

Usage

## S3 method for class 'lmm'
model.frame(
  formula,
  newdata = NULL,
  type = NULL,
  add.index = FALSE,
  na.rm = TRUE,
  ...
)

Arguments

formula

[lmm] linear mixed model object

newdata

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

type

[character] By default returns the processed dataset used to fit the Linear Mixed Model (NULL). Can be used to add rows relative to missing repetitions ("add.NA") or obtain a dataset with unique sets of covariates ("unique") with respect to the mean structure.

add.index

[logical] Should columns indexing the row number from the original dataset, time variable, cluster variable, strata variable be added to the output?

na.rm

[logical] Should rows containing missing values for the variables used in the linear mixed model be removed? Not relevant when argument type is "unique".

...

Not used. For compatibility with the generic method.

Details

Column "XXindexXX" refers to the row of the original dataset (i.e. passed to argument data when calling lmm). When adding rows relative to missing repetitions, since there is no row in the original dataset, a negative sign is used.

Examples

data("armd.wide", package = "nlmeU")
e.lmH <- lmm(visual52 ~ lesion, structure = IND(~treat.f), data = armd.wide)
model.frame(e.lmH)
model.frame(e.lmH, add.index = TRUE)
model.frame(e.lmH, type = "unique")

data("gastricbypassL", package = "LMMstar")
dfL.NNA <- na.omit(gastricbypassL)
e.lmm <- lmm(glucagonAUC ~ time, repetition = ~visit|id, data = dfL.NNA, df = FALSE)
model.frame(e.lmm, type = "unique")
model.frame(e.lmm, type = c("unique","correlation"))
model.frame(e.lmm, type = "add.NA", add.index = TRUE)

[Package LMMstar version 1.1.0 Index]