Learn R Programming

plmmr (version 4.3.0)

cvf: Cross-validation internal function for cv_plmm()

Description

Internal function for cv_plmm() which calls plmm() on a fold subset of the original data.

Usage

cvf(i, fold, type, cv_args, ...)

Value

A list with three elements:

  • loss: a numeric vector with the loss at each value of lambda

  • nl: a numeric value indicating the number of lambda values used

  • yhat: a numeric value with the predicted outcome values at each lambda

Arguments

i

Fold number to be excluded from fit.

fold

n-length vector of fold-assignments.

type

A character argument indicating what should be returned from predict.plmm(). If type = 'lp' predictions are based on the linear predictor, \(X \beta\). If type = 'blup', predictions are based on the linear predictor plus the estimated random effect (BLUP).

cv_args

List of additional arguments to be passed to plmm.

...

Optional arguments to predict_within_cv()