Gauss–Markov theorem
In statistics, the Gauss–Markov theorem (or simply Gauss theorem for some authors) states that the ordinary least squares (OLS) estimator has the lowest sampling variance within the class of linear unbiased estimators, if the errors in the linear regression model are uncorrelated, have equal variances and expectation value of zero. The errors do not need to be normal, nor do they need to be independent and identically distributed (only uncorrelated with mean zero and homoscedastic with finite variance). The requirement that the estimator be unbiased cannot be dropped, since biased estimators exist with lower variance . See, for example, the James–Stein estimator (which also drops linearity), ridge regression, or simply any degenerate estimator. The theorem was named after Carl Friedrich Gauss and Andrey Markov, although Gauss' work significantly predates Markov's. But while Gauss derived the result under the assumption of independence and normality, Markov reduced the assumptions to the form stated above. A further generalization to non-spherical errors was given by Alexander Aitken. Statement. Suppose we have in matrix notation, expanding to, where formula_3 are non-random but unobservable parameters, formula_4 are non-random and observable (called the "explanatory variables"), formula_5 are random , and so formula_6 are random. The random variables formula_5 are called the "disturbance", "noise" or simply "error" (will be contrasted with "residual" later in the article; see errors and residuals in statistics). Note that to include a constant in the model above, one can choose to introduce the constant as a variable formula_8 with a newly introduced last column of X being unity i.e., formula_9 for all formula_10. Note that though formula_11 as sample responses, are observable, the following statements and arguments including assumptions, proofs and the others assume under the only condition of knowing formula_12 but not formula_13 The  Gauss–Markov assumptions concern the set of error random variables, formula_5: A linear estimator of formula_19 is a linear combination in which the coefficients formula_21 are not allowed to depend on the underlying coefficients formula_3, since those are not observable, but are allowed to depend on the values formula_23, since these data are observable. (The dependence of the coefficients on each formula_4 is typically nonlinear; the estimator is linear in each formula_25 and hence in each random formula_26 which is why this is "linear" regression.) The estimator is said to be unbiased if and only if regardless of the values  of formula_23. Now, let formula_29 be some linear combination of the coefficients. Then the mean squared error of the corresponding estimation is in other words it is the expectation of the square of the weighted sum (across parameters) of the differences between the estimators and the corresponding parameters to be estimated. (Since we are considering the case in which all the parameter estimates are unbiased, this mean squared error is the same as the variance of the linear combination.) The best linear unbiased estimator (BLUE) of the vector formula_31 of parameters formula_32 is one with the smallest mean squared error  for every vector formula_33 of linear combination parameters. This is equivalent to the condition that is a positive semi-definite matrix for every other linear unbiased estimator formula_35. The ordinary least squares estimator (OLS) is the function of formula_37 and formula_38 (where formula_39 denotes the transpose of formula_40) that minimizes the sum of squares of residuals (misprediction amounts): The theorem now states that the OLS estimator is a BLUE. The main idea of the proof is that the least-squares estimator is uncorrelated with every linear unbiased estimator of zero, i.e., with every linear combination formula_42 whose coefficients do not  depend upon the unobservable formula_31 but whose expected value is always zero. Remark. Proof that the OLS indeed MINIMIZES the sum of squares of residuals may proceed as follows with a calculation of the Hessian matrix and showing that it is positive definite. The MSE function we want to minimize is formula_44 for a multiple regression model with "p" variables. The first derivative is formula_45 where "X" is the design matrix formula_46 The Hessian matrix of second derivatives is formula_47 Assuming the columns of formula_38 are linearly independent so that formula_49 is invertible, let formula_50, then formula_51 Now let formula_52  be an eigenvector of formula_53. formula_54 In terms of vector multiplication, this means formula_55 where formula_56 is the eigenvalue corresponding to formula_57. Moreover, formula_58 Finally, as eigenvector formula_57 was arbitrary, it means all eigenvalues of formula_53 are positive, therefore formula_53 is positive definite. Thus, formula_62 is indeed a global minimum. Proof. Let formula_63 be another linear estimator of formula_31 with formula_65 where formula_66 is a formula_67 non-zero matrix. As we're restricting to "unbiased" estimators, minimum mean squared error implies minimum variance. The goal is therefore to show that such an estimator has a variance no smaller than that  of formula_68 the OLS estimator. We calculate: Therefore, since formula_70 is unobservable, formula_71 is unbiased if and only if formula_72. Then: Since "DD"' is a positive semidefinite matrix, formula_74 exceeds formula_75 by a positive semidefinite matrix. Remarks on the proof. As it has been stated before, the condition of formula_76 is a positive semidefinite matrix is equivalent to the property that the best linear unbiased estimator of formula_77 is formula_78 (best in the sense that it has minimum variance). To see this, let formula_79 another linear unbiased estimator of formula_77. Moreover, equality holds if and only if formula_82. We calculate  This proves that the equality holds if and only if formula_84 which gives the uniqueness of the OLS estimator as a BLUE. Generalized least squares estimator. The generalized least squares (GLS), developed by Aitken, extends the Gauss–Markov theorem to the case where the error vector has a non-scalar covariance matrix. The Aitken estimator is also a BLUE. Gauss–Markov theorem as stated in econometrics. In most treatments of OLS, the regressors (parameters of interest) in the design matrix formula_85 are assumed to be fixed in repeated samples. This assumption is considered inappropriate for a predominantly nonexperimental science like  econometrics. Instead, the assumptions of the Gauss–Markov theorem are stated conditional on formula_85. Linearity. The dependent variable is assumed to be a linear function of the variables specified in the model. The specification must be linear in its parameters. This does not mean that there must be a linear relationship between the independent and dependent variables. The independent variables can take non-linear forms as long as the parameters are linear. The equation formula_87 qualifies as linear while formula_88 can be transformed to be linear by replacing formula_89 by another parameter, say formula_90. An equation with a parameter dependent  on an independent variable does not qualify as linear, for example formula_91, where formula_92 is a function of formula_93. Data transformations are often used to convert an equation into a linear form. For example, the Cobb–Douglas function—often used in economics—is nonlinear: But it can be expressed in linear form by taking the natural logarithm of both sides: This assumption also covers specification issues: assuming that the proper functional form has been selected and there are no omitted variables. One should be aware, however, that the parameters that minimize the residuals of the transformed equation do not necessarily  minimize the residuals of the original equation. Strict exogeneity. For all formula_96 observations, the expectation—conditional on the regressors—of the error term is zero: where formula_98 is the data vector of regressors for the "i"th observation, and consequently formula_99 is the data matrix or design matrix. Geometrically, this assumption implies that formula_100 and formula_101 are orthogonal to each other, so that their inner product (i.e., their cross moment) is zero. This assumption is violated if the explanatory variables are stochastic, for instance when they are measured with error, or are endogenous. Endogeneity can be the result of simultaneity, where  causality flows back and forth between both the dependent and independent variable. Instrumental variable techniques are commonly used to address this problem. Full rank. The sample data matrix formula_85 must have full column rank. Otherwise formula_105 is not invertible and the OLS estimator cannot be computed. A violation of this assumption is perfect multicollinearity, i.e. some explanatory variables are linearly dependent. One scenario in which this will occur is called "dummy variable trap," when a base dummy variable is not omitted resulting in perfect correlation between the dummy variables and the constant term. Multicollinearity (as long as it is  not "perfect") can be present resulting in a less efficient, but still unbiased estimate. The estimates will be less precise and highly sensitive to particular sets of data. Multicollinearity can be detected from condition number or the variance inflation factor, among other tests. Spherical errors. The outer product of the error vector must be spherical. This implies the error term has uniform variance (homoscedasticity) and no serial dependence. If this assumption is violated, OLS is still unbiased, but inefficient. The term "spherical errors" will describe the multivariate normal distribution: if formula_107 in the multivariate normal density, then the equation formula_108  is the formula for a ball centered at μ with radius σ in n-dimensional space. Heteroskedasticity occurs when the amount of error is correlated with an independent variable. For example, in a regression on food expenditure and income, the error is correlated with income. Low income people generally spend a similar amount on food, while high income people may spend a very large amount or as little as low income people spend. Heteroskedastic can also be caused by changes in measurement practices. For example, as statistical offices improve their data, measurement error decreases, so the error term declines over  time. This assumption is violated when there is autocorrelation. Autocorrelation can be visualized on a data plot when a given observation is more likely to lie above a fitted line if adjacent observations also lie above the fitted regression line. Autocorrelation is common in time series data where a data series may experience "inertia." If a dependent variable takes a while to fully absorb a shock. Spatial autocorrelation can also occur geographic areas are likely to have similar errors. Autocorrelation may be the result of misspecification such as choosing the wrong functional form. In these cases, correcting the specification is  one possible way to deal with autocorrelation. In the presence of spherical errors, the generalized least squares estimator can be shown to be BLUE.