OLS Fundamentals
This page covers the statistical theory behind the Linear Regression tab. See that page for usage instructions.
Model Formulation
The linear regression model is formulated as:
where is the response vector, is the design matrix (predictors and intercept), is the coefficient vector, and is the error term.
The OLS estimator minimizes the residual sum of squares and is obtained from the normal equations:
The properties of this estimator depend on the assumptions placed on . Consistency is an asymptotic property (convergence as ) and unbiasedness is a finite-sample property (); they are conceptually independent. For example, maximum likelihood estimators are consistent under regularity conditions but generally biased in finite samples.
Consistency: Under (where denotes the probability limit) and nonsingular, the OLS estimator is consistent. Homoscedasticity and uncorrelated errors are not required. However, when predictors are correlated with the error term, for example through omission of relevant variables or measurement error in the predictors, this condition fails and the OLS estimator loses consistency.
Unbiasedness: Under , the OLS estimator is unbiased. Homoscedasticity is not required.
BLUE: Under and (homoscedastic and uncorrelated), the Gauss-Markov theorem guarantees the OLS estimator has minimum variance among linear unbiased estimators (Best Linear Unbiased Estimator). Here, a linear estimator is one that can be written as , where is a matrix that depends only on .
Normality-based inference: Under , the sampling distribution of is exact in finite samples, and the -based confidence interval has exact coverage. Without normality, if the errors have finite variance, the central limit theorem ensures asymptotic normality of in large samples, and the coverage of the confidence interval approaches the nominal level. The required sample size depends on the true error distribution, so no universal threshold applies. If the residual Q-Q plot shows strong skewness or heavy tails, the asymptotic approximation becomes less reliable (see residual diagnostic plots).
OLS is a special case of GLM (Gaussian family with identity link).
Standardized Residuals and Diagnostic Statistics
Residual diagnostics in OLS use the internally studentized residual :
where is the residual, is the error standard deviation estimated from all observations, and is the diagonal element of the hat matrix (leverage). is the number of columns in the design matrix , including the intercept. Since is symmetric and idempotent (an orthogonal projection matrix), . For models with an intercept, . Leverage measures how far an observation's predictor values are from the others. Since , the average leverage is , and is the conventional threshold for high leverage.
Cook's Distance combines residual magnitude and leverage into a single influence measure:
Multicollinearity and VIF
When predictors are highly correlated, approaches singularity and coefficient estimates become unstable.
VIF (Variance Inflation Factor) = is computed from , the R-squared obtained by regressing on all other predictors. A high means most of the variation in is already explained by other variables, leaving little unique information. VIF tells you how many times the variance of is inflated as a result. For example, VIF = 5 means the standard error of is times wider than it would be with uncorrelated predictors. itself remains unbiased, but the inflated variance widens the confidence interval.
See also
- Linear Regression - How to run OLS regression and interpret results
- GLM Fundamentals - Generalized linear model theory, which includes OLS as a special case
- Glossary - Statistical term definitions
Also available as a Markdown file.