我想比较不同的生存分析模型。为此,我使用“pec”R包。我使用10倍交叉验证。为了比较不同的模型,我运行模型30个周期。结果,我可以得到(i)平均pec曲线的积分Brier分数(IBS),(ii)该pec曲线的crossvalErr,以及(iii)每个单独循环的crossvalErr。但是,我希望能够在不同的时间为每个周期获得IBS。
# create a fit
fit <-Surv(survival,censored)~v1+v2+v3+v4
# models
cph <- selectCox(fit, data=data, rule="aic")
rsf <- rfsrc(fit, data=data, forest=True, ntree=1000)
cforest <- pecCforest(fit, data=data, controls=cforest_classical(ntree=1000))
fitpec <- pec(list("selectcox" = fitcox, "rsf" = fitrsf, "cforest" = fitcforest), data = dd_Ex, formula = Surv(surv_m,Censored)~1,
splitMethod = "cv10", B=20, keep.index=TRUE, keep.matrix=TRUE)
为了获得IBS我使用下面的代码,但这只给了我平均pec的IBS:
crps(fitpec, times=c(12, 24, 36, 48, 60, 120, 240, 480), what="crossvalErr")
Integrated Brier score (crps):
IBS[0;time=12) IBS[0;time=24) IBS[0;time=36) IBS[0;time=48) IBS[0;time=60) IBS[0;time=120) IBS[0;time=240)
[1,] 0.015 0.068 0.121 0.153 0.168 0.168 0.133
[2,] 0.014 0.058 0.093 0.110 0.115 0.108 0.081
[3,] 0.013 0.053 0.089 0.107 0.116 0.116 0.091
[4,] 0.012 0.050 0.083 0.099 0.106 0.104 0.078
IBS[0;time=480)
[1,] 0.095
[2,] 0.059
[3,] 0.070
[4,] 0.051
我还尝试使用crossValErrMat,它包含所有周期的pec曲线的数据,但这给了我一个错误:
crps(fitpec30R$CrossValErrMat[[1]]$Reference, times=c(12, 24, 36, 48, 60, 120, 240, 480), what="crossvalErr")
Error: class(object)[1] == "pec" is not TRUE
如何在每个周期找到IBS?谢谢!