比較 Weibull 模型與 Kaplan-Meier 估計
來為 GBSG2 資料用 Weibull 模型繪製存活曲線吧!
本練習已為你載入 survival 與 survminer 套件,以及 GBSG2 資料。
本練習屬於課程
R 的生存分析
練習說明
- 針對
GBSG2資料估計 Weibull 模型。 - 從模型計算存活曲線。
- 繪製兩種估計得到的存活曲線並加以比較。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Weibull model
wb <- ___(___(___, ___) ~ ___, ___)
# Retrieve survival curve from model
surv <- seq(.99, .01, by = -.01)
# Get time for each probability
t <- predict(___, type = ___, p = ___, newdata = data.frame(___))
# Create data frame with the information needed for ggsurvplot_df
surv_wb <- data.frame(time = ___, surv = ___,
upper = NA, lower = NA, std.err = NA)
# Plot
ggsurvplot_df(fit = ___, surv.geom = ___)