In case anyone is interested, I figure it out that when strata is used, I have
to specify the comparison matrix manually:
> (fit<-coxph(Surv(stop, status>0)~treatment+strata(enum),bladder1))
> coef(fit)
treatmentpyridoxine treatmentthiotepa
0.1877925 -0.2097894> glht(fit,linfct=mcp(treatment='Tukey'))
Error in glht.matrix(model = list(coefficients = c(0.187792527684977, :
‘ncol(linfct)’ is not equal to ‘length(coef(model))’
> K<-rbind('pyridoxine - placebo'= c(1,0),'thiotepa -
placebo' = c(0,1),'thiotepa
>- pyridoxine'= c(-1,1))
> glht(fit,linfct=K)
General Linear Hypotheses
Linear Hypotheses:
Estimate
pyridoxine - placebo == 0 0.1878
thiotepa - placebo == 0 -0.2098
thiotepa - pyridoxine == 0 -0.3976
John
________________________________
To: r-help@r-project.org
Sent: Tue, March 1, 2011 11:38:22 AM
Subject: [R] glht() used with coxph()
Hi, I am experimenting with using glht() from multcomp package together with
coxph(), and glad to find that glht() can work on coph object, for example:
> (fit<-coxph(Surv(stop, status>0)~treatment,bladder1))
coxph(formula = Surv(stop, status > 0) ~ treatment, data = bladder1)
coef exp(coef) se(coef) z p
treatmentpyridoxine -0.063 0.939 0.161 -0.391 0.70
treatmentthiotepa -0.159 0.853 0.168 -0.947 0.34
Likelihood ratio test=0.91 on 2 df, p=0.635 n= 294
> glht(fit,linfct=mcp(treatment='Tukey'))
General Linear Hypotheses
Multiple Comparisons of Means: Tukey Contrasts
Linear Hypotheses:
Estimate
pyridoxine - placebo == 0 -0.06303
thiotepa - placebo == 0 -0.15885
thiotepa - pyridoxine == 0 -0.09582
However, once I added a strata term in the formula of coxph(), then glht()
can't
work anymore:
> (fit<-coxph(Surv(stop, status>0)~treatment+strata(enum),bladder1))
coxph(formula = Surv(stop, status > 0) ~ treatment + strata(enum),
data = bladder1)
coef exp(coef) se(coef) z p
treatmentpyridoxine 0.188 1.21 0.170 1.11 0.27
treatmentthiotepa -0.210 0.81 0.172 -1.22 0.22
Likelihood ratio test=4.39 on 2 df, p=0.111 n= 294
> glht(fit,linfct=mcp(treatment='Tukey'))
Error in glht.matrix(model = list(coefficients = c(0.187792527684977, :
‘ncol(linfct)’ is not equal to ‘length(coef(model))’
Can anyone suggest why strata would make coxph object ineligible for glht()? Or
how to make it work?
Thanks
John
[[alternative HTML version deleted]]
[[alternative HTML version deleted]]