2

我试图通过在使用变量交互时绘制 cox 回归来绘制调整后的生存曲线。

阅读 survfit.coxph 页面https://stat.ethz.ch/R-manual/R-devel/library/survival/html/survfit.coxph.html我看到参数“newdata”

newdata 
a data frame with the same variable names as those that appear in the coxph formula. It is also valid to use a vector, if the data frame would consist of a single row.

The curve(s) produced will be representative of a cohort whose covariates correspond to the values in newdata. Default is the mean of the covariates used in the coxph fit.

我想在我的 cox 输出中绘制作为交互的线条。即,如果我的 cox 输出看起来像:

                    coef exp(coef) se(coef)      z       p
 Drug2           -0.1345     0.876   0.1812 -0.732 4.5e-01
 Drug3           -0.3678     0.719   0.0816 -3.966 7.2e-05
 Drug4            0.0468     1.063   0.0432  0.932 3.4e-01
 Sex              0.2574     1.294   0.0786  3.133 1.2e-03
 Sex:Drug2       -0.1283     0.880   0.1809 -0.709 4.8e-01
 Sex:Drug3       -0.3226     0.724   0.0817 -3.950 7.8e-05
 Sex:Drug4        0.0524     1.054   0.0574  0.913 3.6e-01

我想在与Sex.

这让我想到了这个newdata参数。

与调用 newdata 相比,不包括 newdata 和仅使用协变量的平均值有什么区别。在这一点上,我什至不知道如何正确构建 newdata。

如果有人可以给我任何关于如何newdata根据我的 cox 模型构建的指示,以及与仅使用平均值相比有什么意义。在绘制基于 cox 数据的新生存图时,我应该期望原始生存曲线中的线条数量相同。

4

1 回答 1

2

您仍将调整后的平均生存率作为隐含的“基线生存曲线”,但基于 newdata 的曲线的风险比将从 1.0 偏移 exp(coef) 因子。您输入代表您想要估计的特征的值,该expand.grid函数将创建协变量的所有 2way 组合。目前尚不清楚您是如何对 Sex 进行建模的,但从输出中可以看出它是一个数字而不是一个因素,我会假设存在一个单位的差异。尝试:

plot( survfit( my.fit, newdata=expand.grid(Sex=c(1,2), drug=factor(1:4) ) ) )
于 2015-11-30T16:31:40.020 回答