Re: [R] compute coefficient of determination (R-squared) for GLM (maximum likelihood)

From: KateR <>
Date: Wed, 04 May 2011 03:46:52 -0700 (PDT)

Dear mr Joris Meys

I would like to know, where to find this formulas in books or articles.
# possibility 1

R2 <- cor(y,predict(mod))^2

# possibility 2

R2 <- 1 - ( sum( (y-predict(mod))^2 ) / sum( (y-mean(y))^2 ) )

The first calculation seems OK, it gives the logicala values in models (from 0 to 1),
but the second gives the negative values; higher corelation between the y and prediction gives more neagtive R2 value (up to -85).

And my second question, looks logical but I need more teoretical answer; why R^2 (r-square) values are not appropriate for use with non-linear regression models (like exponential)?

Thank you for your answers.  

Greetings, Kate

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 05 May 2011 - 06:25:03 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 Thu 05 May 2011 - 07:00:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive