Learn R Programming

riskRegression (version 2023.12.21)

GLMnet: Fitting GLMnet for use with predictRisk

Description

Fit GLMnet models via a formula and a data set for use with predictRisk.

Usage

GLMnet(
  formula,
  data,
  lambda = NULL,
  cv = TRUE,
  alpha = 1,
  nfolds = 10,
  type.measure = "deviance",
  family,
  ...
)

Arguments

formula

A formula.

data

The data on which to fit the model.

lambda

The tuning parameters for GLMnet. If set to NULL, then it the parameters are chosen for you.

cv

Whether to use cross-validation or not. Default is TRUE.

alpha

The elasticnet mixing parameter. See the ?glmnet for more details.

nfolds

Number of folds for cross-validation. Default is 10.

type.measure

loss to use for cross-validation. Default is deviance.

family

passed to glmnet. Defaults for binary outcome to "binomial" and for survival to "cox".

...

Additional arguments that are passed on to the glmnet.