survival_prob_coxnet: A wrapper for survival probabilities with coxnet models

View source: R/proportional_hazards-glmnet.R

survival_prob_coxnetR Documentation

A wrapper for survival probabilities with coxnet models

Description

A wrapper for survival probabilities with coxnet models

Usage

survival_prob_coxnet(
  object,
  new_data,
  eval_time,
  time = deprecated(),
  output = "surv",
  penalty = NULL,
  multi = FALSE,
  ...
)

Arguments

object

A parsnip model_fit object resulting from proportional_hazards() with engine = "glmnet".

new_data

Data for prediction.

eval_time

A vector of integers for prediction times.

time

Deprecated in favor of eval_time. A vector of integers for prediction times.

output

One of "surv" or "haz".

penalty

Penalty value(s).

multi

Allow multiple penalty values? Defaults to FALSE.

...

Options to pass to survival::survfit().

Value

A tibble with a list column of nested tibbles.

Examples


cox_mod <- proportional_hazards(penalty = 0.1) %>%
  set_engine("glmnet") %>%
  fit(Surv(time, status) ~ ., data = lung)
survival_prob_coxnet(cox_mod, new_data = lung[1:3, ], eval_time = 300)


EmilHvitfeldt/survnip documentation built on April 23, 2024, 3:07 p.m.