MulaiMulai sekarang secara gratis

Compute Weibull model

For a Weibull model with covariates, we can compute the survival curve just as we did for the Weibull model without covariates. The only thing we need to do is specify the covariate values for a given survival curve in the predict() function. This can be done with the argument newdata.

Latihan ini adalah bagian dari kursus

Survival Analysis in R

Lihat Kursus

Petunjuk latihan

  • Compute a Weibull model for the GBSG2 dataset with covariate horTh to analyze the effect of hormonal therapy on the survival of patients.
  • Compute the survival curve for patients who receive hormonal therapy.
  • Take a look at the survival curve with str().

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Weibull model
wbmod <- survreg(Surv(___, ___) ~ ___, data = GBSG2)
coef(wbmod)

# Retrieve survival curve from model
surv <- seq(.99, .01, by = -.01)
t_yes <- predict(___, type = "quantile", p = ___,
  newdata = data.frame(horTh = ___))

# Take a look at survival curve
str(t_yes)
Edit dan Jalankan Kode