miller/doc/data/linreg-example.txt
2015-05-04 22:38:58 -07:00

13 lines
508 B
Text

mlr filter '($x<.5 && $y<.5) || ($x>.5 && $y>.5)' data/medium > data/medium-squares
mlr --ofs newline stats2 -a linreg -f x,y data/medium-squares
x_y_m=0.764675
x_y_b=0.124841
# Set x_y_m and x_y_b as shell variables
eval $(mlr --ofs newline stats2 -a linreg -f x,y data/medium-squares)
# In addition to x and y, make a new yfit which is the line fit. Plot using your favorite tool.
mlr --onidx put '$yfit='$x_y_m'*$x+'$x_y_b then cut -x -f a,b,i data/medium-squares \
| pgr -p -title 'linreg example'