Skip to contents

For "exponential", "weibull", "lognormal", "loglogistic", "gaussian". Use morie_survival_aft() for covariate-adjusted parametric models.

Usage

morie_survival_parametric(
  time,
  event,
  dist = c("weibull", "exponential", "lognormal", "loglogistic", "gaussian")
)

Arguments

time

Numeric vector of event/censoring times.

event

Integer/logical vector; 1 = event, 0 = censored.

dist

Distribution name for parametric/AFT fits (e.g. "weibull", "lognormal", "loglogistic").

Value

A named list with elements distribution, coefficients, scale, log_likelihood, aic, bic, n_observations, n_events.

Examples

set.seed(1)
time <- rexp(60); event <- rbinom(60, 1, 0.7)
str(morie_survival_parametric(time, event), max.level = 1)
#> List of 8
#>  $ distribution  : chr "weibull"
#>  $ coefficients  : Named num 0.255
#>   ..- attr(*, "names")= chr "(Intercept)"
#>  $ scale         : num 0.858
#>  $ log_likelihood: num -57.2
#>  $ aic           : num 118
#>  $ bic           : num 123
#>  $ n_observations: int 60
#>  $ n_events      : int 47