Learn R Programming

cvwrapr (version 1.0)

buildPredMat: Build a prediction matrix from CV model fits

Description

Build a matrix of predictions from CV model fits.

Usage

buildPredMat(
  cvfitlist,
  y,
  lambda,
  family,
  foldid,
  predict_fun,
  predict_params,
  predict_row_params = c(),
  type.measure = NULL,
  weights = NULL,
  grouped = NULL
)

Arguments

cvfitlist

A list of length `nfolds`, with each element being the model fit for each fold.

y

Response. It is only used to determine what dimensions the prediction array needs to have.

lambda

Lambda values for which we want predictions.

family

Model family; one of "gaussian", "binomial", "poisson", "cox", "multinomial", "mgaussian", or a class "family" object.

foldid

Vector of values identifying which fold each observation is in.

predict_fun

The prediction function; see `kfoldcv()` documentation for details.

predict_params

Any other parameters that should be passed tp `predict_fun` to get predictions (other than `object` and `newx`); see `kfoldcv()` documentation for details.

predict_row_params

A vector which is a subset of `names(predict_params)`, indicating which parameters have to be subsetted in the CV loop (other than `newx`); see `kfoldcv()` documentation for details.

type.measure

Loss function to use for cross-validation. Only required for `family = "cox"`.

weights

Observation weights. Only required for `family = "cox"`.

grouped

Experimental argument; see `kfoldcv()` documentation for details. Only required for `family = "cox"`.

Value

A matrix of predictions.