開始使用免費開始

從 Weibull 模型估計中位存活時間

現在你可以用 Weibull 模型(survreg() 函式)來估計 GBSG2 資料中乳癌病人的存活。 記住,Weibull 模型估計的是平滑的存活函式,而 Kaplan-Meier 方法得到的是階梯函式。

使用 predict() 並設定 type = "quantile",可以計算分配函式的各個分位數。 我們將用這個方式來計算中位存活時間。

本練習已為你載入 survival 套件與 GBSG2 資料。

本練習屬於課程

R 的生存分析

檢視課程

練習說明

  • 估計乳癌病人的 Weibull 模型。
  • 使用 predict() 並設定 type = "quantile",從該模型計算中位存活時間。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Weibull model
wb <- ___(Surv(time, cens) ~ 1, data = GBSG2)

# Compute the median survival from the model
predict(wb, type = "quantile", p = ___, newdata = data.frame(1))
編輯並執行程式碼