Description : | This routine is written as a replacement for regress. It performs a full
multilinear weighted regression of one dependent variable on multiple
independant variable with an option to force y(x=0)=0. x is a matrix of
indepndent variables.
// Performs a multulinear least squares fit of the dependent variable y a
// (nx1) vector on a matrix x of independent variables (nxm)with each variable
// in the columns of x. If weights w are specified for each value of y a
// weighted fit is performed. By default the data is fitted with an intercept
// (m+1 fit parameters). An optional flag allows fitting with no intercept
// (m parameters).
//
// [a[,[resid][,[yp],[cov][,[rr][,[Syx][,[SSt][,[SSe][,[SSr]]]]]]]]]]
// =regress(y,x [,[w][,[flag]]])
//
// Input Variables
//
// y - dependent (real or complex)variable n x 1 vector
// x - independent (real or complex)variables n x m matrix with each
variable
// in the columns
// sy - standard deviation r(eal) of the dependent variable y nx1
vector-un weighted if
// not specified
// flag - boolean -- %t(default): fit with intercept (m +1 fitted
parameters)
// %f : fir with no intercept (m fitted parameters)
//
// Output variables
//
// a - fitted paramteers (real or complex - (m+1) x 1 vector or m x 1
vector if flag=%f)
// resid - residuals of the fitted parameters n x 1 vector
// yp - predicted values for the input data points
// cov - covariance matrix ((m+1) x (m+1) or m x m if flag=%f.) Errors in
fitted parameters
// are the diagonal elements
// rr - zero order correlation coefficients - (m+1) x (m+1) upper diagonal
matrix
// rr(1,1)= R coefficient of multiple correlation on y on columns of
x
// rr(1,k), k=2:m+1= correlation coefficient of y on x(:,k-1)
// rr(j,k), k=2:m+1,j=2:k contains the correlation coefficient of
x(:,j-1) on x(:,k-1)
//
// Syx - standard error of the estimate of y on x
// SSt - total Sum of squares
// SSe - explained Sum of squares
// SSr - residual Sum of squares
//
//regress() runs a demo
|