I've done a NonLinearRegression with this data

{{0.245, 0.0917011}, {0.25, 0.0894304}, {0.25, 0.108895}, 
 {0.25, 0.111991}, {0.251, 0.0898849}, {0.251, 0.107753},
 {0.254, 0.114524}, {0.254, 0.121882}, {0.255, 0.130478},
 {0.255, 0.186865}, {0.256, 0.108817}, {0.256, 0.128742},
 {0.256, 0.131999}, {0.257, 0.150797}}

The model is a simply parabola:

y=a x^2+b x +c

The coefficiets are:

 a= 317.459
 c= 18.9415

Then I've done the same with Excel and the coefficients are the same, but R^2 is not the same. In Mathematica I've got R^2=0.97 and Excel tells me R^2=0.45. Why there is this incoherence?

  • 3
    $\begingroup$ Maybe this will be useful. $\endgroup$ Aug 14 '13 at 8:54
  • $\begingroup$ Plus, correct me if I am wrong, but you will get different values of R depending on the data - whether it is a sample or the whole population. $\endgroup$
    – Sektor
    Aug 14 '13 at 8:58
  • 1
    $\begingroup$ We had an earlier question on this, but I can't find it anymore. I believe the answer was that in a non linear model fit rsquared has a different meaning and that LinearModelFit should be used in this case. $\endgroup$ Aug 14 '13 at 14:34
  • $\begingroup$ @b.gatessucks Your link does not work for me. Perhaps it depends on being logged in into google groups? $\endgroup$ Aug 14 '13 at 14:36
  • $\begingroup$ @b.gatessucks Your link is very useful. Thanks a lot $\endgroup$
    – Mary
    Aug 14 '13 at 15:38

lm=LinearModelFit[data,{1,x,x^2},x] yields the same coefficient estimates and the R^2 for this model coincides with Excel, i.e. Excel uses linear regression model



  • $\begingroup$ thanks I agree with your comment. In fact I've done a linear regression no a non Linear model. $\endgroup$
    – Mary
    Aug 14 '13 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.