LINEAR_REGRESSION - Compute linear regression of (y1,y2,...,yn) against (x1,x2,...,xn) Function Prototype: void linear_regression(float *y, float *x, int n, float coeff[4]); Input: y array of y values x array of x values n length of y and x arrays Output: coeff[4] where: coeff[0] slope of best fit line coeff[1] intercept of best fit line coeff[2] correlation coefficient of fit (1 = perfect) [dimensionless] coeff[3] standard error of fit (0 = perfect) [dimensions of y] Notes: y(x) | * . fit is y(x) = a x + b | . | . * | * . | . * ------------------- x n Sum[x*y] - Sum[x]*Sum[y] a = -------------------------- n Sum[x*x] - Sum[x]*Sum[x] Sum[y] - a*Sum[x] b = ----------------- n cc = std definition se = std definition Author: Chris Liner, UTulsa, 11/16/03