Darwin Help

Back to Index

LinearRegression

Function LinearRegression - Compute a linear regression

Calling Sequence  LinearRegerssion(y,x1,...)
Parameters
NameTypeDescription

y array(numeric)dependent variable
x1 array(numeric)independent variable(s)
Return Type  array(numeric)
Globals SumSq,
Synopsis Computes a linear regression y = a0 + a1*x1 + a2*x2 + ... by least squares. The number of arguments is variable, it should be at least 2. LinearRegression returns the vector [a0,a1,a2,...]. The global variable SumSq is set to the sum of squares of errors in the regression.
Examples
> LinearRegression( [2.1,3.01,3.9,4.89], [0,1,2,3] );
[2.0860, 0.9260]
> SumSq;
0.00232000
See also ExpFit,   ExpFit2,   Stat,   SvdAnalysis