Matthias Gondan wrote:> Dear List,
>
> I have tried a stratified Cox Regression, it is working fine, except for
> the "Anova"-Tests:
>
> Here the commands (should work out of the box):
>
> library(survival)
> d = colon[colon$etype==2, ]
> m = coxph(Surv(time, status) ~ strata(sex) + rx, data=d)
> summary(m)
> # Printout ok
> anova(m, test='Chisq')
>
> This is the output of the anova command:
>
>
>> Analysis of Deviance Table
>> Cox model: response is Surv(time, status)
>> Terms added sequentially (first to last)
>>
>> Df Deviance Resid. Df Resid. Dev P(>|Chi|)
>> NULL 929 5233.5
>> strata(sex) 0 929
>> rx 2 927 5221.2
>> Warning message:
>> In is.na(coef(fit)) :
>> is.na() auf nicht-(Liste oder Vektor) des Typs 'NULL'
angewendet
>>
>
> It should be possible to do Chi-Square-Tests in a stratified analysis,
> right?
>
Yes. anova.coxph() should keep the strata term out of things.
drop1() has the same issue, but it does at least give the right test:
> drop1(m, test='Chisq')
Single term deletions
Model:
Surv(time, status) ~ strata(sex) + rx
Df AIC LRT Pr(Chi)
<none> 5225.2
strata(sex) 0 5852.2 627.0
rx 2 5233.5 12.2 0.002215 **
or, it the irrelevant line bothers you,
drop1(m, scope=~.-strata(sex), test='Chisq')
I would have thought that at least this would work, but
no:> anova(update(m, ~.-rx), m, test='Chisq')
Analysis of Deviance Table
Model 1: Surv(time, status) ~ strata(sex)
Model 2: Surv(time, status) ~ strata(sex) + rx
Resid. Df Resid. Dev Df Deviance P(>|Chi|)
1 929
2 927 5221.2 2
Warning message:
In is.na(coef(x)) : is.na() applied to non-(list or vector) of type
'NULL'
(Did you check the latest version? Mine is what came with 2.6.1.)
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907