createLeavePersonsOutFolds: Create Leave-persons-out Folds

View source: R/cross_validation.R

createLeavePersonsOutFoldsR Documentation

Create Leave-persons-out Folds

Description

This function is used to create a leave-persons-out cross-validation fold vector to be used by crossvalidate.

Usage

createLeavePersonsOutFolds(gpModel, k = 10)

Arguments

gpModel

object of class GPPM.

k

integer scalar. Number of folds to create.

Details

The folds are created such that the data of each person is fully in one fold.

Value

A fold vector, which is 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.

See Also

crossvalidate for how to use the created fold vector to perform cross-validation.

Examples


data("demoLGCM")
lgcm <- gppm(
  "muI+muS*t", "varI+covIS*(t+t#)+varS*t*t#+(t==t#)*sigma",
  demoLGCM, "ID", "y"
)
theFolds <- createLeavePersonsOutFolds(lgcm)



gppm documentation built on Aug. 25, 2025, 9:50 a.m.