Thx for the answer.
I am using survival.
I didn't know that the Wald and score tests were the same for individual
variables in a coxph; I Thought the score test was the "multivariate version"
of
the Log-rank.
However, say I have only one variable in the model, I should expect the test
for
the full model and the one for a single variable to be the same? Then it seems
to me that the default test is the Wald and that the Wald and the Score are
different.
> cox_lr_age <- coxph(Surv(tilr, ev_lr==1)~age, data=tam)
> summary(cox_lr_age)
Call:
coxph(formula = Surv(tilr, ev_lr == 1) ~ age, data = tam)
n=2156 (76 observations deleted due to missingness)
coef exp(coef) se(coef) z Pr(>|z|)
age 0.019504 1.019696 0.004651 4.193 2.75e-05 ***
---
Signif. codes: 0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â
â 1
exp(coef) exp(-coef) lower .95 upper .95
age 1.020 0.9807 1.010 1.029
Rsquare= 0.008 (max possible= 0.669 )
Likelihood ratio test= 18.4 on 1 df, p=1.787e-05
Wald test = 17.58 on 1 df, p=2.751e-05
Score (logrank) test = 17.86 on 1 df, p=2.375e-05
David Biau.
________________________________
De : David Winsemius <[email protected]>
Cc : r help list <[email protected]>
Envoyé le : Ven 30 juillet 2010, 17h 34min 28s
Objet : Re: [R] COXPH: how to get the score test and likelihood ratio test for
a
specific variable in a multivariate Coxph ?
On Jul 30, 2010, at 11:08 AM, Biau David wrote:
> Hello,
>
> I would like to get the likelihood ratio and score tests for specific
variables
> in a multivariate coxph model. The default is Wald, so the tests for each
> separate variable is based on Wald's test. I have the other tests for the full
> model but I don't know how to get them for each variable.
>
> Any idea?
>
The first idea would be to specify which function in which package you are
asking questions about. In the case of coxph in the survival package, for
instance, you do get a likelihood ratio test (== differences in
log-likelihoods)
by default. A score test is, at least as as I understand it for individual
variables, equivalent to a Wald test, so I don't really understand your
question, since youa re already getting all of that in the survival package.
(You can extract a "score" value and loglik values from a coxph object by:
(with the first example in the coxph help page)
coxph(Surv(time, status) ~ x + strata(sex), test1)$score
xoxph(Surv(time, status) ~ x + strata(sex), test1)$loglik
But anova(coxph-object) would give you these values in a neater bundle.
#Analysis of Deviance Table
# Cox model: response is Surv(time, status)
#Terms added sequentially (first to last)
# loglik Chisq Df Pr(>|Chi|)
# NULL -3.8712
# x -3.3277 1.0871 1 0.2971
The question about "getting them for each variable" does not make a lot of
sense
to me, since likelihood tests are model comparisons. You can only make such
statements about the consequences of adding or deleting a variable to/from an
existing model.
--David Winsemius, MD
West Hartford, CT
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.