predict.GPPM | R Documentation |
Obtain person-specific predictions.
## S3 method for class 'GPPM'
predict(object, newData, ...)
object |
object of class GPPM. Must be fitted, that is, a result from |
newData |
a data frame with the same column names as the data frame used for generating |
... |
additional arguments (currently not used). |
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.
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, ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.