parametric: Fully Parametric Survival Model

View source: R/parametric.R

parametricR Documentation

Fully Parametric Survival Model

Description

Fit/predict implementation of survival::survreg(), which can return absolutely continuous distribution predictions using distr6.

Usage

parametric(
  formula = NULL,
  data = NULL,
  reverse = FALSE,
  time_variable = "time",
  status_variable = "status",
  x = NULL,
  y = NULL,
  eps = 1e-15,
  ...
)

Arguments

formula

(formula(1))
Object specifying the model fit, left-hand-side of formula should describe a survival::Surv() object.

data

(data.frame(1))
Training data of data.frame like object, internally is coerced with stats::model.matrix().

reverse

(logical(1))
If TRUE fits estimator on censoring distribution, otherwise (default) survival distribution.

time_variable

(character(1))
Alternative method to call the function. Name of the 'time' variable, required if formula. or x and Y not given.

status_variable

(character(1))
Alternative method to call the function. Name of the 'status' variable, required if formula or x and Y not given.

x

(data.frame(1))
Alternative method to call the function. Required if ⁠formula, time_variable⁠ and status_variable not given. Data frame like object of features which is internally coerced with model.matrix.

y

⁠([survival::Surv()])⁠
Alternative method to call the function. Required if ⁠formula, time_variable⁠ and status_variable not given. Survival outcome of right-censored observations.

eps

(numeric(1))
Used when the fitted scale parameter is too small. Default 1e-15.

...

ANY
Additional arguments passed to survival::survreg().

Value

An object inheriting from class parametric.

Examples

if (requireNamespaces(c("distr6", "survival"))) {
 library(survival)
 parametric(Surv(time, status) ~ ., data = simsurvdata(10))
}

RaphaelS1/survivalmodels documentation built on July 5, 2024, 10:17 a.m.