# What is the “\$R^2\$” value given in the summary of a coxph model in R

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!

## Answer

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”.

Attribution
Source : Link , Question Author : danielsbrewer , Answer Author : onestop