20
$\begingroup$

What is the $R^2$ value given in the summary of a coxph model in R? For example,

Rsquare= 0.186   (max possible= 0.991 )

I foolishly included it a manuscript as an $R^2$ value and the reviewer jumped on it saying he wasn't aware of an analogue of the $R^2$ statistic from the classic linear regression being developed for the Cox model and if there was one please provide a reference. Any help would be great!

$\endgroup$
2
  • 1
    $\begingroup$ In most situations where the concept of $R^2$ is extended beyond classical linear regression, it is the squared correlation between the observed values and those predicted under the model. Could that possibly be applicable here? $\endgroup$
    – Macro
    Jun 19, 2012 at 12:54
  • 2
    $\begingroup$ No it is not related to that. $\endgroup$ Jul 17, 2013 at 22:39

2 Answers 2

16
$\begingroup$

Using getS3method("summary","coxph") you can look at how it is calculated.

The relevant code lines are the following:

logtest <- -2 * (cox$loglik[1] - cox$loglik[2])
rval$rsq <- c(rsq = 1 - exp(-logtest/cox$n), maxrsq = 1 - 
        exp(2 * cox$loglik[1]/cox$n))

Here cox$loglik is "a vector of length 2 containing the log-likelihood with the initial values and with the final values of the coefficients" (see ?coxph.object) and cox$n is "number of observations used in the fit".

$\endgroup$
2
4
$\begingroup$

Dividing by $n$ the number of observations in the summary of coxph is wrong, it should be the number of uncensored events; see O'Quigley et al. (2005) Explained randomness in proportional hazards models Statistics in Medicine p. 479-489.

$\endgroup$
9
  • 4
    $\begingroup$ Incorrect, you divide by the number of observations, no matter how strange that sounds. To the original question, it is strange that a reviewer would not be aware of something that's been around for 20 years for the Cox model. $\endgroup$ Jul 17, 2013 at 22:40
  • $\begingroup$ Adding to the exchange between Ronghui Xu and @Frank Harrell, not only does it ``sound strange'' dividing by the number of observations, it does not work. To see this, consider beta fixed at some value so that, roughly, E(R2)=0.5, and the same covariate distribution, i.e., everything the same, apart from the fact that Study 1 has twice the rate of censoring as Study 2. Although we should be estimating the same population quantity, the R2 estimates in Study 1 will be roughly half those of Study 2, regardless of sample size. Instead of 0.5 we would be getting around 0.25. $\endgroup$
    – user28171
    Jul 18, 2013 at 7:47
  • $\begingroup$ John it would be worth providing a little R simulation to show that. The null log likelihood also changes, doesn't it? - possibly compensating for the effect you described. Whether generalized $R^2$ us deficient in some ways or not it is highly used and there is some theory to support its strange setup. $\endgroup$ Jul 18, 2013 at 18:10
  • 1
    $\begingroup$ John would you and Ronghui tell us which measure you currently recommend? I am seeking a fraction of explained randomness that is very independent of the censoring distribution, is a strong analogy of $R^2$ in linear models, and that has a ready counterpart for logistic regression. I finally read your excellent 2005 paper - nice work. $\endgroup$ Jul 20, 2013 at 15:38
  • 1
    $\begingroup$ Haven't looked at that. But I'm becoming more inclined towards the Kent & O'Quigley style of index as discussed here. $\endgroup$ Nov 6, 2020 at 12:58

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.