IndvPred: Individualized Predictions from Linear Mixed Models

Description Usage Arguments Value Author(s) See Also Examples

Description

Calculates subject-specific predictions for new subjects from a linear mixed model.

Usage

1
2
3
4
5
IndvPred_lme(lmeObject, newdata, timeVar, times = NULL, M = 200L,
    interval = c("confidence", "prediction"), all_times = FALSE,
    level = 0.95, return_data = FALSE, seed = 1L)
    
extract_lmeComponents(lmeObject, timeVar)

Arguments

lmeObject

an object inheriting from class lme or class lmeComponents.

newdata

a data frame in which to look for variables with which to predict.

timeVar

a character string specifying the time variable in the linear mixed model.

interval

a character string indicating what type of intervals should be computed.

all_times

logical; should predictions be calculated at all times or only at the ones that are after the last observed time of each subject.

level

a numeric scalar denoting the tolerance/confidence level.

times

a numeric vector denoting the time points for which we wish to compute the subject-specific predictions after the last available measurement provided in newdata. Default is a sequence of 100 equally spaced time points from the smallest to the largest follow-up time of all subjects.

M

numeric scalar denoting the number of Monte Carlo samples. See Details.

return_data

logical; if TRUE the data frame supplied in newdata is returned augmented with the outputs of the function.

seed

numeric scalar, the random seed used to produce the results.

Value

If return_data = TRUE, a the data frame newdata with extra rows for the time points at which predictions were calculated, and extra columns with the predictions and the limits of the pointwise confidence intervals.

If return_data = FALSE, a list with components

times_to_pred

time points at which predictions were calculated.

predicted_y

the predictions.

low

the lower limits of the pointwise confidence intervals.

upp

the upper limits of the pointwise confidence intervals.

Author(s)

Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl

See Also

predict.JMbayes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# linear mixed model fit
fitLME <- lme(log(serBilir) ~ drug * ns(year, 2), data = subset(pbc2, id != 2), 
        random = ~ ns(year, 2) | id)
        
DF <- IndvPred_lme(fitLME, newdata = subset(pbc2, id == 2), timeVar = "year", 
    M = 500, return_data = TRUE)
    
require(lattice)
xyplot(pred + low + upp ~ year | id, data = DF,
    type = "l", col = c(2,1,1), lty = c(1,2,2), lwd = 2,
    ylab = "Average log serum Bilirubin")
    
# extract_lmeComponents() extract the required components from the lme object
# that are required to calculate the predictions; this is a light weight version of
# the object, e.g.,
fitLME_light <- extract_lmeComponents(fitLME, timeVar = "year")

DF <- IndvPred_lme(fitLME_light, newdata = subset(pbc2, id == 2), timeVar = "year", 
    M = 500, return_data = TRUE)

## End(Not run)

JMbayes documentation built on Jan. 9, 2020, 9:07 a.m.