简体   繁体   English

rcs()条款的anova.rms问题

[英]anova.rms problem with rcs() terms

I´m having problem with the anova function in the rms package: 我在rms软件包中的anova函数遇到问题:

require(rms)
getHdata(prostate)

mod1<-cph(Surv(dtime,status!="Alive")~stage+rx+age+wt,data=prostate,x=T,y=T)
mod2<-cph(Surv(dtime,status!="Alive")~stage+rx+rcs(age,4)+wt,data=prostate,x=T,y=T)
anova(mod1)
anova(mod2)

-everything works alright, but when I try to compare the models for the impact of non-linearity on age -一切正常,但是当我尝试比较非线性对年龄的影响的模型时

anova(mod1,mod2)

I get 我懂了

Error in anova.rms(mod1, mod2) : factor names not in design:  mod2

What does this mean? 这是什么意思? What can I do to circumvent it? 我该怎么做才能规避它?

//M //中号

You should be able to use the output of anova(mod2) as one way to assess the significance but the best answer would be to compare the -2*log(likelihood) statistics. 您应该能够使用anova(mod2)的输出作为评估显着性的一种方法,但是最好的答案是比较-2 * log(likelihood)统计信息。 The anova.rms function is not designed to take two model fits. anova.rms函数并非旨在采用两种模型拟合。 The second and subsequent unnamed arguments are assumed to be names of terms within the model rather than fit objects. 假定第二个及后续未命名的参数是模型中术语的名称,而不是适合的对象。

(Note that with rcs terms you will not see the sum of individual terms equal the full model chi-square values. I have asked Harrell about this and he says to do the cross-model comparisons "by hand".) (请注意,使用rcs项时,您将看不到各个项的总和等于完整模型卡方值。我已经询问过Harrell,他说要“手动”进行跨模型比较。)

使用lrtest进行此比较(根据Misha的评论)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM