Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2189
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Date | 2013-11-04 19:17 -0800 |
| References | <9d8f352e-5f07-45c2-8eee-1fa5c58eeba0@f33g2000yqh.googlegroups.com> |
| Message-ID | <4ff2af2e-2ad8-4f9a-b932-eaf636240bdb@googlegroups.com> (permalink) |
| Subject | Re: Calculate R-squared value from gnuplot 'fit' output? |
| From | benjamin.chen@aztopia.com |
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
Back to comp.graphics.apps.gnuplot | Previous | Next — Next in thread | Find similar
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
csiph-web