Linear Least Squares and Linear Regression
The method of least squares is a standard approach in regression analysis to approximate the solution of overdetermined systems (sets of equations in which there are more equations than unknowns) by minimizing the sum of the squares of the residuals (a residual being the difference between an observed value and the fitted value provided by a model) made in the results of each individual equation.
The most important application is in data fitting. When the problem has substantial uncertainties in the independent variable (the [math]X[/math] variable), then simple regression and least-squares methods have problems; in such cases, the methodology required for fitting errors-in-variables models may be considered instead of that for least squares.
Least-squares problems fall into two categories: linear or ordinary least squares and nonlinear least squares, depending on whether or not the residuals are linear in all unknowns. The linear least-squares problem occurs in statistical regression analysis; it has a closed-form solution. The nonlinear problem is usually solved by iterative refinement; at each iteration the system is approximated by a linear one, and thus the core calculation is similar in both cases.
The following discussion is mostly presented in terms of linear functions but the use of least squares is valid and practical for more general families of functions. Also, by iteratively applying local quadratic approximation to the likelihood (through the Fisher information), the least-squares method may be used to fit a generalized linear model.
The least-squares method was officially discovered and published by Adrien-Marie Legendre (1805),[1] though it is usually also co-credited to Carl Friedrich Gauss (1795)[2][3] who contributed significant theoretical advances to the method and may have previously used it in his work.[4][5]
Problem statement
The objective consists of adjusting the parameters of a model function to best fit a data set. A simple data set consists of [math]n[/math] points (data pairs) [math](x_i,y_i)\![/math], [math]i=1,\ldots,n[/math], where [math]x_i[/math] is an independent variable and [math]y_i[/math] is a dependent variable whose value is found by observation. The model function has the form [math]f(x, \boldsymbol \beta)[/math], where [math]m[/math] adjustable parameters are held in the vector [math]\boldsymbol \beta[/math]. The goal is to find the parameter values for the model that "best" fits the data. The fit of a model to a data point is measured by its residual, defined as the difference between the observed value of the dependent variable and the value predicted by the model:
The least-squares method finds the optimal parameter values by minimizing the sum of squared residuals, [math]S[/math]:[6]
An example of a model in two dimensions is that of the straight line. Denoting the y-intercept as [math]\beta_0[/math] and the slope as [math]\beta_1[/math], the model function is given by [math]f(x,\boldsymbol \beta)=\beta_0+\beta_1 x[/math]. See linear least squares for a fully worked out example of this model.
A data point may consist of more than one independent variable. For example, when fitting a plane to a set of height measurements, the plane is a function of two independent variables,[math]X[/math] and z, say. In the most general case there may be one or more independent variables and one or more dependent variables at each data point.
To the right is a residual plot illustrating random fluctuations about [math]r_i=0[/math], indicating that a linear model[math](Y_i = \alpha + \beta x_i + U_i)[/math] is appropriate. [math]U_i[/math] is an independent, random variable.[6]
If the residual points had some sort of a shape and were not randomly fluctuating, a linear model would not be appropriate. For example, if the residual plot had a parabolic shape as seen to the right, a parabolic model[math](Y_i = \alpha + \beta x_i + \gamma x_i^2 + U_i)[/math] would be appropriate for the data. The residuals for a parabolic model can be calculated via [math]r_i=y_i-\hat{\alpha}-\hat{\beta} x_i-\widehat{\gamma} x_i^2[/math].[6]
Limitations
This regression formulation considers only observational errors in the dependent variable (but the alternative total least squares regression can account for errors in both variables). There are two rather different contexts with different implications:
- Regression for prediction. Here a model is fitted to provide a prediction rule for application in a similar situation to which the data used for fitting apply. Here the dependent variables corresponding to such future application would be subject to the same types of observation error as those in the data used for fitting. It is therefore logically consistent to use the least-squares prediction rule for such data.
- Regression for fitting a "true relationship". In standard regression analysis that leads to fitting by least squares there is an implicit assumption that errors in the independent variable are zero or strictly controlled so as to be negligible. When errors in the independent variable are non-negligible, models of measurement error can be used; such methods can lead to parameter estimates, hypothesis testing and confidence intervals that take into account the presence of observation errors in the independent variables.[7] An alternative approach is to fit a model by total least squares; this can be viewed as taking a pragmatic approach to balancing the effects of the different sources of error in formulating an objective function for use in model-fitting.
Linear Least Squares
Linear least squares (LLS) is the least squares approximation of linear functions to data. It is a set of formulations for solving statistical problems involved in linear regression, including variants for ordinary (unweighted), weighted, and generalized (correlated) residuals.
Main formulations
The three main linear least squares formulations are:
Formulation | Description |
---|---|
Ordinary least squares (OLS) | Is the most common estimator. OLS estimates are commonly used to analyze both experimental and observational data. The OLS method minimizes the sum of squared residuals, and leads to a closed-form expression for the estimated value of the unknown parameter vector [math]\beta[/math]:
[[math]]
\hat{\boldsymbol\beta} = (\mathbf{X}^\mathsf{T}\mathbf{X})^{-1} \mathbf{X}^\mathsf{T} \mathbf{y},
[[/math]] where [math]\mathbf{y}[/math] is a vector whose [math]i[/math]th element is the [math]i[/math]th observation of the dependent variable, and [math]\mathbf{X}[/math] is a matrix whose [math]ij[/math] element is the [math]i[/math]th observation of the [math]j[/math]th independent variable. The estimator is unbiased and consistent if the errors have finite variance and are uncorrelated with the regressors:[8] [[math]]
\operatorname{E}[\,\mathbf{x}_i\varepsilon_i\,] = 0,
[[/math]] where [math]\mathbf{x}_i[/math] is the transpose of row [math]i[/math] of the matrix [math]\mathbf{X}.[/math] It is also efficient under the assumption that the errors have finite variance and are homoscedastic, meaning that [math]\operatorname{E}[\varepsilon_i^2|x_i][/math] does not depend on [math]i[/math]. The condition that the errors are uncorrelated with the regressors will generally be satisfied in an experiment, but in the case of observational data, it is difficult to exclude the possibility of an omitted covariate [math]z[/math] that is related to both the observed covariates and the response variable. The existence of such a covariate will generally lead to a correlation between the regressors and the response variable, and hence to an inconsistent estimator of [math]\beta[/math]. The condition of homoscedasticity can fail with either experimental or observational data. If the goal is either inference or predictive modeling, the performance of OLS estimates can be poor if multicollinearity is present, unless the sample size is large.
|
Weighted least squares (WLS) | Used when heteroscedasticity is present in the error terms of the model. |
Generalized least squares (GLS) | Is an extension of the OLS method, that allows efficient estimation of [math]\beta[/math] when either heteroscedasticity, or correlations, or both are present among the error terms of the model, as long as the form of heteroscedasticity and correlation is known independently of the data. To handle heteroscedasticity when the error terms are uncorrelated with each other, GLS minimizes a weighted analogue to the sum of squared residuals from OLS regression, where the weight for the [math]i[/math]th case is inversely proportional to [math]\operatorname{Var}(\varepsilon_i)[/math]. This special case of GLS is called "weighted least squares". The GLS solution to an estimation problem is [[math]]
\hat{\boldsymbol\beta} = (\mathbf{X}^\mathsf{T} \boldsymbol\Omega^{-1} \mathbf{X})^{-1}\mathbf{X}^\mathsf{T}\boldsymbol\Omega^{-1}\mathbf{y},
[[/math]] where [math]\Omega[/math] is the covariance matrix of the errors. GLS can be viewed as applying a linear transformation to the data so that the assumptions of OLS are met for the transformed data. For GLS to be applied, the covariance structure of the errors must be known up to a multiplicative constant.
|
Properties
If the experimental errors, [math]\varepsilon[/math], are uncorrelated, have a mean of zero and a constant variance, [math]\sigma[/math], the Gauss–Markov theorem states that the least-squares estimator, [math]\hat{\boldsymbol{\beta}}[/math], has the minimum variance of all estimators that are linear combinations of the observations. In this sense it is the best, or optimal, estimator of the parameters. Note particularly that this property is independent of the statistical distribution function of the errors. In other words, the distribution function of the errors need not be a normal distribution. However, for some probability distributions, there is no guarantee that the least-squares solution is even possible given the observations; still, in such cases it is the best estimator that is both linear and unbiased.
For example, it is easy to show that the arithmetic mean of a set of measurements of a quantity is the least-squares estimator of the value of that quantity. If the conditions of the Gauss–Markov theorem apply, the arithmetic mean is optimal, whatever the distribution of errors of the measurements might be.
However, in the case that the experimental errors do belong to a normal distribution, the least-squares estimator is also a maximum likelihood estimator.[9]
These properties underpin the use of the method of least squares for all types of data fitting, even when the assumptions are not strictly valid.
Limitations
An assumption underlying the treatment given above is that the independent variable,[math]X[/math], is free of error. In practice, the errors on the measurements of the independent variable are usually much smaller than the errors on the dependent variable and can therefore be ignored. When this is not the case, total least squares or more generally errors-in-variables models, or rigorous least squares, should be used. This can be done by adjusting the weighting scheme to take into account errors on both the dependent and independent variables and then following the standard procedure.[10][11]
In some cases the (weighted) normal equations matrix [math]X^{\mathsf{T}}X[/math] is ill-conditioned. When fitting polynomials the normal equations matrix is a Vandermonde matrix. Vandermonde matrices become increasingly ill-conditioned as the order of the matrix increases. In these cases, the least squares estimate amplifies the measurement noise and may be grossly inaccurate. Various regularization techniques can be applied in such cases, the most common of which is called ridge regression. If further information about the parameters is known, for example, a range of possible values of [math]\mathbf{\hat{\boldsymbol{\beta}}}[/math], then various techniques can be used to increase the stability of the solution. For example, see constrained least squares.
Another drawback of the least squares estimator is the fact that the norm of the residuals, [math]\| \mathbf y - X\hat{\boldsymbol{\beta}} \|[/math] is minimized, whereas in some cases one is truly interested in obtaining small error in the parameter [math]\mathbf{\hat{\boldsymbol{\beta}}}[/math], e.g., a small value of [math]\|{\boldsymbol{\beta}}-\hat{\boldsymbol{\beta}}\|[/math]. However, since the true parameter [math]{\boldsymbol{\beta}}[/math] is necessarily unknown, this quantity cannot be directly minimized. If a prior probability on [math]\hat{\boldsymbol{\beta}}[/math] is known, then a Bayes estimator can be used to minimize the mean squared error, [math]E \left\{ \| {\boldsymbol{\beta}} - \hat{\boldsymbol{\beta}} \|^2 \right\} [/math]. The least squares method is often applied when no prior is known. Surprisingly, when several parameters are being estimated jointly, better estimators can be constructed, an effect known as Stein's phenomenon. For example, if the measurement error is Gaussian, several estimators are known which dominate, or outperform, the least squares technique; the best known of these is the James–Stein estimator. This is an example of more general shrinkage estimators that have been applied to regression problems.
Ordinary Least Squares (OLS)
In statistics, ordinary least squares (OLS) is a type of linear least squares method for estimating the unknown parameters in a linear regression model. OLS chooses the parameters of a linear function of a set of explanatory variables by the principle of least squares: minimizing the sum of the squares of the differences between the observed dependent variable (values of the variable being observed) in the given dataset and those predicted by the linear function of the independent variable.
Geometrically, this is seen as the sum of the squared distances, parallel to the axis of the dependent variable, between each data point in the set and the corresponding point on the regression surface—the smaller the differences, the better the model fits the data. The resulting estimator can be expressed by a simple formula, especially in the case of a simple linear regression, in which there is a single regressor on the right side of the regression equation.
The OLS estimator is consistent when the regressors are exogenous, and—by the Gauss–Markov theorem—optimal in the class of linear unbiased estimators when the errors are homoscedastic and serially uncorrelated. Under these conditions, the method of OLS provides minimum-variance mean-unbiased estimation when the errors have finite variances. Under the additional assumption that the errors are normally distributed, OLS is the maximum likelihood estimator.
Linear model
Suppose the data consists of [math]n[/math] observations [math]\left\{\mathbf{x}_i, y_i\right\}_{i=1}^n[/math]. Each observation [math]i[/math] includes a scalar response [math]y_i[/math] and a column vector [math]\mathbf{x}_i[/math] of [math]p[/math] parameters (regressors), i.e., [math]\mathbf{x}_i=\left[x_{i1}, x_{i2}, \dots, x_{ip}\right]^\mathsf{T}[/math]. In a linear regression model, the response variable, [math]y_i[/math], is a linear function of the regressors:
or in vector form,
where [math]\mathbf{x}_i[/math], as introduced previously, is a column vector of the [math]i[/math]-th observation of all the explanatory variables; [math]\boldsymbol{\beta}[/math] is a [math]p \times 1[/math] vector of unknown parameters; and the scalar [math]\varepsilon_i[/math] represents unobserved random variables (errors) of the [math]i[/math]-th observation. [math]\varepsilon_i[/math] accounts for the influences upon the responses [math]y_i[/math] from sources other than the explanators [math]\mathbf{x}_i[/math]. This model can also be written in matrix notation as
where [math]\mathbf{y}[/math] and [math]\boldsymbol{\varepsilon}[/math] are [math]n \times 1[/math] vectors of the response variables and the errors of the [math] n [/math] observations, and [math]\mathrm{X}[/math] is an [math]n \times p[/math] matrix of regressors, also sometimes called the design matrix, whose row [math]i[/math] is [math]\mathbf{x}_i^\mathsf{T}[/math] and contains the [math]i[/math]-th observations on all the explanatory variables.
As a rule, the constant term is always included in the set of regressors [math]\mathrm{X}[/math], say, by taking [math]x_{i1}=1[/math] for all [math]i=1, \dots, n[/math]. The coefficient [math]\beta_1[/math] corresponding to this regressor is called the intercept.
Regressors do not have to be independent: there can be any desired relationship between the regressors (so long as it is not a linear relationship). For instance, we might suspect the response depends linearly both on a value and its square; in which case we would include one regressor whose value is just the square of another regressor. In that case, the model would be quadratic in the second regressor, but none-the-less is still considered a linear model because the model is still linear in the parameters ([math]\boldsymbol{\beta}[/math]).
Matrix/vector formulation
Consider an overdetermined system
of [math] n [/math] linear equations in [math]p[/math] unknown coefficients, [math] \beta_1, \beta_2, \dots, \beta_p [/math], with [math] n \gt p [/math]. (Note: for a linear model as above, not all elements in [math] \mathrm{X} [/math] contains information on the data points. The first column is populated with ones, [math]X_{i1} = 1[/math]. Only the other columns contain actual data. So here [math]p[/math] is equal to the number of regressors plus one.) This can be written in matrix form as
where
Such a system usually has no exact solution, so the goal is instead to find the coefficients [math]\boldsymbol{\beta}[/math] which fit the equations "best", in the sense of solving the quadratic minimization problem
where the objective function [math] S [/math] is given by
A justification for choosing this criterion is given in Properties below. This minimization problem has a unique solution, provided that the [math]p[/math] columns of the matrix [math] \mathrm{X} [/math] are linearly independent, given by solving the so-called normal equations:
The matrix [math]\mathrm{X}^{\mathsf T} \mathrm X[/math] is known as the normal matrix or Gram matrix and the matrix [math]\mathrm{X}^{\mathsf T} \mathbf y[/math] is known as the moment matrix of regressand by regressors.[12] Finally, [math]\hat{\boldsymbol{\beta}}[/math] is the coefficient vector of the least-squares hyperplane, expressed as
or
Estimation
Suppose [math]b[/math] is a "candidate" value for the parameter vector [math]\beta[/math]. The quantity [math]y_i-x_i^{\mathsf{T}}b[/math], called the residual for the [math]i[/math]-th observation, measures the vertical distance between the data point [math](x_i,y_i)[/math] and the hyperplane [math]y=X^{\mathsf{T}}b[/math], and thus assesses the degree of fit between the actual data and the model. The sum of squared residuals (SSR) (also called the error sum of squares (ESS) or residual sum of squares (RSS))[13] is a measure of the overall model fit:
where [math]\mathsf{T}[/math] denotes the matrix transpose, and the rows of[math]X[/math], denoting the values of all the independent variables associated with a particular value of the dependent variable, are Xi = xiT. The value of b which minimizes this sum is called the OLS estimator for [math]\beta[/math]. The function [math]S(b)[/math] is quadratic in [math]b[/math] with positive-definite Hessian, and therefore this function possesses a unique global minimum at [math]b =\hat\beta[/math], which can be given by the explicit formula:[14]
The product [math]N=X^{\mathsf{T}}X[/math] is a Gram matrix and its inverse, [math]Q=N^{-1}[/math], is the cofactor matrix of [math]\beta[/math],[15][16][17] closely related to its covariance matrix, [math]C_{\beta}[/math]. The matrix
is called the Moore–Penrose pseudoinverse matrix of [math]X[/math]. This formulation highlights the point that estimation can be carried out if, and only if, there is no perfect multicollinearity between the explanatory variables (which would cause the gram matrix to have no inverse).
After we have estimated [math]\beta[/math], the fitted values (or predicted values) from the regression will be
where
is the projection matrix onto the space [math]V[/math] spanned by the columns of[math]X[/math]. This matrix [math]P[/math] is also sometimes called the hat matrix because it "puts a hat" onto the variable [math]y[/math]. Another matrix, closely related to [math]P[/math] is the annihilator matrix [math]M=I_n-P[/math]; this is a projection matrix onto the space orthogonal to [math]V[/math]. Both matrices [math]P[/math] and [math]M[/math] are symmetric and idempotent (meaning that [math]P^2 = P[/math] and [math]M^2=M[/math]), and relate to the data matrix [math]X[/math] via identities [math]PX=X[/math] and [math]MX=0[/math].[18] Matrix [math]M[/math] creates the residuals from the regression:
Using these residuals we can estimate the value of [math]\sigma^2[/math] using the reduced chi-squared statistic:
The denominator, [math]n-p[/math], is the statistical degrees of freedom. The first quantity, [math]s^2[/math], is the OLS estimate for [math]\sigma^2[/math], whereas the second, [math]\scriptstyle\hat\sigma^2[/math], is the MLE estimate for [math]\sigma^2[/math]. The two estimators are quite similar in large samples; the first estimator is always unbiased, while the second estimator is biased but has a smaller mean squared error. In practice [math]s^2[/math] is used more often, since it is more convenient for the hypothesis testing. The square root of [math]s^2[/math] is called the regression standard error,[19] standard error of the regression,[20][21] or standard error of the equation.[18]
It is common to assess the goodness-of-fit of the OLS regression by comparing how much the initial variation in the sample can be reduced by regressing onto[math]X[/math]. The coefficient of determination [math]R^2[/math] is defined as a ratio of "explained" variance to the "total" variance of the dependent variable [math]y[/math], in the cases where the regression sum of squares equals the sum of squares of residuals:[22]
where TSS is the total sum of squares for the dependent variable, [math]L=I_n-\frac{1}{n}J_n[/math], and [math]J_n[/math] is an [math]n\times n[/math] matrix of ones. ([math]L[/math] is a centering matrix which is equivalent to regression on a constant; it simply subtracts the mean from a variable.) In order for [math]R^2[/math] to be meaningful, the matrix [math]X[/math] of data on regressors must contain a column vector of ones to represent the constant whose coefficient is the regression intercept. In that case, [math]R^2[/math] will always be a number between 0 and 1, with values close to 1 indicating a good degree of fit.
The variance in the prediction of the independent variable as a function of the dependent variable is given in the article Polynomial least squares.
Simple linear regression model
If the data matrix[math]X[/math] contains only two variables, a constant and a scalar regressor [math]x_i[/math], then this is called the "simple regression model".[23] This case is often considered in the beginner statistics classes, as it provides much simpler formulas even suitable for manual calculation. The parameters are commonly denoted as [math](\alpha,\beta)[/math]:
The least squares estimates in this case are given by simple formulas
Alternative derivations
In the previous section the least squares estimator [math]\hat\beta[/math] was obtained as a value that minimizes the sum of squared residuals of the model. However it is also possible to derive the same estimator from other approaches. In all cases the formula for OLS estimator remains the same:
; the only difference is in how we interpret this result.
Projection
For mathematicians, OLS is an approximate solution to an overdetermined system of linear equations [math]X\beta = y[/math], where [math]\beta[/math] is the unknown. Assuming the system cannot be solved exactly (the number of equations [math]n[/math] is much larger than the number of unknowns [math]p[/math]), we are looking for a solution that could provide the smallest discrepancy between the right- and left- hand sides. In other words, we are looking for the solution that satisfies
where [math]||\cdot||[/math] is the standard L2 norm in the [math]n[/math]-dimensional Euclidean space [math]\mathbb{R}^n[/math]. The predicted quantity [math]X\beta[/math] is just a certain linear combination of the vectors of regressors. Thus, the residual vector [math]y-X\beta[/math] will have the smallest length when[math]y[/math]is projected orthogonally onto the linear subspace spanned by the columns of[math]X[/math]. The OLS estimator [math]\hat\beta[/math] in this case can be interpreted as the coefficients of vector decomposition of [math]\hat{y}=Py[/math] along the basis of[math]X[/math].
In other words, the gradient equations at the minimum can be written as:
A geometrical interpretation of these equations is that the vector of residuals, [math]\mathbf y - X \hat{\boldsymbol{\beta}}[/math] is orthogonal to the column space of[math]X[/math], since the dot product [math](\mathbf y-X\hat{\boldsymbol{\beta}})\cdot X \mathbf v[/math] is equal to zero for any conformal vector, [math]\mathbf{v}[/math]. This means that [math]\mathbf y - X \boldsymbol{\hat \beta}[/math] is the shortest of all possible vectors [math]\mathbf{y}- X \boldsymbol \beta[/math], that is, the variance of the residuals is the minimum possible. This is illustrated at the right.
Introducing [math]\hat{\boldsymbol{\gamma}}[/math] and a matrix [math]K[/math] with the assumption that a matrix [math][X \ K][/math] is non-singular and [math]K^{\mathsf{T}}X=0[/math] (cf. Orthogonal projections), the residual vector should satisfy the following equation:
The equation and solution of linear least squares are thus described as follows:
Another way of looking at it is to consider the regression line to be a weighted average of the lines passing through the combination of any two points in the dataset.[24] Although this way of calculation is more computationally expensive, it provides a better intuition on OLS.
Maximum likelihood
The OLS estimator is identical to the maximum likelihood estimator (MLE) under the normality assumption for the error terms.[25] From the properties of MLE, we can infer that the OLS estimator is asymptotically efficient (in the sense of attaining the Cramér–Rao bound for variance) if the normality assumption is satisfied.[26]
Properties
Assumptions
There are several different frameworks in which the linear regression model can be cast in order to make the OLS technique applicable. Each of these settings produces the same formulas and same results. The only difference is the interpretation and the assumptions which have to be imposed in order for the method to give meaningful results. The choice of the applicable framework depends mostly on the nature of data in hand, and on the inference task which has to be performed.
One of the lines of difference in interpretation is whether to treat the regressors as random variables, or as predefined constants. In the first case (random design) the regressors [math]x_i[/math] are random and sampled together with the [math]y_i[/math]'s from some population, as in an observational study. This approach allows for more natural study of the asymptotic properties of the estimators. In the other interpretation (fixed design), the regressors[math]X[/math] are treated as known constants set by a design, and[math]y[/math]is sampled conditionally on the values of[math]X[/math] as in an experiment. For practical purposes, this distinction is often unimportant, since estimation and inference is carried out while conditioning on[math]X[/math]. All results stated in this article are within the random design framework.
Classical linear regression model
The classical model focuses on the "finite sample" estimation and inference, meaning that the number of observations n is fixed. This contrasts with the other approaches, which study the asymptotic behavior of OLS, and in which the number of observations is allowed to grow to infinity.
Condition | Description |
---|---|
Correct specification | The linear functional form must coincide with the form of the actual data-generating process. |
Strict exogeneity | The errors in the regression should have conditional mean zero:[27][math] \operatorname{E}[\,\varepsilon\mid X\,] = 0. [/math]The immediate consequence of the exogeneity assumption is that the errors have mean zero: [math]\operatorname{E}[\epsilon] = 0 [/math], and that the regressors are uncorrelated with the errors: [math]\operatorname{E}[X^{\mathsf{T}}\epsilon] = 0[/math]. |
Linear Independence | The regressors in[math]X[/math] must all be linearly independent. Mathematically, this means that the matrix [math]X[/math] must have full column rank almost surely:[28] [[math]]
\Pr\!\big[\,\operatorname{rank}(X) = p\,\big] = 1.
[[/math]] Usually, it is also assumed that the regressors have finite moments up to at least the second moment. Then the matrix [math]Q_{xx}=\operatorname{E}[X^{\mathsf{T}}X]/n[/math] is finite and positive semi-definite. When this assumption is violated the regressors are called linearly dependent or perfectly multicollinear. In such case the value of the regression coefficient [math]\beta[/math] cannot be learned, although prediction of [math]y[/math] values is still possible for new values of the regressors that lie in the same linearly dependent subspace.
|
Spherical Errors[28] | [[math]]
\operatorname{Var}[\,\varepsilon \mid X\,] = \sigma^2 I_n,
[[/math]]
|
Normality | It is sometimes additionally assumed that the errors have normal distribution conditional on the regressors:[29]
[[math]]
\varepsilon \mid X\sim \mathcal{N}(0, \sigma^2I_n).
[[/math]] This assumption is not needed for the validity of the OLS method, although certain additional finite-sample properties can be established in case when it does (especially in the area of hypotheses testing). Also when the errors are normal, the OLS estimator is equivalent to the maximum likelihood estimator (MLE), and therefore it is asymptotically efficient in the class of all regular estimators. Importantly, the normality assumption applies only to the error terms; contrary to a popular misconception, the response (dependent) variable is not required to be normally distributed.[30]
|
Independent and identically distributed (iid)
In some applications an additional assumption is imposed — that all observations are independent and identically distributed. This means that all observations are taken from a random sample which makes all the assumptions listed earlier simpler and easier to interpret. The list of assumptions in this case is:
Assumption | Description |
---|---|
iid obesrvations | [math](x_i,y_i)[/math] is independent from, and has the same distribution as, [math](x_j,y_j)[/math] for all [math]i\neq j[/math]. |
no perfect multicollinearity | [math]Q_{xx}=\operatorname{E}[x_ix_i^{\mathsf{T}}][/math] is a positive-definite matrix |
Exogeneity | [math]\operatorname{E}[\varepsilon_ix_i]=0[/math] |
homoscedasticity | [math]\operatorname{Var}[\varepsilon_ix_i] = \sigma^2[/math] |
Finite sample properties
First of all, under the strict exogeneity assumption the OLS estimators [math]\scriptstyle\hat\beta[/math] and [math]s^2[/math] are unbiased, meaning that their expected values coincide with the true values of the parameters:[31]
If the strict exogeneity does not hold (as is the case with many time series models, where exogeneity is assumed only with respect to the past shocks but not the future ones), then these estimators will be biased in finite samples.
The variance-covariance matrix (or simply covariance matrix) of [math]\scriptstyle\hat\beta[/math] is equal to[32]
In particular, the standard error of each coefficient [math]\scriptstyle\hat\beta_j[/math] is equal to square root of the [math]j[/math]-th diagonal element of this matrix. The estimate of this standard error is obtained by replacing the unknown quantity σ2 with its estimate [math]s^2[/math]. Thus,
It can also be easily shown that the estimator [math]\scriptstyle\hat\beta[/math] is uncorrelated with the residuals from the model:[32]
The Gauss–Markov theorem states that under the spherical errors assumption (that is, the errors should be uncorrelated and homoscedastic) the estimator [math]\scriptstyle\hat\beta[/math] is efficient in the class of linear unbiased estimators. This is called the best linear unbiased estimator (BLUE). Efficiency should be understood as if we were to find some other estimator [math]\scriptstyle\tilde\beta[/math] which would be linear in[math]y[/math]and unbiased, then [32]
in the sense that this is a nonnegative-definite matrix. This theorem establishes optimality only in the class of linear unbiased estimators, which is quite restrictive. Depending on the distribution of the error terms ε, other, non-linear estimators may provide better results than OLS.
Assuming normality
The properties listed so far are all valid regardless of the underlying distribution of the error terms. However, if you are willing to assume that the normality assumption holds (that is, that [math]\epsilon \sim N(0,\sigma^2I_n)[/math], then additional properties of the OLS estimators can be stated.
The estimator [math]\scriptstyle\hat\beta[/math] is normally distributed, with mean and variance as given before:[33]
where [math]Q[/math] is the cofactor matrix. This estimator reaches the Cramér–Rao bound for the model, and thus is optimal in the class of all unbiased estimators.[26] Note that unlike the Gauss–Markov theorem, this result establishes optimality among both linear and non-linear estimators, but only in the case of normally distributed error terms.
The estimator [math]s^2[/math] will be proportional to the chi-squared distribution:[34]
The variance of this estimator is equal to [math]2\sigma^4/(n-p)[/math], which does not attain the Cramér–Rao bound of [math]2\sigma^4/n[/math]. However it was shown that there are no unbiased estimators of [math]\sigma^2[/math] with variance smaller than that of the estimator [math]s^2[/math].[35] If we are willing to allow biased estimators, and consider the class of estimators that are proportional to the sum of squared residuals (SSR) of the model, then the best (in the sense of the mean squared error) estimator in this class will be [math]\sim \sigma^2/(n-p+2)[/math], which even beats the Cramér–Rao bound in case when there is only one regressor ([math]p=1[/math]).[36]
Moreover, the estimators [math]\hat{\beta}[/math] and [math]s^2[/math] are independent,[37] the fact which comes in useful when constructing the t- and F-tests for the regression.
Large sample properties
The least squares estimators are point estimates of the linear regression model parameters [math]\beta[/math]. However, generally we also want to know how close those estimates might be to the true values of parameters. In other words, we want to construct the interval estimates.
Since we haven't made any assumption about the distribution of error term [math]\epsilon_i[/math], it is impossible to infer the distribution of the estimators [math]\hat\beta[/math] and [math]\hat\sigma^2[/math]. Nevertheless, we can apply the central limit theorem to derive their asymptotic properties as sample size [math]n[/math] goes to infinity. While the sample size is necessarily finite, it is customary to assume that [math]n[/math] is "large enough" so that the true distribution of the OLS estimator is close to its asymptotic limit.
We can show that under the model assumptions, the least squares estimator for [math]\beta[/math] is consistent (that is [math]\hat\beta[/math] converges in probability to [math]\beta[/math]) and asymptotically normal:
where [math]Q_{xx} = X ^T X.[/math]
Intervals
Using this asymptotic distribution, approximate two-sided confidence intervals for the [math]j[/math]-th component of the vector [math]\hat{\beta}[/math] can be constructed as
at the [math]1-\alpha[/math] confidence level, where [math]Q[/math] denotes the quantile function of standard normal distribution, and [·]jj is the [math]j[/math]-th diagonal element of a matrix.
Similarly, the least squares estimator for [math]\sigma^2[/math] is also consistent and asymptotically normal (provided that the fourth moment of [math]\epsilon_i[/math] exists) with limiting distribution
These asymptotic distributions can be used for prediction, testing hypotheses, constructing other estimators, etc.. As an example consider the problem of prediction. Suppose [math]x_0[/math] is some point within the domain of distribution of the regressors, and one wants to know what the response variable would have been at that point. The mean response is the quantity [math]y_0 = x_0^\mathrm{T} \beta[/math], whereas the predicted response is [math]\hat{y}_0 = x_0^\mathrm{T} \hat\beta[/math]. Clearly the predicted response is a random variable, its distribution can be derived from that of [math]\hat{\beta}[/math]:
which allows construct confidence intervals for mean response [math]y_0[/math] to be constructed:
at the [math]1-\alpha[/math] confidence level.
References
- Mansfield Merriman, "A List of Writings Relating to the Method of Least Squares"
- Bretscher, Otto (1995). Linear Algebra With Applications (3rd ed.). Upper Saddle River, NJ: Prentice Hall.
- Stigler, Stephen M. (1981). "Gauss and the Invention of Least Squares". Ann. Stat. 9 (3): 465–474. doi: .
- Britannica, "Least squares method"
- Studies in the History of Probability and Statistics. XXIX: The Discovery of the Method of Least Squares R. L. Plackett
- 6.0 6.1 6.2 A modern introduction to probability and statistics : understanding why and how. Dekking, Michel, 1946-. London: Springer. 2005. ISBN 978-1-85233-896-1. OCLC 262680588.CS1 maint: others (link)
- For a good introduction to error-in-variables, please see Fuller, W. A. (1987). Measurement Error Models. John Wiley & Sons. ISBN 978-0-471-86187-4.
- "Strong consistency of least squares estimates in multiple regression" (1978). PNAS 75 (7): 3034–3036. doi: . PMID 16592540. Bibcode: 1978PNAS...75.3034L.
- Margenau, Henry; Murphy, George Moseley (1956). The Mathematics of Physics and Chemistry. Princeton: Van Nostrand.
- Gans, Peter (1992). Data fitting in the Chemical Sciences. New York: Wiley. ISBN 978-0-471-93412-7.
- Deming, W. E. (1943). Statistical adjustment of Data. New York: Wiley.
- Goldberger, Arthur S. (1964). "Classical Linear Regression". Econometric Theory. New York: John Wiley & Sons. pp. 158. ISBN 0-471-31101-4.
- Hayashi, Fumio (2000). Econometrics. Princeton University Press. p. 15.
- Hayashi (2000, page 18)
- Ghilani, Charles D.; Paul r. Wolf, Ph. D. (12 June 2006). Adjustment Computations: Spatial Data Analysis. ISBN 9780471697282.
- Hofmann-Wellenhof, Bernhard; Lichtenegger, Herbert; Wasle, Elmar (20 November 2007). GNSS – Global Navigation Satellite Systems: GPS, GLONASS, Galileo, and more. ISBN 9783211730171.
- Xu, Guochang (5 October 2007). GPS: Theory, Algorithms and Applications. ISBN 9783540727156.
- 18.0 18.1 Hayashi (2000, page 19)
- Julian Faraway (2000), Practical Regression and Anova using R
- Kenney, J.; Keeping, E. S. (1963). Mathematics of Statistics. van Nostrand. p. 187.
- Zwillinger, D. (1995). Standard Mathematical Tables and Formulae. Chapman&Hall/CRC. p. 626. ISBN 0-8493-2479-3.
- Hayashi (2000, page 20)
- Hayashi (2000, page 5)
- Akbarzadeh, Vahab (7 May 2014). "Line Estimation".
- Hayashi (2000, page 49)
- 26.0 26.1 Hayashi (2000, page 52)
- Hayashi (2000, page 7)
- 28.0 28.1 Hayashi (2000, page 10)
- Hayashi (2000, page 34)
- "Assumptions of multiple regression: Correcting two misconceptions" (2013). Practical Assessment, Research & Evaluation 18 (11).
- Hayashi (2000, pages 27, 30)
- 32.0 32.1 32.2 Hayashi (2000, page 27)
- Amemiya, Takeshi (1985). Advanced Econometrics. Harvard University Press. p. 13. ISBN 9780674005600.
- Amemiya (1985, page 14)
- Rao, C. R. (1973). Linear Statistical Inference and its Applications (Second ed.). New York: J. Wiley & Sons. p. 319. ISBN 0-471-70823-2.
- Amemiya (1985, page 20)
- Amemiya (1985, page 27)
Wikipedia References
- Wikipedia contributors. "Least Squares". Wikipedia. Wikipedia. Retrieved 17 August 2022.
- Wikipedia contributors. "Linear least squares". Wikipedia. Wikipedia. Retrieved 17 August 2022.
- Wikipedia contributors. "Ordinary least squares". Wikipedia. Wikipedia. Retrieved 17 August 2022.