crossvalidate: Cross-validation.

Description Usage Arguments Details Value Examples

Description

Performs cross-validation of a Gaussian process panel model.

Usage

1
crossvalidate(gpModel, foldVector)

Arguments

gpModel

object of class GPPM.

foldVector

integer vector. Describes the foldstructure to use. For example, created by createLeavePersonsOutFolds.

Details

The fold vector, must be a vector of length nrow(datas(gpModel)) of integers from 1 to k. If foldVector[i]=j, then data point i is assigned to fold j.

Value

Cross-validation estimates of the mean squared error (MSE) and the negative log-predictive probability (nLPP)

Examples

1
2
3
4
5
6
7
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

karchjd/gppmr documentation built on May 14, 2019, 8:05 a.m.