Learn R Programming

gppm (version 0.3.0)

predict.GPPM: GPPM predictions

Description

Obtain person-specific predictions.

Usage

# S3 method for GPPM
predict(object, newData, ...)

Value

Predictions of the dependent variable for all rows in newData. Conditional predictions for all persons in newData that are also present in the data used for fitting gpModel; unconditional predictions for others persons. See examples for format.

Arguments

object

object of class GPPM. Must be fitted, that is, a result from fit.GPPM.

newData

a data frame with the same column names as the data frame used for generating gpModel with gppm. May only contain new data, that is, data that was not used for fitting.

...

additional arguments (currently not used).

Examples

Run this code
# \donttest{
data("demoLGCM")
# remove all measurements from person 1 and the first form person 2
predIdx <- c(which(demoLGCM$ID == 1), which(demoLGCM$ID == 2)[1])
fitDemoLGCM <- demoLGCM[setdiff(1:nrow(demoLGCM), predIdx), ]

lgcm <- gppm(
  "muI+muS*t", "varI+covIS*(t+t#)+varS*t*t#+(t==t#)*sigma",
  fitDemoLGCM, "ID", "y"
)
lgcm <- fit(lgcm)
predRes <- predict(lgcm, demoLGCM[predIdx, ])
# }

Run the code above in your browser using DataLab