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

From: KateR <rostohar_at_gmail.com>
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)?

Greetings, Kate

```--
View this message in context: http://r.789695.n4.nabble.com/compute-coefficient-of-determination-R-squared-for-GLM-maximum-likelihood-tp2261975p3495108.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help