[Deprecated]

This function is soft-deprecated in favor of survival_reg() which uses the "censored regression" mode.

surv_reg() is a way to generate a specification of a model before fitting and allows the model to be created using R. The main argument for the model is:

  • dist: The probability distribution of the outcome.

This argument is converted to its specific names at the time that the model is fit. Other options and arguments can be set using set_engine(). If left to its default here (NULL), the value is taken from the underlying model functions.

The data given to the function are not saved and are only used to determine the mode of the model. For surv_reg(),the mode will always be "regression".

Since survival models typically involve censoring (and require the use of survival::Surv() objects), the fit.model_spec() function will require that the survival model be specified via the formula interface.

Also, for the flexsurv::flexsurvfit engine, the typical strata function cannot be used. To achieve the same effect, the extra parameter roles can be used (as described above).

surv_reg(mode = "regression", engine = "survival", dist = NULL)

Arguments

mode

A single character string for the prediction outcome mode. The only possible value for this model is "regression". @param engine A single character string specifying what computational engine to use for fitting. Possible engines are listed below. The default for this model is "survival".

dist

A character string for the outcome distribution. "weibull" is the default.

Details

For surv_reg(), the mode will always be "regression".

The model can be created using the fit() function using the following engines:

  • R: "flexsurv", "survival" (the default)

Engine Details

Engines may have pre-set default arguments when executing the model fit call. For this type of model, the template of the fit calls are below.

flexsurv

surv_reg() %>% 
  set_engine("flexsurv") %>% 
  set_mode("regression") %>% 
  translate()

## Warning: `surv_reg()` was deprecated in parsnip 0.1.6.
## Please use `survival_reg()` instead.

## Parametric Survival Regression Model Specification (regression)
## 
## Computational engine: flexsurv 
## 
## Model fit template:
## flexsurv::flexsurvreg(formula = missing_arg(), data = missing_arg(), 
##     weights = missing_arg())

survival

surv_reg() %>% 
  set_engine("survival") %>% 
  set_mode("regression") %>% 
  translate()

## Warning: `surv_reg()` was deprecated in parsnip 0.1.6.
## Please use `survival_reg()` instead.

## Parametric Survival Regression Model Specification (regression)
## 
## Computational engine: survival 
## 
## Model fit template:
## survival::survreg(formula = missing_arg(), data = missing_arg(), 
##     weights = missing_arg(), model = TRUE)

Note that model = TRUE is needed to produce quantile predictions when there is a stratification variable and can be overridden in other cases.

fit() passes the data directly to survival::curvreg() so that its formula method can create dummy variables as-needed.

Parameter translations

The standardized parameter names in parsnip can be mapped to their original names in each engine that has main parameters. Each engine typically has a different default value (shown in parentheses) for each parameter.

parsnipflexsurvsurvival
distdistdist

References

Jackson, C. (2016). flexsurv: A Platform for Parametric Survival Modeling in R. Journal of Statistical Software, 70(8), 1 - 33.

See also

Examples

show_engines("surv_reg")
#> # A tibble: 2 × 2 #> engine mode #> <chr> <chr> #> 1 flexsurv regression #> 2 survival regression
surv_reg()
#> Warning: `surv_reg()` was deprecated in parsnip 0.1.6. #> Please use `survival_reg()` instead.
#> Parametric Survival Regression Model Specification (regression) #> #> Computational engine: survival #>