computeRawError: Compute the nobs by nlambda matrix of errors

Description Usage Arguments Value

View source: R/computeRawError.R

Description

Computes the nobs by nlambda matrix of errors corresponding to the error measure provided. Only works for "gaussian" and "poisson" families right now.

Usage

1
computeRawError(predmat, y, type.measure, family, weights, foldid, grouped)

Arguments

predmat

Array of predictions. If 'y' is univariate, this has dimensions 'c(nobs, nlambda)'. If 'y' is multivariate with 'nc' levels/columns (e.g. for 'family = "multionmial"' or 'family = "mgaussian"'), this has dimensions 'c(nobs, nc, nlambda)'. Note that these should be on the same scale as 'y' (unlike in the glmnet package where it is the linear predictor).

y

Response variable.

type.measure

Loss function to use for cross-validation. See 'availableTypeMeasures()' for possible values for 'type.measure'. Note that the package does not check if the user-specified measure is appropriate for the family.

family

Model family; used to determine the correct loss function.

weights

Observation weights.

foldid

Vector of values identifying which fold each observation is in.

grouped

Experimental argument; see 'kfoldcv()' documentation for details.

Value

A list with the following elements:

cvraw

An nobs by nlambda matrix of raw error values.

weights

Observation weights.

N

A vector of length nlambda representing the number of non-NA predictions associated with each lambda value.

type.measure

Loss function used for CV.


cvwrapr documentation built on June 11, 2021, 5:21 p.m.