ctLOO: K fold cross validation for ctStanFit objects

View source: R/ctLOO.R

ctLOOR Documentation

K fold cross validation for ctStanFit objects

Description

K fold cross validation for ctStanFit objects

Usage

ctLOO(
  fit,
  folds = 10,
  cores = 2,
  parallelFolds = FALSE,
  subjectwise = ifelse(length(unique(fit$standata$subject)) > folds, TRUE, FALSE),
  keepfirstobs = FALSE,
  leaveOutN = NA,
  refit = TRUE
)

Arguments

fit

ctStanfit object

folds

Number of cross validation splits to use – 10 folds implies that the model is re-fit 10 times, each time to a data set with 1/10 of the observations randomly removed.

cores

Number of processor cores to use.

parallelFolds

compute folds in parallel or use cores to finish single folds faster. parallelFolds will use folds times as much memory.

subjectwise

drop random subjects instead of data rows?

keepfirstobs

do not drop first observation (more stable estimates)

leaveOutN

if a positive integer is given, the folds argument is ignored and instead the folds are calculated by leaving out every Nth row from the data when fitting. Leaving 2 out would result in 3 folds (starting at rows 1,2,3), each containing one third of the data.

refit

if FALSE, do not optimise parameters for the new data set, just compute the likelihoods etc from the original parameters

Value

list

Examples

 
ctLOO(ctstantestfit)


ctsem documentation built on Nov. 2, 2023, 6:03 p.m.