[英]Combine quantile and continuous models in plot (cph, rms)?
我想在同一個圖中結合連續模型和分位數模型來比較和對比這兩種方法(xtile 是一個返回分位數作為因子的函數):
q.s <- cph(inc ~ rcs(exposure,3), data=data)
q.q <- cph(inc ~ xtile(exposure,3), data=data)
p.s <- Predict(q.s, exposure, fun=exp)
p.q <- Predict(q.q, exposure, fun=exp)
ggplot.Predict
給出了任一模型的不錯圖 - 但我想將兩者結合起來。 這可能嗎?
我添加了一個示例 - 我希望它可以說明我想要生成的內容。
試試這個,其中 plot1/2 是您的分位數和連續圖(可以更改高度、寬度、列數、行數):
p1 <- ggplot.Predict(..plot1 options here...)
p2 <- ggplot.Predict(..plot2 options here...)
library(gridExtra)
grid.arrange(p1, p2,
ncol=2, nrow=1, widths=c(2,2), heights=c(2))
有關更多信息,請查看gridExtra
包。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.