# [R] Calculate Total CORRECTED SS for non linear regression

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Sep 30 15:51:20 CEST 2015

```Michael... this is an example of a thread that is quickly headed off-topic for R-help because there are lots of resources for learning "why" one formula might be better than another elsewhere and the use of the R language is not central to that discussion (and yet this topic has been discussed before on R-help). It is common to get friendly warnings that your proposed calculations might not do what you think they will around here, but you should supplement those warnings with reading elsewhere to keep the discussion here mostly on the topic of R.

In this case you ought to read up at [1], [2] and [3] at least, and in the future try to ask "how to calculate" questions by including references to the formulas or theory you are interested in. Terms like "adjusted" and "corrected" may not mean the same thing in all contexts, so knowing what YOU are referring to can avoid confusion.

[1]  https://en.m.wikipedia.org/wiki/Coefficient_of_determination
[2] stats.stackexchange.com
[3] http://www.R-project.org/posting-guide.html
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

On September 30, 2015 4:57:12 AM PDT, Michael Eisenring <michael.eisenring at gmx.ch> wrote:
>Hi Peter,
>I am still a bit confused- So that means that the calculation of the "
>R2"
>for my non-linear model is in fact the formula I used in my eample:
>
>CompoundSS <- sum((dta\$Compound - mean(dta\$Compound))^2)
>R2 <- deviance(dta.nls)/CompoundSS
>R2
>
>
>What's then the difference to the normally calculated R2 used for
>linear
>regression? To me it looks the same.
>
>
>
>-----Ursprüngliche Nachricht-----
>Von: peter dalgaard [mailto:pdalgd at gmail.com]
>Gesendet: Mittwoch, 30. September 2015 01:09
>An: Michael Eisenring <michael.eisenring at gmx.ch>
>Cc: r-help at r-project.org
>Betreff: Re: [R] Calculate Total CORRECTED SS for non linear regression
>
>
>> On 30 Sep 2015, at 02:08 , Michael Eisenring
><michael.eisenring at gmx.ch>
>wrote:
>>
>> Can anyone tell me how to calculate the Total Corrected SS in R and
>> how it can be implemented in my code?
>
>It is just sum((y-mean(y))^2).
>
>Beware that a fair amount of (somewhat silly) contention is going on in
>this
>area, though. In particular, the formula can give negative values,
>which is
>unfortunate if you try calling it "R^2".
>
>-pd
>
>--
>Peter Dalgaard, Professor,
>2000
>Frederiksberg, Denmark
>Phone: (+45)38153501
>Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help