definition of Wikipedia
Advertizing ▼
In statistics, ordinary least squares (OLS) or linear least squares is a method for estimating the unknown parameters in a linear regression model. This method minimizes the sum of squared vertical distances between the observed responses in the dataset and the responses predicted by the linear approximation. The resulting estimator can be expressed by a simple formula, especially in the case of a single regressor on the righthand side.
The OLS estimator is consistent when the regressors are exogenous and there is no perfect multicollinearity, and optimal in the class of linear unbiased estimators when the errors are homoscedastic and serially uncorrelated. Under these conditions, the method of OLS provides minimumvariance meanunbiased estimation when the errors have finite variances. Under the additional assumption that the errors be normally distributed, OLS is the maximum likelihood estimator. OLS is used in economics (econometrics) and electrical engineering (control theory and signal processing), among many areas of application.
Contents 
Suppose the data consists of n observations { y
i, x
i }n
i=1. Each observation includes a scalar response y_{i} and a vector of predictors (or regressors) x_{i}. In a linear regression model the response variable is a linear function of the regressors:
where β is a p×1 vector of unknown parameters; ε_{i}'s are unobserved scalar random variables (errors) which account for the discrepancy between the actually observed responses y_{i} and the "predicted outcomes" x′_{i}β; and ′ denotes matrix transpose, so that x′ β is the dot product between the vectors x and β. This model can also be written in matrix notation as
where y and ε are n×1 vectors, and X is an n×p matrix of regressors, which is also sometimes called the design matrix.
As a rule, the constant term is always included in the set of regressors X, say, by taking x_{i1} = 1 for all i = 1, …, n. The coefficient β_{1} corresponding to this regressor is called the intercept.
There may be some relationship between the regressors. For instance, the third regressor may be the square of the second regressor. In this case (assuming that the first regressor is constant) we have a quadratic model in the second regressor. But this is still considered a linear model because it is linear in the βs.
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 at 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 x_{i} are random and sampled together with the y_{i}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 X are treated as known constants set by a design, and y is sampled conditionally on the values of X as in an experiment. For practical purposes, this distinction is often unimportant, since estimation and inference is carried out while conditioning on X. All results stated in this article are within the random design framework.
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.
In some applications, especially with crosssectional data, an additional assumption is imposed — that all observations are independent and identically distributed (iid). This means that all observations are taken from a random sample which makes all the assumptions listed earlier simpler and easier to interpret. Also this framework allows one to state asymptotic results (as the sample size n → ∞), which are understood as a theoretical possibility of fetching new independent observations from the data generating process. The list of assumptions in this case is:
Suppose b is a "candidate" value for the parameter β. The quantity y_{i} − x_{i}′b is called the residual for the ith observation, it measures the vertical distance between the data point (x_{i}, y_{i}) and the hyperplane y = x′b, 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))^{[5]} is a measure of the overall model fit:
The value of b which minimizes this sum is called the OLS estimator for β. The function S(b) is quadratic in b with positivedefinite Hessian, and therefore this function possesses a unique global minimum, which can be given by an explicit formula:^{[6]}^{[proof]}
After we have estimated β, the fitted values (or predicted values) from the regression will be
where P = X(X′X)^{−1}X′ is the projection matrix onto the space spanned by the columns of X. This matrix P is also sometimes called the hat matrix because it "puts a hat" onto the variable y. Another matrix, closely related to P is the annihilator matrix M = I_{n} − P, this is a projection matrix onto the space orthogonal to X. Both matrices P and M are symmetric and idempotent (meaning that P^{2} = P), and relate to the data matrix X via identities PX = X and MX = 0.^{[7]} Matrix M creates the residuals from the regression:
Using these residuals we can estimate the value of σ^{2}:
The denominator, np, is the statistical degrees of freedom. The first quantity, s^{2}, is the OLS estimate for σ^{2}, whereas the second, , is the MLE estimate for σ^{2}. The two estimators are quite similar in large samples; the first one is always unbiased, while the second is biased but minimizes the mean squared error of the estimator. In practice s^{2} is used more often, since it is more convenient for the hypothesis testing. The square root of s^{2} is called the standard error of the regression (SER), or standard error of the equation (SEE).^{[7]}
It is common to assess the goodnessoffit of the OLS regression by comparing how much the initial variation in the sample can be reduced by regressing onto X. The coefficient of determination R^{2} is defined as a ratio of "explained" variance to the "total" variance of the dependent variable y:^{[8]}
where TSS is the total sum of squares for the dependent variable, L = I_{n} − 11′/n, and 1 is an n×1 vector of ones. (L is a "centering matrix" which is equivalent to regression on a constant; it simply subtracts the mean from a variable.) In order for R^{2} to be meaningful, the matrix X of data on regressors must contain a column vector of ones to represent the constant whose coefficient is the regression intercept. In that case, R^{2} will always be a number between 0 and 1, with values close to 1 indicating a good degree of fit.
If the data matrix X contains only two variables: a constant, and a scalar regressor x_{i}, then this is called the "simple regression model".^{[9]} This case is often considered in the beginner statistics classes, as it provides much simpler formulas even suitable for manual calculation. The vectors of parameters in such model is 2dimensional, and is commonly denoted as (α, β):
The least squares estimates in this case are given by simple formulas
In the previous section the least squares estimator 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: ^{^}β = (X′X)^{−1}X′y, the only difference is in how we interpret this result.
For mathematicians, OLS is an approximate solution to an overdetermined system of linear equations Xβ ≈ y, where β is the unknown. Assuming the system cannot be solved exactly (the number of equations n is much larger than the number of unknowns p), 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 · is the standard L^{2} norm in the ndimensional Euclidean space R^{n}. The predicted quantity Xβ is just a certain linear combination of the vectors of regressors. Thus, the residual vector y − Xβ will have the smallest length when y is projected orthogonally onto the linear subspace spanned by the columns of X. The OLS estimator in this case can be interpreted as the coefficients of vector decomposition of ^{^}y = Py along the basis of X.
The OLS estimator is identical to the maximum likelihood estimator under the normality assumption for the error terms.^{[10]}^{[proof]} This normality assumption has historical importance, as it provided the basis for the early work in linear regression analysis by Yule and Pearson.^{[citation needed]} From the properties of MLE, we can infer that the OLS estimator is asymptotically efficient (in the sense of attaining the CramérRao bound for variance) if the normality assumption is satisfied.^{[11]}
In iid case the OLS estimator can also be viewed as a GMM estimator arising from the moment conditions
These moment conditions state that the regressors should be uncorrelated with the errors. Since x_{i} is a pvector, the number of moment conditions is equal to the dimension of the parameter vector β, and thus the system is exactly identified. This is the socalled classical GMM case, when the estimator does not depend on the choice of the weighting matrix.
Note that the original strict exogeneity assumption E[ε_{i}  x_{i}] = 0 implies a far richer set of moment conditions than stated above. In particular, this assumption implies that for any vectorfunction ƒ, the moment condition E[ƒ(x_{i})·ε_{i}] = 0 will hold. However it can be shown using the Gauss–Markov theorem that the optimal choice of function ƒ is to take ƒ(x) = x, which results in the moment equation posted above.
First of all, under the strict exogeneity assumption the OLS estimators and s^{2} are unbiased, meaning that their expected values coincide with the true values of the parameters:^{[12]}^{[proof]}
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 variancecovariance matrix of is equal to ^{[13]}
In particular, the standard error of each coefficient is equal to square root of the jth diagonal element of this matrix. The estimate of this standard error is obtained by replacing the unknown quantity σ^{2} with its estimate s^{2}. Thus,
It can also be easily shown that the estimator is uncorrelated with the residuals from the model:^{[13]}
The Gauss–Markov theorem states that under the spherical errors assumption (that is, the errors should be uncorrelated and homoscedastic) the estimator 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 which would be linear in y and unbiased, then ^{[13]}
in the sense that this is a nonnegativedefinite 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, nonlinear estimators may provide better results than OLS.
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 ε ~ N(0, σ^{2}I_{n})), then additional properties of the OLS estimators can be stated.
The estimator is normally distributed, with mean and variance as given before:^{[14]}
This estimator reaches the Cramér–Rao bound for the model, and thus is optimal in the class of all unbiased estimators.^{[11]} Note that unlike the Gauss–Markov theorem, this result establishes optimality among both linear and nonlinear estimators, but only in the case of normally distributed error terms.
The estimator s^{2} will be proportional to the chisquared distribution:^{[15]}
The variance of this estimator is equal to 2σ^{4}/(n − p), which does not attain the Cramér–Rao bound of 2σ^{4}/n. However it was shown that there are no unbiased estimators of σ^{2} with variance smaller than that of the estimator s^{2}.^{[16]} 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 ^{~}σ^{2} = SSR / (n − p + 2), which even beats the Cramér–Rao bound in case when there is only one regressor (p = 1).^{[17]}
Moreover, the estimators and s^{2} are independent,^{[18]} the fact which comes in useful when constructing the t and Ftests for the regression.
As was mentioned before, the estimator is linear in y, meaning that it represents a linear combination of the dependent variables y_{i}'s. The weights in this linear combination are functions of the regressors X, and generally are unequal. The observations with high weights are called influential because they have a more pronounced effect on the value of the estimator.
To analyze which observations are influential we remove a specific jth observation and consider how much the estimated quantities are going to change (similarly to the jackknife method). It can be shown that the change in the OLS estimator for β will be equal to ^{[19]}
where h_{j} = x_{j}′ (X′X)^{−1}x_{j} is the jth diagonal element of the hat matrix P, and x_{j} is the vector of regressors corresponding to the jth observation. Similarly, the change in the predicted value for jth observation resulting from omitting that observation from the dataset will be equal to ^{[19]}
From the properties of the hat matrix, 0 ≤ h_{j} ≤ 1, and they sum up to p, so that on average h_{j} ≈ p/n. These quantities h_{j} are called the leverages', and observations with high h_{j}s — leverage points.^{[20]} Usually the observations with high leverage ought to be scrutinized more carefully, in case they are erroneous, or outliers, or in some other way atypical of the rest of the dataset.
Sometimes the variables and corresponding parameters in the regression can be logically split into two groups, so that the regression takes form
where X_{1} and X_{2} have dimensions n×p_{1}, n×p_{2}, and β_{1}, β_{2} are p_{1}×1 and p_{2}×1 vectors, with p_{1} + p_{2} = p.
The Frisch–Waugh–Lovell theorem states that in this regression the residuals and the OLS estimate will be numerically identical to the residuals and the OLS estimate for β_{2} in the following regression:^{[21]}
where M_{1} is the annihilator matrix for regressors X_{1}.
The theorem can be used to establish a number of theoretical results. For example, having a regression with a constant and another regressor is equivalent to subtracting the means from the dependent variable and the regressor and then running the regression for the demeaned variables but without the constant term.
Suppose it is known that the coefficients in the regression satisfy a system of linear equations
where Q is a p×q matrix of full rank, and c is a q×1 vector of known constants, where q < p. In this case least squares estimation is equivalent to minimizing the sum of squared residuals of the model subject to the constraint H_{0}. The constrained least squares (CLS) estimator can be given by an explicit formula:^{[22]}
This expression for the constrained estimator is valid as long as the matrix X′X is invertible. It was assumed from the beginning of this article that this matrix is of full rank, and it was noted that when the rank condition fails, β will not be identifiable. However it may happen that adding the restriction H_{0} makes β identifiable, in which case one would like to find the formula for the estimator. The estimator is equal to ^{[23]}
where R is a p×(p−q) matrix such that the matrix [Q R] is nonsingular, and R′Q = 0. Such a matrix can always be found, although generally it is not unique. The second formula coincides with the first in case when X′X is invertible.^{[23]}
The least squares estimators are point estimates of the linear regression model parameters β. 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 ε_{i}, it is impossible to infer the distribution of the estimators and . Nevertheless, we can apply the law of large numbers and central limit theorem to derive their asymptotic properties as sample size n goes to infinity. Now of course in practice sample size doesn't go anywhere, however it is customary to pretend that n is "large enough" so that the true distribution of OLS estimator is close to its asymptotic limit, and the former may be approximately replaced by the latter.
We can show that under the model assumptions, least squares estimator for β is consistent (that is converges in probability to β) and asymptotically normal:^{[proof]}
where
Using this asymptotic distribution, approximate twosided confidence intervals for the jth component of the vector can be constructed as
where q denotes the quantile function of standard normal distribution, and [·]_{jj} is the jth diagonal element of a matrix.
Similarly, the least squares estimator for σ^{2} is also consistent and asymptotically normal (provided that the fourth moment of ε_{i} 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 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 , whereas the predicted response is . Clearly the predicted response is a random variable, its distribution can be derived from that of :
which allows construct confidence intervals for mean response to be constructed:
This section is empty. You can help by adding to it. (July 2010) 
The following data set gives average heights and weights for American women aged 30–39 (source: The World Almanac and Book of Facts, 1975).
Height (m):  1.47  1.50  1.52  1.55  1.57  1.60  1.63  1.65  1.68  1.70  1.73  1.75  1.78  1.80  1.83 

Weight (kg):  52.21  53.12  54.48  55.84  57.20  58.57  59.93  61.29  63.11  64.47  66.28  68.10  69.92  72.19  74.46 
When only one dependent variable is being modeled, a scatterplot will suggest the form and strength of the relationship between the dependent variable and regressors. It might also reveal outliers, heteroscedasticity, and other aspects of the data that may complicate the interpretation of a fitted regression model. The scatterplot suggests that the relationship is strong and can be approximated as a quadratic function. OLS can handle nonlinear relationships by introducing the regressor HEIGHT^{2}. The regression model then becomes a multiple linear model:
The output from most popular statistical packages will look similar to this:
Method: Least Squares Dependent variable: WEIGHT Included observations: 15 

Variable  Coefficient  Std.Error  tstatistic  pvalue  

const  128.8128  16.3083  7.8986  0.0000  
HEIGHT  –143.1620  19.8332  –7.2183  0.0000  
HEIGHT^{2}  61.9603  6.0084  10.3122  0.0000  
R^{2}  0.9989  S.E. of regression  0.2516  
Adjusted R^{2}  0.9987  Model sumofsq  692.61  
Loglikelihood  1.0890  Residual sumofsq  0.7595  
Durbin–Watson stats.  2.1013  Total sumofsq  693.37  
Akaike criterion  0.2548  Fstatistic  5471.2  
Schwarz criterion  0.3964  pvalue (Fstat)  0.0000 
In this table:
Ordinary least squares analysis often includes the use of diagnostic plots designed to detect departures of the data from the assumed form of the model. These are some of the common diagnostic plots:
An important consideration when carrying out statistical inference using regression models is how the data were sampled. In this example, the data are averages rather than measurements on individual women. The fit of the model is very good, but this does not imply that the weight of an individual woman can be predicted with high accuracy based only on her height.
This example also demonstrates that sophisticated calculations will not overcome the use of badly prepared data. The heights were originally given in inches, and have been converted to the nearest centimetre. Since the conversion factor is one inch to 2.54cm, this is not a correct conversion. The original inches can be recovered by Round(x/0.0254) and then reconverted to metric: if this is done, the results become
const height Height^{2} 128.8128 143.162 61.96033 incorrectly converted to metric. 119.0205 131.5076 58.5046 correctly converted.
Thus a seemingly small variation in the data has a real effect.

sensagent's content
Dictionary and translator for handheld
New : sensagent is now available on your handheld
Advertising ▼
Webmaster Solution
Alexandria
A windows (popinto) of information (fullcontent of Sensagent) triggered by doubleclicking any word on your webpage. Give contextual explanation and translation from your sites !
SensagentBox
With a SensagentBox, visitors to your site can access reliable information on over 5 million pages provided by Sensagent.com. Choose the design that fits your site.
Business solution
Improve your site content
Add new content to your site from Sensagent by XML.
Crawl products or adds
Get XML access to reach the best products.
Index images and define metadata
Get XML access to fix the meaning of your metadata.
Please, email us to describe your idea.
Lettris
Lettris is a curious tetrisclone game where all the bricks have the same square shape but different content. Each square carries a letter. To make squares disappear and save space for other squares you have to assemble English words (left, right, up, down) from the falling squares.
boggle
Boggle gives you 3 minutes to find as many words (3 letters or more) as you can in a grid of 16 letters. You can also try the grid of 16 letters. Letters must be adjacent and longer words score better. See if you can get into the grid Hall of Fame !
English dictionary
Main references
Most English definitions are provided by WordNet .
English thesaurus is mainly derived from The Integral Dictionary (TID).
English Encyclopedia is licensed by Wikipedia (GNU).
Copyrights
The wordgames anagrams, crossword, Lettris and Boggle are provided by Memodata.
The web service Alexandria is granted from Memodata for the Ebay search.
The SensagentBox are offered by sensAgent.
Translation
Change the target language to find translations.
Tips: browse the semantic fields (see From ideas to words) in two languages to learn more.
last searches on the dictionary :
computed in 0.031s