[R] Trouble Computing Type III SS in a Cox Regression using drop1 and Anova
Paul Miller
pjmiller_57 at yahoo.com
Wed Apr 24 19:17:51 CEST 2013
Hello All,
Am having some trouble computing Type III SS in a Cox Regression using either drop1 or Anova from the car package. Am hoping that people will take a look to see if they can tell what's going on.
Here is my R code:
cox3grp <- subset(survData,
Treatment %in% c("DC", "DA", "DO"),
c("PTNO", "Treatment", "PFS_CENSORED", "PFS_MONTHS", "AGE", "PS2"))
cox3grp <- droplevels(cox3grp)
str(cox3grp)
coxCV <- coxph(Surv(PFS_MONTHS, PFS_CENSORED == 1) ~ AGE + PS2, data=cox3grp, method = "efron")
coxCV
drop1(coxCV, test="Chisq")
require(car)
Anova(coxCV, type="III")
And here are my results:
cox3grp <- subset(survData,
+ Treatment %in% c("DC", "DA", "DO"),
+ c("PTNO", "Treatment", "PFS_CENSORED", "PFS_MONTHS", "AGE", "PS2"))
> cox3grp <- droplevels(cox3grp)
> str(cox3grp)
'data.frame': 227 obs. of 6 variables:
$ PTNO : int 1195997 104625 106646 1277507 220506 525343 789119 817160 824224 82632 ...
$ Treatment : Factor w/ 3 levels "DC","DA","DO": 1 1 1 1 1 1 1 1 1 1 ...
$ PFS_CENSORED: int 1 1 1 0 1 1 1 1 0 1 ...
$ PFS_MONTHS : num 1.12 8.16 6.08 1.35 9.54 ...
$ AGE : num 72 71 80 65 72 60 63 61 71 70 ...
$ PS2 : Ord.factor w/ 2 levels "Yes"<"No": 2 2 2 2 2 2 2 2 2 2 ...
>
> coxCV <- coxph(Surv(PFS_MONTHS, PFS_CENSORED == 1) ~ AGE + PS2, data=cox3grp, method = "efron")
> coxCV
Call:
coxph(formula = Surv(PFS_MONTHS, PFS_CENSORED == 1) ~ AGE + PS2,
data = cox3grp, method = "efron")
coef exp(coef) se(coef) z p
AGE 0.00492 1.005 0.00789 0.624 0.530
PS2.L -0.34523 0.708 0.14315 -2.412 0.016
Likelihood ratio test=5.66 on 2 df, p=0.0591 n= 227, number of events= 198
>
> drop1(coxCV, test="Chisq")
Single term deletions
Model:
Surv(PFS_MONTHS, PFS_CENSORED == 1) ~ AGE + PS2
Df AIC LRT Pr(>Chi)
<none> 1755.2
AGE 1 1753.6 0.3915 0.53151
PS2 1 1758.4 5.2364 0.02212 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> require(car)
> Anova(coxCV, type="III")
Analysis of Deviance Table (Type III tests)
LR Chisq Df Pr(>Chisq)
AGE 0.3915 1 0.53151
PS2 5.2364 1 0.02212 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
Both drop1 and Anova give me a different p-value than I get from coxph for both my two-level ps2 variable and for age. This is not what I would expect based on experience using SAS to conduct similar analyses. Indeed SAS consistently produces the same p-values. Namely the ones I get from coxph.
My sense is that I'm probably misusing R in some way but I'm not sure what I'm likely to be doing wrong. SAS prodcues Wald Chi-Square results for its type III tests. Maybe that has something to do with it. Ideally, I'd like to get type III values that match those from coxph. If anyone could help me understand better, that would be greatly appreciated.
Thanks,
Paul
More information about the R-help
mailing list