Displaying 1 result from an estimated 1 matches for "rcsnagel".
2010 Dec 27
0
Nagelkerke R square for Prediction data
...function to output the Nagelkerke's R, and the Cox-&-Snell R from a fitted model. I am no professional programmer by far, yet, I hope, that the code is okay and that it may be of some use to others -- or subject to useful improvement. Please let me know, if you find errors.
Regards,
S?ren
Rcsnagel <- function(mod) {
llnull <- mod$null.deviance
llmod <- mod$deviance
n <- length(mod$fitted.values)
Rcs <- 1 - exp( (mod$deviance - mod$null.deviance) / n )
Rnagel <- Rcs / (1 - exp(-llnull/n))
out <- list('Rcs'=Rcs, 'Rnagel'=Rnagel)
class(out) <...