Learn R Programming

CoxR2 (version 1.0)

coxr2: R-Squared under the Cox model

Description

Calculate the R-squared, aka explained randomness, based on the partial likelihood ratio statistic under the Cox model.

Usage

##object is the result of a 'coxph'
coxr2(object)

Arguments

object

The result of a coxph fit

Value

nevent

number of uncensored events

logtest

partial likelihood ratio test statistics

rsq

explained randomness

Details

Calculate the R-squared based on the partial likelihood ratio statistic under the Cox model. Difference in log partial likelihoods between the fitted model and the null model with no regressors is divided by the number of uncensored events, while the existing summary function divides it by the number of total observations.

References

John O'Quigley, Ronghui Xu and Janez Stare, (2005), Explained randomness in proportional hazards models, STATISTICS IN MEDICINE, 24:479-489.

See Also

coxph, summary.coxph

Examples

Run this code
# NOT RUN {
# Create the simplest test data set
test <- list(time=c(4,3,1,1,2,2,3),
             event =c(1,1,1,0,1,1,0),
             x =c(5,2,1,1,1,5,5))

# Fit a Cox model
coxmodel <- coxph(Surv(time, event ) ~ x , test)

coxr2(coxmodel)
# }

Run the code above in your browser using DataLab