Nothing
## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(MultiFrailty)
library(survival)
## ----eval = TRUE--------------------------------------------------------------
library(MultiFrailty)
library(survival)
# Prepare lung cancer dataset
data(lung, package = "survival")
lung_clean <- na.omit(lung[, c("time", "status", "age", "sex")])
lung_clean$status <- ifelse(lung_clean$status == 2, 1, 0)
lung_clean$sex <- ifelse(lung_clean$sex == 1, 0, 1)
# Fit Inverse Gaussian (IG) frailty model with Weibull baseline
fit_ig <- multifrailty(Surv(time, status) ~ age + sex, data = lung_clean,
baseline = "weibull", frailty = "ig")
summary(fit_ig)
# Fit Generalized Lindley Type 1 (GL1) frailty model
fit_gl1 <- multifrailty(Surv(time, status) ~ age + sex, data = lung_clean,
baseline = "weibull", frailty = "gl1")
summary(fit_gl1)
# Compare candidate models
comp <- compare_models(fit_ig, fit_gl1)
print(comp)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.