[R] pseudo-R by hand

From: Sacha Viquerat <tweedie-d_at_web.de>
Date: Mon, 11 Apr 2011 11:49:14 +0200


hello dear list! since we want to do a model analysis and some people would like to see pseudo-R^2 values for different types of glm of a logistic regression, i've decided to write a function that computes either nagelkerkes normed pseudo-R or cox & snells pseudo-R. however, i am not clear as in the decisive step, i need to calculate the log of (maximum likelihood estimates of model divided by mle of null model). i am well aware of the functions stats::mle and stats::logLik as well as of Design::lrm. however, I'm not sure wheter mle helps me at all and I am uncertain about the logLik call I have implemented:

#cox&snell

lambda<- -2*log((logLik(null.model)[1]/logLik(model)[1])) out<-1-exp(-lambda/n)

#nagelkerke

lambda<- -2*log( logLik(model)[1]/logLik(null.model)[1] ) lambda2<- -2*log( logLik(model)[1] )
out<-(1-exp(-lambda/n))/(1-exp(-lambda2/n))

can anyone help me out?



R-help_at_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. Received on Mon 11 Apr 2011 - 09:52:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Apr 2011 - 11:40:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive