Function Reference
— Function File: [beta, sigma, r] = ols (y, x)

Ordinary least squares estimation for the multivariate model where

Each row of y and x is an observation and each column a variable.

The return values beta, sigma, and r are defined as follows.

beta
The OLS estimator for b, beta = pinv (x) * y, where pinv (x) denotes the pseudoinverse of x.
sigma
The OLS estimator for the matrix s,
               sigma = (y-x*beta)'
                 * (y-x*beta)
                 / (t-rank(x))

r
The matrix of OLS residuals, r = y - x * beta.