MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica calculates RSquared wrongly?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112760] Re: Mathematica calculates RSquared wrongly?
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 29 Sep 2010 04:15:56 -0400 (EDT)
  • References: <i7seru$pt5$1@smc.vnet.net>

On Sep 28, 3:09 am, Darren Glosemeyer <darr... at wolfram.com> wrote:
> On 9/27/2010 4:47 AM, Lawrence Teo wrote:
>> [...]
>> nlm = NonlinearModelFit[sbbBN, a*x^2 + b*x + c, {a, b, c}, x]
>> nlm["RSquared"]
>>
>> The RSquared by Mathematica is 0.963173
>> Meanwhile, Excel and manual hand calculation show that R^2 should
>> be equal to 0.7622.
>>
>> Is Mathematica wrong? Thanks!
>
> This is as designed. For nonlinear models, the corrected (i.e. with
> the mean subtracted out) sum of squares is sometimes used. This is
> consistent with comparing to a constant model, but most nonlinear
> models do not include a constant in an additive way. For this reason,
> NonlinearModelFit uses the uncorrected (i.e. without subtracting out
> the mean) sum of squares.

This information should be included in the "Goodness-of-Fit Measures"
section of the NonlinearModelFit documentation, which should also
point out that RSquared is computed as  1 - (Residual SS)/(Total SS),
and that in nonlinear models this is generally different from the
ratio (Model SS)/(Total SS) that is sometimes cited -- e.g.,
http://reference.wolfram.com/mathematica/RegressionCommon/ref/RSquared.html
-- as the definition of RSquared.


  • Prev by Date: Re: Interpolate in polar coordinates or cartesian
  • Next by Date: Re: Defining a function using common notation for absolute value (not Abs[x])
  • Previous by thread: Re: Mathematica calculates RSquared wrongly?
  • Next by thread: Re: Mathematica calculates RSquared wrongly?