Jump to content

Ordinary least squares

From Wiki@IndraStra
Revision as of 12:58, 20 August 2026 by WikiSysopIG (talk | contribs) (Created page with "'''Ordinary least squares''' ('''OLS''') is a method for estimating the parameters of a linear regression model by minimizing the sum of the squared differences between observed and fitted values. For a simple linear regression model: <math> Y_i = \beta_0 + \beta_1X_i + \epsilon_i </math> the fitted value is: <math> \hat{Y}_i = \hat{\beta}_0 + \hat{\beta}_1X_i </math> and the residual is: <math> e_i = Y_i-\hat{Y}_i </math> The OLS estimat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Ordinary least squares (OLS) is a method for estimating the parameters of a linear regression model by minimizing the sum of the squared differences between observed and fitted values.

For a simple linear regression model:

Yi=β0+β1Xi+ϵi

the fitted value is:

Ŷi=β̂0+β̂1Xi

and the residual is:

ei=Yi−Ŷi

The OLS estimator chooses the coefficients that minimize the sum of squared residuals:

minβ0,β1∑i=1n(Yi−β0−β1Xi)2

Objective function

The OLS objective function is commonly called the residual sum of squares (RSS) or sum of squared errors (SSE):

RSS=∑i=1n(Yi−Ŷi)2

The estimated coefficients are therefore:

(β̂0,β̂1)=argminβ0,β1∑i=1n(Yi−β0−β1Xi)2

The use of squared residuals prevents positive and negative residuals from cancelling each other and places greater weight on larger deviations.

Simple linear regression

For simple linear regression, the OLS estimate of the slope coefficient is:

β̂1=∑i=1n(Xi−X¯)(Yi−Y¯)∑i=1n(Xi−X¯)2

The intercept is:

β̂0=Y¯−β̂1X¯

where:

  • X¯ = sample mean of the explanatory variable;
  • Y¯ = sample mean of the dependent variable.

The fitted regression equation is therefore:

Ŷi=β̂0+β̂1Xi

Geometric interpretation

OLS selects the line that minimizes the squared vertical distance between the observed data points and their fitted values.

The residual for each observation is:

ei=Yi−Ŷi

and the objective is:

∑i=1nei2→min

This produces the line of best fit under the least-squares criterion.

Multiple linear regression

OLS can be extended to models containing multiple explanatory variables:

Yi=β0+β1X1,i+β2X2,i+⋯+βkXk,i+ϵi

The fitted model is:

Ŷi=β̂0+β̂1X1,i+β̂2X2,i+⋯+β̂kXk,i

OLS estimates the coefficients by minimizing:

min𝜷∑i=1n(Yi−𝐱i𝖳𝜷)2

where 𝜷 is the vector of regression coefficients.

Matrix formulation

The multiple regression model can be written in matrix form as:

𝐲=𝐗𝜷+𝝐

The OLS estimator is:

𝜷̂=(𝐗𝖳𝐗)−1𝐗𝖳𝐲

provided that 𝐗𝖳𝐗 is invertible.

The fitted values are:

𝐲̂=𝐗𝜷̂

and the residual vector is:

𝐞=𝐲−𝐲̂

Normal equations

The OLS estimates satisfy the normal equations:

𝐗𝖳(𝐲−𝐗𝜷̂)=𝟎

Equivalently:

𝐗𝖳𝐗𝜷̂=𝐗𝖳𝐲

These equations arise from setting the derivatives of the sum of squared residuals with respect to the regression coefficients equal to zero.

OLS in finance

OLS is widely used in financial analysis to estimate relationships between asset returns and market or factor returns.

A simplified market model is:

Ri=αi+βiRm+ϵi

where:

  • Ri = return of asset i;
  • αi = regression intercept;
  • βi = sensitivity of the asset to market returns;
  • Rm = market return;
  • ϵi = residual return.

OLS can be used to estimate:

(α̂i,β̂i)=argminαi,βi∑t=1n(Ri,t−αi−βiRm,t)2

The estimated beta is:

β̂i=Cov⁡(Ri,Rm)Var⁡(Rm)

Factor models

OLS can also be used to estimate multifactor models.

A simplified factor model is:

Ri−Rf=αi+βi1F1+βi2F2+⋯+βikFk+ϵi

where:

  • Ri−Rf = asset's excess return;
  • Fk = factor k;
  • βik = estimated exposure to factor k;
  • αi = intercept;
  • ϵi = residual return.

OLS estimates the factor exposures by minimizing the squared residuals.

Statistical properties

Under the classical linear regression assumptions, OLS has important statistical properties.

The Gauss–Markov theorem states that, under its applicable assumptions, OLS is the best linear unbiased estimator (BLUE) of the regression coefficients.

In particular, the OLS estimator is:

  • linear in the observed dependent variable;
  • unbiased under the relevant assumptions;
  • minimum variance among linear unbiased estimators.

These properties depend on the assumptions of the regression model.

Assumptions

Common assumptions associated with classical OLS inference include:

  • linearity of the conditional mean;
  • appropriate model specification;
  • no perfect multicollinearity among explanatory variables;
  • zero conditional mean of the error term;
  • appropriate assumptions concerning the dependence structure of observations;
  • homoskedasticity for conventional OLS standard errors;
  • appropriate conditions for statistical inference.

The exact assumptions required depend on whether the objective is coefficient estimation, unbiasedness, efficiency, hypothesis testing, or prediction.

Heteroskedasticity

Heteroskedasticity occurs when the variance of the regression error differs across observations or levels of the explanatory variables.

It can be represented as:

Var⁡(ϵi∣Xi)≠σ2

OLS coefficient estimates can remain unbiased under appropriate exogeneity conditions, but conventional standard errors may be incorrect.

Heteroskedasticity-consistent standard errors can be used to obtain inference that is robust to certain forms of heteroskedasticity.

Multicollinearity

Multicollinearity occurs when explanatory variables in a multiple regression are highly linearly related.

Perfect multicollinearity prevents the standard OLS coefficient formula from being uniquely defined because:

𝐗𝖳𝐗

is not invertible.

High but imperfect multicollinearity does not prevent estimation but can increase the standard errors of individual coefficient estimates and make their interpretation more difficult.

OLS and coefficient of determination

OLS regression is commonly evaluated using the coefficient of determination:

R2=1−RSSTSS

where:

TSS=∑i=1n(Yi−Y¯)2

is the total sum of squares.

For a regression containing an intercept, OLS minimizes RSS and decomposes the total variation into explained and residual components.

Limitations

OLS has several limitations:

  • results can be sensitive to outliers;
  • omitted variables can bias coefficient estimates;
  • multicollinearity can make individual coefficients imprecise;
  • heteroskedasticity can invalidate conventional standard errors;
  • autocorrelation can affect inference in time-series applications;
  • linear models may not adequately represent nonlinear relationships;
  • statistical association does not establish causation.

In financial applications, OLS estimates can also be affected by structural changes, non-stationarity, changing volatility, and changing relationships between financial variables.

See also