glmnet_fit_wrapper: Wrapper for glmnet for censored

Description Usage Arguments

View source: R/proportional_hazards_data.R


Not to be used directly by users


glmnet_fit_wrapper(x, y, alpha = 1, lambda = NULL, ...)



input matrix, of dimension nobs x nvars; each row is an observation vector. Can be in sparse matrix format (inherit from class "sparseMatrix" as in package Matrix)


response variable. Quantitative for family="gaussian", or family="poisson" (non-negative counts). For family="binomial" should be either a factor with two levels, or a two-column matrix of counts or proportions (the second column is treated as the target class; for a factor, the last level in alphabetical order is the target class). For family="multinomial", can be a nc>=2 level factor, or a matrix with nc columns of counts or proportions. For either "binomial" or "multinomial", if y is presented as a vector, it will be coerced into a factor. For family="cox", preferably a Surv object from the survival package: see Details section for more information. For family="mgaussian", y is a matrix of quantitative responses.


The elasticnet mixing parameter, with 0≤α≤ 1. The penalty is defined as


alpha=1 is the lasso penalty, and alpha=0 the ridge penalty.


A user supplied lambda sequence. Typical usage is to have the program compute its own lambda sequence based on nlambda and lambda.min.ratio. Supplying a value of lambda overrides this. WARNING: use with care. Avoid supplying a single value for lambda (for predictions after CV use predict() instead). Supply instead a decreasing sequence of lambda values. glmnet relies on its warms starts for speed, and its often faster to fit a whole path than compute a single fit.


additional parameters passed to glmnet::glmnet.

EmilHvitfeldt/survnip documentation built on April 8, 2021, 3:52 a.m.