Description Details Engine Details Examples
These arguments are converted to their specific names at the
time that the model is fit. Other options and arguments can be
set using set_engine()
. If left to their defaults
here (NULL
), the values are taken from the underlying model
functions. If parameters need to be modified, update()
can be used
in lieu of recreating the object from scratch.
Parsnip engines for Proportional Hazards Models
proportional_hazards()
is a way to generate a specification of a model before
fitting and allows the model to be created using different packages in R.
The main arguments for the model are:
penalty
: The total amount of regularization
in the model. Note that this must be zero for some engines.
mixture
: The mixture amounts of different types of
regularization (see below). Note that this will be ignored for some engines.
These arguments are converted to their specific names at the
time that the model is fit. Other options and arguments can be
set using set_engine()
. If left to their defaults
here (NULL
), the values are taken from the underlying model
functions. If parameters need to be modified, update()
can be used
in lieu of recreating the object from scratch.
Proportional hazards models include the Cox model.
For proportional_hazards()
, the mode will always be "censored regression".
The model can be created using the fit()
function using the following engines:
R: "survival"
(the default)
Engines may have preset default arguments when executing the model fit call. For this type of model, the template of the fit calls are:
survival engine
1  survival::coxph(formula = missing_arg())

Note that, for linear predictor prediction types, the results are formatted for all models such that the prediction increases with time. For the proportional hazards model, the sign is reversed.
1 2 3 4 5 6 7 8  parsnip::show_engines("proportional_hazards")
library(survival)
cox_mod <
proportional_hazards() %>%
set_engine("survival") %>%
fit(Surv(time, status) ~ x, data = aml)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.