Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_cox_lambda_max

Get lambda max for Cox regression model


Description

Return the lambda max value for Cox regression model, used for computing initial lambda values. For internal use only.

Usage

get_cox_lambda_max(
  x,
  y,
  alpha,
  weights = rep(1, nrow(x)),
  offset = rep(0, nrow(x)),
  exclude = c(),
  vp = rep(1, ncol(x))
)

Arguments

x

Input matrix, of dimension nobs x nvars; each row is an observation vector. If it is a sparse matrix, it is assumed to be unstandardized. It should have attributes xm and xs, where xm(j) and xs(j) are the centering and scaling factors for variable j respsectively. If it is not a sparse matrix, it is assumed to be standardized.

y

Survival response variable, must be a Surv or stratifySurv object.

alpha

The elasticnet mixing parameter, with 0 ≤ α ≤ 1.

weights

Observation weights.

offset

Offset for the model. Default is a zero vector of length nrow(y).

exclude

Indices of variables to be excluded from the model.

vp

Separate penalty factors can be applied to each coefficient.

Details

This function is called by cox.path for the value of lambda max.

When x is not sparse, it is expected to already by centered and scaled. When x is sparse, the function will get its attributes xm and xs for its centering and scaling factors. The value of lambda_max changes depending on whether x is centered and scaled or not, so we need xm and xs to get the correct value.


glmnet

Lasso and Elastic-Net Regularized Generalized Linear Models

v4.1-1
GPL-2
Authors
Jerome Friedman [aut], Trevor Hastie [aut, cre], Rob Tibshirani [aut], Balasubramanian Narasimhan [aut], Kenneth Tay [aut], Noah Simon [aut], Junyang Qian [ctb]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.