R2 {PHeval} | R Documentation |
R2 coefficient
Description
This function calcultates the R^2
coefficient of OQuigley and Flandre (1994) to evaluate the predictive capacity of the proportional hazards model (or Cox model).
Usage
R2(formula, data)
Arguments
formula |
A formula object or character string with the time and censoring status separated by "+" on the left hand side and the covariates separated by "+" on the right. For instance, if the time name is "Time", the censoring status is "Status" and the covariates are called "Cov1" and "Cov2", the formula is "Time+Status~Cov1+Cov2". |
data |
A data.frame with the data. The censoring status should be 1 for failure and 0 for censoring. No missing data accepted. |
Details
The program does not handle ties in the data. We suggest to randomly split the ties before using the program.
Value
If one covariate Z is present in the model, the
R^2
coefficient isR^2=1-\frac{\sum(Zi-E_b(Zi))^2}{\sum(Zi-E_0(Zi))^2},
where the sums are over the failures.
E_b(Zi)
is the expectation ofZ
at the ith failure time under the model of parameterb
= the maximum partial likelihood estimator of the regression coefficient.E_0(Zi)
is the expectation ofZ
under the model of parameter 0 at the ith failure time.If several covariates are present in the model, the
R^2
coefficient is evaluated as in the previous case except that the covariate Z is replaced by the prognostic indexb'Z
.
Author(s)
Cecile Chauvel
References
OQuigley, J. (2008) Proportional hazards regression. Springer New-York. Chapter 12.
OQuigley J, Flandre P. (1994) Predictive capability of proportional hazards regression. PNAS 91, 2310-2314.
Examples
library(survival)
data(ovarian)
R2(futime+fustat~age,data=ovarian)
R2(futime+fustat~age+rx,data=ovarian)