Re: [R] Nagelkerkes R2N

2009-07-15 Thread North, Bernard V


I am interested Andrea is whether you ever established why your R2 was 1.
I have had a similar situation previously.

My main issue though, which I'd be v grateful for advice on, is why I am 
obtaining such  negative values -0.3  for Somers Dxy  using validate.cph from 
the Design package given my value of Nagelkerke R2 is not so low 13.2%.

I have this output when fitting 6 variables all with p-values0.01
I am wondering what the interpretation should be.
I know my Nagelkerke R2 isn't very good but I compare my results with the 
example from ?validate.cph and although I have a better R2 (13% v 9%) the 
Somers dxy from the example data set is much better, 38%, so certainly not 
negative !

 So my main question is : Why such a difference between explained variation, 
R2, and predictive ability: somers dxy ??

Obs Events Model L.R.   d.f.  P  ScoreScore P R2
   471228  66.36  6  0  73.41  0
  0.132



  validate(f, B=150,dxy=T)   # normally B=150

 index.orig  training test optimism index.corrected   n
Dxy   -0.3022537331 -0.3135032097 -0.292492573 -0.021010636   -0.2812430968 150
R2 0.1319445685  0.1431179294  0.122599605  0.0205183240.1114262446 150
Slope  1.00  1.00  0.923340558  0.0766594420.9233405576 150
D  0.0250864459  0.0276820092  0.023163167  0.0045188420.0205676038 150
U -0.0007676033 -0.0007725071  0.000610456 -0.0013829630.0006153598 150
Q  0.0258540493  0.0284545164  0.022552711  0.0059018050.0199522440 150


I also calculated the Schemper and Henderson V measure and obtained v=10.5%

I was  using the surev package of Lusa Lara; Miceli Rosalba; Mariani 
LuigiEstimation of predictive accuracy in survival analysis using R and 
S-PLUS.http://www.biomedexperts.com/Abstract.bme/17601627/Estimation_of_predictive_accuracy_in_survival_analysis_using_R_and_S-PLUS
Computer methods and programs in biomedicine 2007;87(2):132-7.
And my code was
library(surev)
pred.accuracy-f.surev(f)
pred.accuracy

sorry if my question isn't clear - should I have included my sessionInfo for a 
methodological question ? (I'm a newbie)
many thanks for any advice

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Nagelkerkes R2N

2009-05-13 Thread Andrea Weidacher
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.000  1.000  1.000
Slope  1.000  1.000  1.0055508323397084336
D  0.0232804472888947744  0.0226998668193014774  0.0232190381679612834
U -0.607553318187988 -0.610134584621832  0.254159617147094
Q  0.0233412026207135703  0.0227608802777636665  0.0231936222062465713
optimism index.corrected  n
Dxy0.0043136739010409269 -0.36823596603785002657 10
R2 0.000  1. 10
Slope -0.0055508323397084336  1.00555083233970843359 10
D -0.0005191713486598047  0.02379961863755457596 10
U -0.864294201768926  0.2567408835809379 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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Nagelkerkes R2N

2009-05-13 Thread Frank E Harrell Jr
A new version of Design will be posted to CRAN in the next 2 days. 
After than, update your system, including an update to the survival 
package.  Then re-try.


Your formula is wrong as it can't be negative.  LR should be the 
likelihood ratio chi-square stat : -2 times the difference in the two 
loglik values.


Frank

Andrea Weidacher wrote:

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.000  1.000  1.000
Slope  1.000  1.000  1.0055508323397084336
D  0.0232804472888947744  0.0226998668193014774  0.0232190381679612834
U -0.607553318187988 -0.610134584621832  0.254159617147094
Q  0.0233412026207135703  0.0227608802777636665  0.0231936222062465713
optimism index.corrected  n
Dxy0.0043136739010409269 -0.36823596603785002657 10
R2 0.000  1. 10
Slope -0.0055508323397084336  1.00555083233970843359 10
D -0.0005191713486598047  0.02379961863755457596 10
U -0.864294201768926  0.2567408835809379 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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.