# [R] coefficient of determination on a nls regression

apjaworski@mmm.com apjaworski at mmm.com
Wed May 1 20:52:07 CEST 2002

```Antonio,

For linear regression we have the following identity

total SS = regression SS + residual SS        (*)

where total SS is the sum of squares of observations around their mean,
i.e.

total SS = (n-1)*var(y)

and residual SS is given by the deviance function.

R-squared is defined as

R^2 = regression SS/ total SS = 1 - residual SS/total SS.

You can use this last formula to define a similar quantity for nonlinear
regression.  You have to remember that R^2 does not have its usual meaning
for NLS.  In fact, the basic identity (*) does not hold and the residuals
do not add up to zero.

Hope this helps,

Andy

__________________________________
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-----
E-mail: apjaworski at mmm.com
Tel:  (651) 733-6092
Fax:  (651) 736-3122

"Antonio
Olinto"              To:     "R-help" <r-help at stat.math.ethz.ch>
<aolinto at bignet      cc:     (bcc: Andrzej P. Jaworski/US-Corporate/3M/US)
.com.br>             Subject:     [R] coefficient of determination on a nls regression

05/01/2002
12:21

Hello R-users,

How can I caculate the coefficient of determination (r-squared, r2) from a
nls regression model?

r2 = regression SS / total SS

The regression SS is given by deviance(model), isn't it? And what about
total SSQ?

Thanks,

Antonio Olinto
São Paulo Fisheries Institute
Brasil
www.institutopesca.sp.gov.br

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```