[R] Calculate Total CORRECTED SS for non linear regression

ProfJCNash profjcnash at gmail.com
Wed Sep 30 13:56:08 CEST 2015


Some workers consider it bad practise to compute what is called
R-squared for a nonlinear model. I find it useful for nonlinear models
as a signpost of how good a fit has been found. But just as signposts
can be turned around by vandals, nonlinear models can give a misleading
indication. With linear models, sum((y - model(y))^2) must be smaller
than sum((y - mean(y))^2). That is not necessary for nonlinear models.
Also for linear models there are many equivalent formulas due to the
many identities that go with the linear algebra. Those are not in force
for nonlinear models. So what in linear models is "R-squared" is just a
comparison to the model that is the mean of the predicted variable,
i.e., the best single number model.

JN

On 15-09-30 04:09 AM, peter dalgaard wrote:
> 
>> 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
>



More information about the R-help mailing list