### 2.13 Function LinearRegression

-*- texinfo -*-

Function File: [p,e_var,r,p_var,y_var] = LinearRegression (F,y)
Function File: [p,e_var,r,p_var,y_var] = LinearRegression (F,y,w)

  general linear regression

  determine the parameters p_j (j=1,2,...,m) such that the function f(x) = sum_(i=1,...,m) p_j*f_j(x) is the best fit to the given values y_i = f(x_i)

  parameters:

  - F is an n*m matrix with the values of the basis functions at the support points. In column j give the values of f_j at the points x_i (i=1,2,...,n)
  - y is a column vector of length n with the given values
  - w is n column vector of of length n vector with the weights of data points

  return values:

  - p is the vector of length m with the estimated values of the parameters
  - e_var is the estimated variance of the difference between fitted and measured values
  - r is the weighted norm of the residual
  - p_var is the estimated variance of the parameters p_j
  - y_var is the estimated variance of the dependend variables

  Caution: do NOT request y_var for large data sets, as a n by n matrix is generated

See also (octave)regress, leasqr, nonlin_curvefit, (octave)polyfit, wpolyfit, expfit.