[英]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.