Pseudo R Square Values in R

R does not give a Pseudo R square value and neither does Mplus. As such, here is a real quick R function to calculate McFadden’s and Adjusted McFadden’s Pseudo R square value:


#Pesudo R square
#x = full model
#y = null model
#k = number of parameters
PRsq<- function (x, y, k ) {
a= 1- (x/y)
b= 1- ((x-k)/y)
cat ("Pesudo R Square Estimates", "\n")
cat ("McFadden's:          ", a, "\n")
cat ("adjusted McFadden's: ", b, "\n")


About Philip Parker

I am a post doc in developmental and educational psychology at a Germany university. I did my PhD at the university of Sydney in stress and well-being. Most days I am hunched over a computer yelling at statistical software or responding to journal editors who seem to always want twice the amount of content but with half the words. For fun I like to read up on the latest developments in R and programming various functions.
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Pseudo R Square Values in R

  1. plattypus1 says:

    Thanks for this! I modified your function a bit to take a model as an argument, although I couldn’t find an easily-accessible property on model objects for k. Still, it’ll output the McFadden’s pseudo-R^2 given a model for an argument.

    PRsq<- function (x) {
    a= 1- (x$deviance/x$null.deviance)
    cat ("Pesudo R Square Estimates", "\n")
    cat ("McFadden's: ", a, "\n")

  2. Dylan Glynn says:

    The package pscl and the command pR2 work wonders on a range of things, have a look

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s