fitted.lmm: Predicted Mean Value For Linear Mixed Model

Description Usage Arguments Value Examples

View source: R/fitted.R

Description

Predicted Mean Value For Linear Mixed Model

Usage

1
2
## S3 method for class 'lmm'
fitted(object, newdata = NULL, keep.newdata = FALSE, ...)

Arguments

object

a lmm object.

newdata

[data.frame] the covariate values for each cluster.

keep.newdata

[logical] Should the argument newdata be output along side the predicted values?

...

Not used. For compatibility with the generic method.

Value

A vector of length the number of row of newdata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

## prediction
fitted(eUN.lmm)
fitted(eUN.lmm, newdata = data.frame(X1 = 1, X2 = 2, X5 = 3))
fitted(eUN.lmm, newdata = data.frame(X1 = 1, X2 = 2, X5 = 3), keep.newdata = TRUE)

LMMstar documentation built on Nov. 5, 2021, 1:07 a.m.