View source: R/proportional_hazards-glmnet.R
coxnet_train | R Documentation |
Not to be used directly by users.
coxnet_train(
formula,
data,
alpha = 1,
lambda = NULL,
weights = NULL,
...,
call = caller_env()
)
formula |
The model formula. |
data |
The data. |
alpha |
The elasticnet mixing parameter, with
|
lambda |
A user supplied |
weights |
observation weights. Can be total counts if responses are proportion matrices. Default is 1 for each observation |
... |
additional parameters passed to glmnet::glmnet. |
call |
The call used in errors and warnings. |
This wrapper translates from formula interface to glmnet's matrix due to how
stratification can be specified. glmnet requires that the response is
stratified via glmnet::stratifySurv()
. censored allows specification via a
survival::strata()
term on the right-hand side of the formula. The formula
is used to generate the stratification information needed for stratifying the
response. The formula without the strata term is used for generating the
model matrix for glmnet.
The wrapper retains the original formula and the pre-processing elements including the training data to allow for predictions from the fitted model.
A fitted glmnet
model.
coxnet_mod <- coxnet_train(Surv(time, status) ~ age + sex, data = lung)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.