開始使用免費開始

視覺化 Weibull 模型

在這個練習中,我們會依照影片中的範例,按步驟重現:

  • 計算 Weibull 模型
  • 設定「假想病人」
  • 計算生存曲線
  • 建立包含生存曲線資訊的 data.frame
  • 繪圖

我們現在會專注在最後兩個步驟。

本練習已為你載入 survivalsurvminerreshape2 套件與 GBSG2 資料。 你先前計算好的 Weibull 模型 wbmod,以及假想病人的資料 newdat,也都已可使用。

本練習屬於課程

R 的生存分析

檢視課程

動手互動練習

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

# Use cbind() to combine the information in newdat with t
surv_wbmod_wide <- cbind(newdat, t)
  
# Use melt() to bring the data.frame to long format
surv_wbmod <- melt(surv_wbmod_wide, id.vars = c("___", "___"), variable.name = "surv_id", value.name = "___")
編輯並執行程式碼