[R] anova.coxph for multiple events model
Andreia Leite
andreiaheitorleite at gmail.com
Wed May 30 17:59:03 CEST 2012
Hi,
I'm trying to do a multiple events model using coxph. I need to choose which
covariates stay in the final model and i'm using anova but it seems that it
doesn't work with robust variances as a error message appears when I try to
do it:
/PWPfit<-coxph(Surv(ini,fim,status)~Sexo+Transmissao+Regime+HAART+Drogas+Psi+
+ CD4+CV+Neo+IO+cluster(idPARTICIPANTE)+strata(Estrato),data=PWP)
> anova(PWPfit)
Error in anova.coxph(PWPfit) :
Can't do anova tables with robust variances
/
However when I fit two different nested models the function anova seems to
work:
/>
PWPfit<-coxph(Surv(ini,fim,status)~Sexo+Transmissao+Regime+HAART+Drogas+Psi+
+ CD4+CV+Neo+IO+cluster(idPARTICIPANTE)+strata(Estrato),data=PWP)
>
> PWPfit2<-coxph(Surv(ini,fim,status)~Sexo+Transmissao+Regime+HAART+Drogas+Psi+
+ CD4+CV+Neo+cluster(idPARTICIPANTE)+strata(Estrato),data=PWP)
>
> anova(PWPfit,PWPfit2,test="Chisq")
Analysis of Deviance Table
Model 1: Surv(ini, fim, status) ~ Sexo + Transmissao + Regime + HAART +
Drogas + Psi + CD4 + CV + Neo + IO + cluster(idPARTICIPANTE) +
strata(Estrato)
Model 2: Surv(ini, fim, status) ~ Sexo + Transmissao + Regime + HAART +
Drogas + Psi + CD4 + CV + Neo + cluster(idPARTICIPANTE) +
strata(Estrato)
Resid. Df Resid. Dev Df Deviance P(>|Chi|)
1 371 1253.00
2 372 1253.30 -1 -0.31 0.5794
Warning message:
In all(lapply(object, function(x) inherits(x, "coxph"))) :
coercing argument of type 'list' to logical
/
Does anyone know why this happens? Should I do it separately for each
variable or is there an alternative way to choose covariates in this kind of
models?
Thanks a lot,
Andreia Leite (Biostatistics Master Degree Student)
Faculdade de Ciências, Lisbon, Portugal
--
View this message in context: http://r.789695.n4.nabble.com/anova-coxph-for-multiple-events-model-tp4631842.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list