On Jan 6, 2011, at 11:23 AM, Sören Vogel wrote:

Thanks for your replies. I am no mathematician or statistician by far,
however, it appears to me that the actual value of any of the two LLs
is indeed important when it comes to calculation of
Pseudo-R-Squared-s. If Rnagel devides by (some transformation of) the
actiual value of llnull then any calculation of Rnagel should differ.
How come? Or is my function wrong? And if my function is right, how
can I calculate a R-Squared independent from the software used?

You have two models in that function, the null one with ".~ 1" and the origianl one and you are getting a ratio on the likelihood scale ( which is a difference on the log-likelihood or deviance scale).


Rfits <- function(mod) {
 llnull <- deviance(update(mod, . ~ 1, trace=F))
 llmod <- deviance(mod)
 n <- length(predict(mod))
 Rcs <- 1 - exp( (llmod - llnull) / n )
 Rnagel <- Rcs / (1 - exp(-llnull/n))
 out <- list(
   "Rcs"=Rcs,
   "Rnagel"=Rnagel
 )
 class(out) <- c("list", "table")
 return(out)
}


--
David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to