contrib
|
bigler.zip,
box.zip,
boxgray.zip,
byrne.zip,
denholm.txt,
fig3_1.zip,
fromshell.zip,
gif.zip,
gnucon.zip,
gp2sipp.zip,
gpcontrb.html,
gplotlib.zip,
henke.zip,
hg_cummn.zip,
histogram.zip,
linreg.awk,
lvs.zip,
mac32.zip,
mac35.zip,
mfscale.zip,
missing.zip,
mkifo.zip,
multi_awk.zip,
multi_sed.zip,
multi_woo.zip,
newarrow.zip,
os9.zip,
piechart.zip,
pipelib.zip,
point_skip.zip,
popen.zip,
real_time.zip,
replotf.zip,
rotate.zip,
stardent.zip,
timeseries.zip,
userguide.zip,
vector.zip,
windows.zip,
xgpl.zip,
xlib_mods.zip,
|
|
|
From Anchor.!headwall.Stanford.EDU!agate!usenet.hana.nm.kr!scoupe.postech.ac.kr!wgchoe Wed Mar 16 08:14:10 PST 1994
Article: 2301 of comp.graphics.gnuplot
Path: Anchor.!headwall.Stanford.EDU!agate!usenet.hana.nm.kr!scoupe.postech.ac.kr!wgchoe
From: wgchoe@scoupe.postech.ac.kr ( Kim Hee Jeong(prof-swan))
Newsgroups: comp.graphics.gnuplot
Subject: Linear Regression : use awk.
Date: 16 Mar 1994 14:26:23 GMT
Organization: HANAnet Operating Centre(KTRC)
Lines: 37
Message-ID: <2m74ug$1gs@usenet.hana.nm.kr>
NNTP-Posting-Host: scoupe.postech.ac.kr
X-Newsreader: TIN [version 1.2 PL2]
Gnuplot does not support linear regression, and I recommend you to use
the pipe input and the unix utility awk. Suppose you have two column x,y data.
====== Your data file ========
1 1.2
2 2.1
3 3.2
4 4.1
5 5.3
6 6.4
7 7.7
====== End ===================
And here is the awk script, named as "lsq" (least square fit), which prints
out the x values and the least square fit.
====== The Awk script , named "lsq" as ========
{ x[NR] = $1; y[NR] = $2;\
sx += x[NR]; sy += y[NR]; \
sxx += x[NR]*x[NR];\
sxy += x[NR]*y[NR];\
}END{\
det = NR*sxx - sx*sx;\
a = (NR*sxy - sx*sy)/det;\
b = (-sx*sxy+sxx*sy)/det;\
for(i=1;i<=NR;i++) print x[i],a*x[i]+b;}
===============================================
To see the result,
gnuplot> plot 'data' w po, ' log($1), $2 -> log($2), and the
last line , a*x[i]+b -> exp( b + a*x[i] ).
|