View source: R/cross_validation.R
crossvalidate | R Documentation |
Performs cross-validation of a Gaussian process panel model.
crossvalidate(gpModel, foldVector)
gpModel |
object of class GPPM. |
foldVector |
integer vector. Describes the foldstructure to use. For example, created by |
The fold vector, must be a vector of length nrow(getData(gpModel)) of integers from 1 to k. If foldVector[i]=j
, then data point i is assigned to fold j.
Cross-validation estimates of the mean squared error (MSE) and the negative log-predictive probability (nLPP)
data("demoLGCM")
lgcm <- gppm(
"muI+muS*t", "varI+covIS*(t+t#)+varS*t*t#+(t==t#)*sigma",
demoLGCM, "ID", "y"
)
theFolds <- createLeavePersonsOutFolds(lgcm, k = 2) # for speed, in practive rather use default k=10
crosRes <- crossvalidate(lgcm, theFolds)
crosRes$MSE # mean squared error
crosRes$nLPP # negative log-predictive probability
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.