Learn R Programming

JM (version 0.8-1)

predict: Predictions for Joint Models

Description

Calculates predicted values for the longitudinal part of a joint model.

Usage

## S3 method for class 'jointModel':
predict(object, newdata, se.fit = FALSE, level = 0.95,
    returnData = FALSE, \dots)

Arguments

object
an object inheriting from class jointModel.
newdata
a data frame in which to look for variables with which to predict.
se.fit
logical if TRUE the standard error of the predicted values along with a level confidence interval are returned.
level
a numeric value denoting the tolerance/confidence level.
returnData
logical; if TRUE the data frame supplied in newdata is returned augmented with the outputs of the function.
...
additional arguments; currently none is used.

Value

  • If se.fit = FALSE a numeric vector of predicted values, otherwise a list with components pred the predicted values, se.fit the standard error for the fitted values, and low and upp the lower and upper limits of the confidence interval. If returnData = TRUE, it returns the data frame newdata with the previously mentioned components added.

Details

This function computed predicted values only for the longitudinal outcome and only for the fixed-effects part of the longitudinal submode. In particular, let $X$ denote the fixed-effects design matrix calculated using newdata. The predict() calculates $\hat{y} = X \hat{\beta}$, and if se.fit = TRUE, $var(\hat{y}) = X V X^t$, with $V$ denoting the covariance matrix of $\hat{\beta}$. The confidence interval is based on a normal approximation.

See Also

jointModel

Examples

Run this code
# linear mixed model fit
fitLME <- lme(log(serBilir) ~ drug * year, 
    random = ~ year | id, data = pbc2)
# survival regression fit
fitSURV <- survreg(Surv(years, status2) ~ drug, 
    data = pbc2.id, x = TRUE)
# joint model fit, under the (default) Weibull model
fitJOINT <- jointModel(fitLME, fitSURV, timeVar = "year")

DF <- with(pbc2, expand.grid(drug = levels(drug),
    year = seq(min(year), max(year), len = 100)))
Ps <- predict(fitJOINT, DF, se.fit = TRUE, return = TRUE)
require(lattice)
xyplot(pred + low + upp ~ year | drug, data = Ps,
    type = "l", col = c(2,1,1), lty = c(1,2,2), lwd = 2,
    ylab = "Average log serum Bilirubin")

Run the code above in your browser using DataLab