
A wrapper for survival times with coxnet models
Source:R/proportional_hazards-glmnet.R
survival_time_coxnet.RdA wrapper for survival times with coxnet models
Arguments
- object
A parsnip
model_fitobject resulting from proportional_hazards() with engine = "glmnet".- new_data
Data for prediction.
- penalty
Penalty value(s).
- multi
Allow multiple penalty values?
- ...
Options to pass to
survival::survfit().
Examples
cox_mod <- proportional_hazards(penalty = 0.1) |>
set_engine("glmnet") |>
fit(Surv(time, status) ~ ., data = lung)
#> Warning: Starting in glmnet 5.1, the default Cox tie-handling method will change from 'breslow' to 'efron' (matching survival::coxph). To silence this message and lock in the v5.0 default, pass cox.ties = 'breslow' explicitly. To preview the v5.1 behavior, pass cox.ties = 'efron'.
survival_time_coxnet(cox_mod, new_data = lung[1:3, ], penalty = 0.1)
#> [1] NA 428.1231 NA