[R] Nagelkerkes R2N
Andrea Weidacher
andrea_weidacher at gmx.de
Wed May 13 14:44:59 CEST 2009
Hello All,
as I´m new to R and survival analysis, I´ve got a question about the
Design::validate function:
My Code:
cox <- cph(Surv(t,status) ~ var1 + var2 + var3, data=data, x=TRUE, y=TRUE,
surv=TRUE)
cox.val <- validate(cox, B=10, dxy=TRUE, pr=TRUE);
My output (cox.val):
index.orig training test
Dxy -0.3639222921368090891 -0.3591157308750822175 -0.3634294047761231106
R2 1.0000000000000000000 1.0000000000000000000 1.0000000000000000000
Slope 1.0000000000000000000 1.0000000000000000000 1.0055508323397084336
D 0.0232804472888947744 0.0226998668193014774 0.0232190381679612834
U -0.0000607553318187988 -0.0000610134584621832 0.0000254159617147094
Q 0.0233412026207135703 0.0227608802777636665 0.0231936222062465713
optimism index.corrected n
Dxy 0.0043136739010409269 -0.36823596603785002657 10
R2 0.0000000000000000000 1.00000000000000000000 10
Slope -0.0055508323397084336 1.00555083233970843359 10
D -0.0005191713486598047 0.02379961863755457596 10
U -0.0000864294201768926 0.00002567408835809379 10
Q -0.0004327419284829055 0.02377394454919647515 10
And my question ist about the R2: Why ist the value always 1.0. That doesn´t
seem to me like a realistic value.
And so I tried to calculate R2 with my own formula:
LR <- -2*cox$loglik[2]
L0 <- -2*cox$loglik[1]
n <- length(data[,"ID"])
R2N <- (1-exp(-LR/n)) / (1-exp(L0/n))
R2N calculated that way is -0.00132314024559236.
Can anybody help me to understand the formula to R2 and why the
validate-function results in 1.0?
Thanks,
Andrea.
More information about the R-help
mailing list