This function is to be called after calling trac
. It performs
nfold
-fold cross validation.
cv_trac( fit, Z, y, A, folds = NULL, nfolds = 5, summary_function = stats::median )
fit | output of |
---|---|
Z, y, A | same arguments as passed to |
folds | a partition of |
nfolds | number of folds for cross-validation |
summary_function | how to combine the errors calculated on each observation within a fold (e.g. mean or median) |