CrossVD: CrossVD

View source: R/CrossValidation.R

CrossVDR Documentation

CrossVD

Description

This function calculates the estimated K-fold or Leave-one-out cross-validation mean squared prediction error.

Usage

CrossVD(data, K = NULL, get_mean = T, verb = F, OPT, ...)

Arguments

data

list containing the data, elements must be named X and Y, where X is a n x k matrix and Y is a vector of length n. Here, n represents the number of observations and k is the number of \mjseqn\beta coefficients.

K

integer the number of folds. Set equal to NULL to run a Leave-one-out cross validation. If K is larger than the number of observations, the Leave-one-out cross validation is run by default.

get_mean

boolean if TRUE, the CV-MSE is returned, otherwise the function returns the MSE computed for each fold.

verb

bool if TRUE, it prints more information about the status of the algorithm (default is FALSE).

OPT

function the optimization function whose prediction power has to be tested. If can only be equal to GradD or SteepD.

...

optional arguments to OPT

Value

if get_mean is TRUE, the CV-MSE is returned. Otherwise the function returns a vector containing all MSE computed for each fold.


lucapresicce/DescendMethods documentation built on April 26, 2022, 6 p.m.