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


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

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!d8g2000vbb.googlegroups.com!not-for-mail
From wolfgang <cmat.wolfgang@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Calculate R-squared value from gnuplot 'fit' output?
Date Thu, 29 Dec 2011 00:17:06 -0800 (PST)
Organization http://groups.google.com
Lines 68
Message-ID <f9c8ad34-7845-4b94-9138-c7d9a5efc6cf@d8g2000vbb.googlegroups.com> (permalink)
References <9d8f352e-5f07-45c2-8eee-1fa5c58eeba0@f33g2000yqh.googlegroups.com>
NNTP-Posting-Host 94.217.98.17
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1325146626 22458 127.0.0.1 (29 Dec 2011 08:17:06 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 29 Dec 2011 08:17:06 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info d8g2000vbb.googlegroups.com; posting-host=94.217.98.17; posting-account=m8tNrQkAAADq16p7gfJprtVZy2dgxxE-
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order ARLUEHNKC
X-HTTP-UserAgent Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.2; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:796

Show key headers only | View raw


On Dec 28, 3:14 pm, Mike <mesi...@gmail.com> wrote:
> 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!

Why does that take 3 iterations? That is just a linear LS problem?
Linear LS regression has an analytical solution, i.e. with normal
equations.
Solution should be either intelligent starting values or one iteration
from
dummy starting point?
Wolfgang

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next 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