| Applying science to business management |
  
linefit
Format: linefit( [x1,x2,...],
y, zero )
Arguments: [real] [x1,x2] Lists of
independent values
[real] y List of dependent values
(bool) zero Optional zero y-intercept;
default = no
Returns: [real] List of regression coefficients b,
m1, m2, ..., mn
Description: Linefit performs a least-squares
regression analysis to find the coefficients, b, m1,
m2, ..., mn that cause a line of the form
to best fit the series of data points specified. Each data
point is defined by all corresponding elements in the lists x1,
x2, ..., and y. For example, the first elements in
each of these lists together define one point. If the argument zero
is true (any non-zero value), the constant b is
forced to zero.
Examples: Fit a line of the form y(x)=b+m*x to
the data points:
(1,7), (3,15), (4,14), (7,20), and (8,30).
x:=[1,3,4,7,8]
y:=[7,15,14,20,30]
linefit(x,y) = [4.398,2.783]
The result [4.40,2.78] means that y(x) = 4.398 +
2.783*x
See Also: stderror,
rsquared, solve
|