Biau David
2010-Jul-30 15:08 UTC
[R] COXPH: how to get the score test and likelihood ratio test for a specific variable in a multivariate Coxph ?
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? David Biau. [[alternative HTML version deleted]]
David Winsemius
2010-Jul-30 15:34 UTC
[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