Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #794

Calculate R-squared value from gnuplot 'fit' output?

From Mike <mesimms@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Calculate R-squared value from gnuplot 'fit' output?
Date 2011-12-28 12:14 -0800
Organization http://groups.google.com
Message-ID <9d8f352e-5f07-45c2-8eee-1fa5c58eeba0@f33g2000yqh.googlegroups.com> (permalink)

Show all headers | View raw


OK, my statistics is perhaps not what it should be. I have a script
make a linear fit of some x-y pairs:

#
# Correlations
#
set xdata
set format x
set term png size 400, 400
f(x) = m*x + b
set output "./corr-00.png"
fit f(x) "2011-10.dat" using 2:3 via m,b
plot "2011-10.dat" using 2:3 t "C1 vs C2" with dots, f(x) title "Model
Fit"

And I get the following output, just showing the end here:

 Iteration 0
 WSSR        : 9404.93           delta(WSSR)/WSSR   : 0
 delta(WSSR) : 0                 limit for stopping : 1e-05
 lambda	  : 7.53716

After 3 iterations the fit converged.
final sum of squares of residuals : 1980.57
rel. change during last iteration : -5.27226e-11

degrees of freedom    (FIT_NDF)                        : 4462
rms of residuals      (FIT_STDFIT) = sqrt(WSSR/ndf)    : 0.66624
variance of residuals (reduced-chisquare) = WSSR/ndf   : 0.443875

Final set of parameters            Asymptotic Standard Error
=======================            ==========================

m               = 0.889071         +/- 0.002949     (0.3317%)
b               = 0.881951         +/- 0.03129      (3.548%)


correlation matrix of the fit parameters:

               m      b
m               1.000
b              -0.948  1.000

Shouldn't I be able to calculate the R-squared value from this data? I
read in wikipedia that

R^2 1 - (SS_err / SS_tot)

and that WSSR is SS_err, as far as I can make out. Can anyone help me
with SS_tot or another way to do it?

Thanks!

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

Calculate R-squared value from gnuplot 'fit' output? Mike <mesimms@gmail.com> - 2011-12-28 12:14 -0800
  Re: Calculate R-squared value from gnuplot 'fit' output? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-12-28 22:11 +0100
  Re: Calculate R-squared value from gnuplot 'fit' output? wolfgang <cmat.wolfgang@gmail.com> - 2011-12-29 00:17 -0800
    Re: Calculate R-squared value from gnuplot 'fit' output? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-12-29 12:39 +0100
    Re: Calculate R-squared value from gnuplot 'fit' output? ab <ab.3942@googlemail.com> - 2012-01-02 00:37 -0800

csiph-web