Ordinary Least Squares
A method for choosing the unknown parameters in a linear regression model.
In statistics, ordinary least squares (OLS) is a type of linear least squares method for choosing the unknown parameters in a linear regression model by the principle of least squares: minimizing the sum of the squares of the differences between the observed dependent variable and the output of the (linear) function of the independent variable.
In a linear regression model, the response variable is a linear function of the regressors:
where and are vectors of the response variables and the errors of the observations, and is an matrix of regressors, also sometimes called the design matrix, whose row is and contains the -th observations on all the explanatory variables.
The goal is to find the coefficients which fit the equations "best", in the sense of solving the quadratic minimization problem , where the objective function is given by
This minimization problem has a unique solution, provided that the columns of the matrix are linearly independent, given by:
The fitted values from the regression will be
where is the projection matrix onto the space spanned by the columns of . The annihilator matrix is a projection matrix onto the space orthogonal to .
Both matrices and are symmetric and idempotent (meaning that and ), and relate to the data matrix via identities and . Matrix creates the residuals from the regression: