9
$\begingroup$

In a coxph model with 2 variables (let's say age and sex), how can I get the p-values for LR, Wald and score tests which I see in the summary(coxphobject) as below?

Concordance= 0.653  (se = 0.058 )
Rsquare= 0.085   (max possible= 0.924 )
Likelihood ratio test= 30.09  on 12 df,   p=0.002708
Wald test            = 34.73  on 12 df,   p=0.0005169
Score (logrank) test = 34  on 12 df,   p=0.0006736,   Robust = 17.61  p=0.1279

I think those values represented in the summary as p=... for each model are the p-values for the full model, but I cannot figure out how to retrieve them. If there is only one variate, let's say age, then I can retrieve the p-value using summary(coxphobject)$coefficients[5], which is the same as the one I see for the Wald test in the summary(coxphobject). But when there are two variables (age and sex), summary(coxphobject)$coefficients[1,5] and summary(coxphobject)$coefficients[2,5] give the p-values for age and sex separately, but they both are different from the p-values I see for the full model in the summary(coxphobject) for LR, Wald and score tests.

I appreciate any help. Thanks.

$\endgroup$

1 Answer 1

6
$\begingroup$

1) Put summary(coxphobject) into a variable

summcph <- summary(coxphobject)

2) examine it with str()

str(summcph)

Values! Values everywhere!

so we find, (proceeding line by line in your above output):

a) the Concordance values

summcph$concordance

b) the Rsquare values

summcph$rsq

c) The Likelihood ratio test values

summcph$logtest

d) The Wald test values

summcph$waldtest 

e) The score test values

summcph$sctest

f) The robust values

summcph$robscore

It really helps if you post a reproducible example, rather than make us go find your data set in order to check we're doing all the options the same. For example, you didn't mention you had a cluster term. (It would take an extra few moments for you, and would have saved me ten minutes while I tried to figure out why I couldn't get the last couple of values. At the least you could have mentioned which example you ran in the help!)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.