Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #794 > unrolled thread
| Started by | Mike <mesimms@gmail.com> |
|---|---|
| First post | 2011-12-28 12:14 -0800 |
| Last post | 2017-10-25 09:27 +0200 |
| Articles | 16 — 14 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
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
Re: Calculate R-squared value from gnuplot 'fit' output? benjamin.chen@aztopia.com - 2013-11-04 19:17 -0800
Re: Calculate R-squared value from gnuplot 'fit' output? Karl <mail.kfr@gmx.net> - 2013-11-05 14:14 +0100
Re: Calculate R-squared value from gnuplot 'fit' output? ooe@st-andrews.ac.uk - 2014-12-10 16:09 -0800
Re: Calculate R-squared value from gnuplot 'fit' output? ali.a.abedi@gmail.com - 2015-01-26 11:32 -0800
Re: Calculate R-squared value from gnuplot 'fit' output? thiagopaes@gmail.com - 2016-07-08 12:58 -0700
Re: Calculate R-squared value from gnuplot 'fit' output? luis.blacutt@gmail.com - 2016-07-15 08:29 -0700
Re: Calculate R-squared value from gnuplot 'fit' output? armin@armbrusters.name - 2017-02-21 12:40 -0800
Re: Calculate R-squared value from gnuplot 'fit' output? henryxparker@gmail.com - 2017-10-13 10:25 -0700
Re: Calculate R-squared value from gnuplot 'fit' output? Karl Ratzsch <mail.kfr@gmx.net> - 2017-10-13 19:53 +0200
Re: Calculate R-squared value from gnuplot 'fit' output? ruben safir <ruben@mrbrklyn.com> - 2017-10-24 17:35 -0400
Re: Calculate R-squared value from gnuplot 'fit' output? Karl Ratzsch <mail.kfr@gmx.net> - 2017-10-25 09:27 +0200
| From | Mike <mesimms@gmail.com> |
|---|---|
| Date | 2011-12-28 12:14 -0800 |
| Subject | Calculate R-squared value from gnuplot 'fit' output? |
| Message-ID | <9d8f352e-5f07-45c2-8eee-1fa5c58eeba0@f33g2000yqh.googlegroups.com> |
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!
[toc] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2011-12-28 22:11 +0100 |
| Message-ID | <9m1evfFqhnU1@mid.dfncis.de> |
| In reply to | #794 |
On 28.12.2011 21:14, Mike wrote: > Shouldn't I be able to calculate the R-squared value from this data? In a word: no. R^2 doesn't have any useful relation to what 'fit' calculates.
[toc] | [prev] | [next] | [standalone]
| From | wolfgang <cmat.wolfgang@gmail.com> |
|---|---|
| Date | 2011-12-29 00:17 -0800 |
| Message-ID | <f9c8ad34-7845-4b94-9138-c7d9a5efc6cf@d8g2000vbb.googlegroups.com> |
| In reply to | #794 |
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
[toc] | [prev] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2011-12-29 12:39 +0100 |
| Message-ID | <9m31s8FmgoU1@mid.dfncis.de> |
| In reply to | #796 |
On 29.12.2011 09:17, wolfgang wrote: > Why does that take 3 iterations? That is just a linear LS problem? Because 'fit' is not linear regression. Generic tools generally don't work as smoothly as special-purpose ones.
[toc] | [prev] | [next] | [standalone]
| From | ab <ab.3942@googlemail.com> |
|---|---|
| Date | 2012-01-02 00:37 -0800 |
| Message-ID | <5a11567f-08f0-406d-becf-73dcf79c02f3@t30g2000vbx.googlegroups.com> |
| In reply to | #796 |
> > 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 Hi, You can force the fit to converge in one iteration by using FIT_START_LAMBDA=1.e-15 FIT_MAXITER=1 This is only suited for a linear model. A better way is the stats command in gnuplot 4.5. The correlation coefficient r is calculated directly.
[toc] | [prev] | [next] | [standalone]
| From | benjamin.chen@aztopia.com |
|---|---|
| Date | 2013-11-04 19:17 -0800 |
| Message-ID | <4ff2af2e-2ad8-4f9a-b932-eaf636240bdb@googlegroups.com> |
| In reply to | #794 |
El miércoles, 28 de diciembre de 2011 15:14:18 UTC-5, Mike escribió: > 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! Try using this instead: stats 'file.dat' using 1:2 name "A" In should print out something like this: * FILE: Records: 21 Out of range: 0 Invalid: 0 Blank: 1 Data Blocks: 1 * COLUMNS: Mean: 500.0000 7.5762 Std Dev: 302.7650 3.9789 Sum: 10500.0000 159.1000 Sum Sq.: 7.17500e+06 1537.8300 Minimum: 0.0000 [ 0] 1.0000 [ 0] Maximum: 1000.0000 [20] 14.1000 [20] Quartile: 250.0000 4.5000 Median: 500.0000 7.2000 Quartile: 750.0000 11.1000 Linear Model: y = 0.01311 x + 1.019 Correlation: r = 0.9979 Sum xy: 1.048e+05
[toc] | [prev] | [next] | [standalone]
| From | Karl <mail.kfr@gmx.net> |
|---|---|
| Date | 2013-11-05 14:14 +0100 |
| Message-ID | <l5aqum$607$1@news.rz.uni-karlsruhe.de> |
| In reply to | #2189 |
Am 05.11.2013 04:17, schrieb benjamin.chen@aztopia.com: > El miércoles, 28 de diciembre de 2011 15:14:18 UTC-5, Mike escribió: It´s useless, most likely, to answer to a newspost question that is two years old. Bonus points for the effort, but your comment will probably be lost. K
[toc] | [prev] | [next] | [standalone]
| From | ooe@st-andrews.ac.uk |
|---|---|
| Date | 2014-12-10 16:09 -0800 |
| Message-ID | <fbe401ba-3142-47ab-b4ba-9a4df4edf212@googlegroups.com> |
| In reply to | #2190 |
On Tuesday, November 5, 2013 1:14:06 PM UTC, Karl wrote: > Am 05.11.2013 04:17, schrieb benjamin.chen@aztopia.com: > > El miércoles, 28 de diciembre de 2011 15:14:18 UTC-5, Mike escribió: > > > It´s useless, most likely, to answer to a newspost question that is two > years old. Bonus points for the effort, but your comment will probably > be lost. > > K It's not useless in this era, somebody may be looking for this help 5 years from now.
[toc] | [prev] | [next] | [standalone]
| From | ali.a.abedi@gmail.com |
|---|---|
| Date | 2015-01-26 11:32 -0800 |
| Message-ID | <2391b58d-1580-4f2b-a0e8-8f1e771dc6c3@googlegroups.com> |
| In reply to | #2666 |
On Wednesday, December 10, 2014 at 7:09:29 PM UTC-5, o...@st-andrews.ac.uk wrote: > On Tuesday, November 5, 2013 1:14:06 PM UTC, Karl wrote: > > Am 05.11.2013 04:17, schrieb benjamin.chen@aztopia.com: > > > El miércoles, 28 de diciembre de 2011 15:14:18 UTC-5, Mike escribió: > > > > > > It´s useless, most likely, to answer to a newspost question that is two > > years old. Bonus points for the effort, but your comment will probably > > be lost. > > > > K > > It's not useless in this era, somebody may be looking for this help 5 years from now. Yes I used it 2 years later. Google indexes all of this stuffs and it was a hit for my query.
[toc] | [prev] | [next] | [standalone]
| From | thiagopaes@gmail.com |
|---|---|
| Date | 2016-07-08 12:58 -0700 |
| Message-ID | <5bd7cb85-7456-42fc-a597-0055b199ae77@googlegroups.com> |
| In reply to | #2732 |
I used it NOW =)
[toc] | [prev] | [next] | [standalone]
| From | luis.blacutt@gmail.com |
|---|---|
| Date | 2016-07-15 08:29 -0700 |
| Message-ID | <d5ba61df-bf64-4654-b846-e15c0452df24@googlegroups.com> |
| In reply to | #3368 |
On Friday, July 8, 2016 at 4:58:20 PM UTC-3, thiag...@gmail.com wrote: > I used it NOW =) Not exactly five years, but it certainly answered my question
[toc] | [prev] | [next] | [standalone]
| From | armin@armbrusters.name |
|---|---|
| Date | 2017-02-21 12:40 -0800 |
| Message-ID | <0c73b9e0-a3e0-4b00-97ff-2b69fcebd7f3@googlegroups.com> |
| In reply to | #3371 |
On Friday, July 15, 2016 at 11:29:22 AM UTC-4, luis.b...@gmail.com wrote: > On Friday, July 8, 2016 at 4:58:20 PM UTC-3, thiag...@gmail.com wrote: > > I used it NOW =) > > Not exactly five years, but it certainly answered my question More than 5 years by now and it's still helpful!
[toc] | [prev] | [next] | [standalone]
| From | henryxparker@gmail.com |
|---|---|
| Date | 2017-10-13 10:25 -0700 |
| Message-ID | <718ca519-99a3-4c1b-a940-1de5f7adeeda@googlegroups.com> |
| In reply to | #794 |
Still relevant!
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-10-13 19:53 +0200 |
| Message-ID | <orquiu$rnl$1@solani.org> |
| In reply to | #3770 |
Am 13.10.2017 um 19:25 schrieb henryxparker@gmail.com: > Still relevant! > This is a newsgroup. 1. Be polite, and sign your message, and 2. cite the original post, because most people don't read this on googles stolen archive pages, but in their newsreader, and delete old messages after a few months. Karl
[toc] | [prev] | [next] | [standalone]
| From | ruben safir <ruben@mrbrklyn.com> |
|---|---|
| Date | 2017-10-24 17:35 -0400 |
| Message-ID | <osobmc$bhm$1@reader2.panix.com> |
| In reply to | #3771 |
On 10/13/2017 01:53 PM, Karl Ratzsch wrote: > Am 13.10.2017 um 19:25 schrieb henryxparker@gmail.com: >> Still relevant! >> > This is a newsgroup. > First of all, your an idiot. > 1. Be polite, and sign your message, and Be polite and stop trying to control others behavior. Don't post messages like this. If you have nothing constructive to say, say nothing. > 2. cite the original post, If nobody knows what he refers to, that is his problem. If you want to ask him wtf he is refering to, just ask. > because most people don't read this on > googles stolen archive pages, That archive, which actually originated with Dejanews before you grew out of diapers, is in no way stolen and is blessing for the public. > but in their newsreader, and delete > old messages after a few months. > And if not, you your eyes they are second class humans unfit to stand with German Supermen like yourself? Go find some therapy, smoke some grass, or get layed, Do anything more than troll innocent usenet posters.
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2017-10-25 09:27 +0200 |
| Message-ID | <ospec2$aup$1@solani.org> |
| In reply to | #3797 |
Am 24.10.2017 um 23:35 schrieb ruben safir: > messages like this. If you have nothing constructive to say, say nothing. Word.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web