predict.coxph() 和 survC1::Est.Cval -- predict() 输出的类型
predict.coxph() and survC1::Est.Cval -- type for predict() output
给定一个 coxph()
模型,我想使用 predict()
预测危害,然后使用 survC1::Est.Cval( . . . nofit=TRUE)
获得模型的 c 值。
Est.Cval()
文档相当简洁,但是说 "nofit=TRUE: If TRUE, the 3rd column of mydata is used as the risk score directly in calculation of C."
假设,为了简单起见,我想对构建模型所依据的相同数据进行预测。对于
coxModel
来自 coxph()
的 Cox 回归模型;
time
时间向量(正实数),与 coxModel
建立的时间相同;和
event
event/censor 指标的 0/1 向量,相同长度,coxModel
建立的相同事件 --
这是否表明我想要
predictions <- predict(coxModel, type="risk")
dd <- cbind(time, event, pred)
Est.Cval(mydata=dd, tau=tau, nofit=TRUE)
或者第一行应该是
predictions <- predict(coxModel, type="lp")
?
感谢您的帮助,
答案是没关系.
基本上,对于所有可比较的时间对(事件和检查员),一致性值正在测试较晚的时间具有较低风险的可能性(对于一个非常好的模型,几乎总是如此)。但由于 e^u 是真实 u 的单调函数,而 c-value 只是测试比较,所以是否提供风险比无关紧要, e^(sum{\beta_i x_i}), 或线性预测器, sum{\beta_i x_i}.
由于@42 激励我提出一个最小的工作示例,我们可以对其进行测试。我们将比较 Est.Cval()
使用一种输入与使用另一种输入提供的值;我们可以将两者与我们从 coxph()
.
获得的值进行比较
(最后一个值不会完全匹配,因为 Est.Cval()
使用 Uno 等人 2011 年的方法 (Uno, H., Cai, T., Pencina, M. J., D'Agostino, R. B. & Wei, L. J. On the C-statistics for evaluating overall adequacy of risk prediction procedures with censored survival data. Statist. Med. 30, 1105–1117 (2011), https://onlinelibrary.wiley.com/doi/full/10.1002/sim.4154) 但它可以作为完整性检查,因为值应该接近。)
以下基于使用 R 进行生存分析,2017 年 9 月 25 日,作者 Joseph Rickert,https://rviews.rstudio.com/2017/09/25/survival-analysis-with-r/。
library("survival")
library("survC1")
# Load dataset included with survival package
data("veteran")
# The variable `time` records survival time; `status` indicates whether the
# patient’s death was observed (status=1) or that survival time was censored
# (status = 0).
# The model they build in the example:
coxModel <- coxph(Surv(time, status) ~ trt + celltype + karno + diagtime +
age + prior, data=veteran)
# The results
summary(coxModel)
注意它给我们的c-score:
Concordance= 0.736 (se = 0.021 )
现在,我们计算 Est.Cval()
给出的 c-score 两种类型的值:
# The value from Est.Cval(), using a risk input
cvalByRisk <- Est.Cval(mydata=cbind(time=veteran$time, event=veteran$status,
predictions=predict(object=coxModel, newdata=veteran, type="risk")),
tau=2000, nofit=TRUE)
# The value from Est.Cval(), using a linear predictor input
cvalByLp <- Est.Cval(mydata=cbind(time=veteran$time, event=veteran$status,
predictions=predict(object=coxModel, newdata=veteran, type="lp")),
tau=2000, nofit=TRUE)
和我们比较结果:
cvalByRisk$Dhat
[1] 0.7282348
cvalByLp$Dhat
[1] 0.7282348
给定一个 coxph()
模型,我想使用 predict()
预测危害,然后使用 survC1::Est.Cval( . . . nofit=TRUE)
获得模型的 c 值。
Est.Cval()
文档相当简洁,但是说 "nofit=TRUE: If TRUE, the 3rd column of mydata is used as the risk score directly in calculation of C."
假设,为了简单起见,我想对构建模型所依据的相同数据进行预测。对于
coxModel
来自coxph()
的 Cox 回归模型;time
时间向量(正实数),与coxModel
建立的时间相同;和event
event/censor 指标的 0/1 向量,相同长度,coxModel
建立的相同事件 --
这是否表明我想要
predictions <- predict(coxModel, type="risk")
dd <- cbind(time, event, pred)
Est.Cval(mydata=dd, tau=tau, nofit=TRUE)
或者第一行应该是
predictions <- predict(coxModel, type="lp")
?
感谢您的帮助,
答案是没关系.
基本上,对于所有可比较的时间对(事件和检查员),一致性值正在测试较晚的时间具有较低风险的可能性(对于一个非常好的模型,几乎总是如此)。但由于 e^u 是真实 u 的单调函数,而 c-value 只是测试比较,所以是否提供风险比无关紧要, e^(sum{\beta_i x_i}), 或线性预测器, sum{\beta_i x_i}.
由于@42 激励我提出一个最小的工作示例,我们可以对其进行测试。我们将比较 Est.Cval()
使用一种输入与使用另一种输入提供的值;我们可以将两者与我们从 coxph()
.
(最后一个值不会完全匹配,因为 Est.Cval()
使用 Uno 等人 2011 年的方法 (Uno, H., Cai, T., Pencina, M. J., D'Agostino, R. B. & Wei, L. J. On the C-statistics for evaluating overall adequacy of risk prediction procedures with censored survival data. Statist. Med. 30, 1105–1117 (2011), https://onlinelibrary.wiley.com/doi/full/10.1002/sim.4154) 但它可以作为完整性检查,因为值应该接近。)
以下基于使用 R 进行生存分析,2017 年 9 月 25 日,作者 Joseph Rickert,https://rviews.rstudio.com/2017/09/25/survival-analysis-with-r/。
library("survival")
library("survC1")
# Load dataset included with survival package
data("veteran")
# The variable `time` records survival time; `status` indicates whether the
# patient’s death was observed (status=1) or that survival time was censored
# (status = 0).
# The model they build in the example:
coxModel <- coxph(Surv(time, status) ~ trt + celltype + karno + diagtime +
age + prior, data=veteran)
# The results
summary(coxModel)
注意它给我们的c-score:
Concordance= 0.736 (se = 0.021 )
现在,我们计算 Est.Cval()
给出的 c-score 两种类型的值:
# The value from Est.Cval(), using a risk input
cvalByRisk <- Est.Cval(mydata=cbind(time=veteran$time, event=veteran$status,
predictions=predict(object=coxModel, newdata=veteran, type="risk")),
tau=2000, nofit=TRUE)
# The value from Est.Cval(), using a linear predictor input
cvalByLp <- Est.Cval(mydata=cbind(time=veteran$time, event=veteran$status,
predictions=predict(object=coxModel, newdata=veteran, type="lp")),
tau=2000, nofit=TRUE)
和我们比较结果:
cvalByRisk$Dhat
[1] 0.7282348
cvalByLp$Dhat
[1] 0.7282348