llsq


Usage

llsq filename x-col y-col [-i]

where filename is the name of the file with the data, x-col is the number (1 indexed) of the whitespace-delimited column to use for X data, y-col is the number (1 indexed) of the Y data column.

The optional argument -i causes the y-intercept to be printed, along with the slope.

Overview

llsq performs a Linear Least-Squares fit of a set of (x,y) data to the equation y=mx+b. The routine computes m and b given a set of (x,y) pairs. The pairs are taken from whitespace-delimited columns in a data file that is specified on the command line. There is no provision for reading from stdin.

llsq prints the slope on the first line, and optionally, the y-intercept on the second line. Both numbers are printed as simple floating point numbers.

No attempt at error propogation is made. Algorithm taken from Fowler, The Solid Earth.


Copyright © 2000, Paul Gettings