zgw1090991972 2023-07-24 00:47 采纳率: 0%
浏览 72
已结题

使用PEC包计算C指数的时候报错

使用PEC包计算C指数的时候报错

f<-cph(Surv(survival.time,death)~Age+stroke+Angiotensin.II.receptor.blocker+hematocrit+albumin+creatinine+alanine.aminotransferase+total_KtV,data=tdata,x=T,Y=T,surv = T)
set.seed(123)
c_index<-cindex(list("f"=f),
          eval.times=seq(0,3650,365),
          cens.model = "cox",
          keep.pvalues = T,
          confInt = T,
          confLevel = 0.95,
          splitMethod = "bootcv",
          B=1000)
报错内容
Error in UseMethod("predictEventProb", object) : 
  no applicable method for 'predictEventProb' applied to an object of class "c('cph', 'rms', 'coxph')"
In addition: Warning messages:
1: In cindex(list(`model f` = f), eval.times = seq(0, 3650, 365), cens.model = "cox",  :
  Formula missing. Using formula from first model
2: In cindex(list(`model f` = f), eval.times = seq(0, 3650, 365), cens.model = "cox",  :
  Argument data is missing. I use the data from the call to the first model instead.
  • 写回答

13条回答 默认 最新

  • Watch the clown 2023-07-24 11:06
    关注
    获得1.50元问题酬金

    两个问题,第一个问题cindex函数你没指定生存分析模型公式,这样修改:

    c_index <- cindex(list("f"=f),
                      formula = Surv(survival.time, death) ~ Age + stroke + Angiotensin.II.receptor.blocker + hematocrit + albumin + creatinine + alanine.aminotransferase + total_KtV,
                      eval.times = seq(0, 3650, 365),
                      cens.model = "cox",
                      keep.pvalues = T,
                      confInt = T,
                      confLevel = 0.95,
                      splitMethod = "bootcv",
                      B = 1000)
    
    

    第二个f对象类型不对

    library(rms)
    model <- cph(Surv(survival.time, death) ~ Age + stroke + Angiotensin.II.receptor.blocker + hematocrit + albumin + creatinine + alanine.aminotransferase + total_KtV, data = tdata, x = T, Y = T, surv = T)
    c_index <- cindex(list("model" = model),
                      eval.times = seq(0, 3650, 365),
                      cens.model = "cox",
                      keep.pvalues = T,
                      confInt = T,
                      confLevel = 0.95,
                      splitMethod = "bootcv",
                      B = 1000)
    
    
    评论

报告相同问题?

问题事件

  • 系统已结题 8月1日
  • 创建了问题 7月24日