# Heteroscedasticity Regression Residual Plot

**Heteroscedasticity**

One of the assumptions of the classical linear regression model is that there is no heteroscedasticity (error terms has constant error term) meaning that ordinary least square (OLS) estimators are (BLUE, best linear unbiased estimator) and their variances are the lowest of all other unbiased estimators (Gauss Markov Theorem). If the assumption of constant variance does not hold then this means that the Gauss Markov Theorem does not apply. For heteroscedastic data, regression analysis provides an unbiased estimate for the relationship between the predictors and the outcome variables.

As we have discussed that heteroscedasticity occurs when the error variance has non-constant variance. In this case, we can think of the disturbance for each observation as being drawn from a different distribution with a different variance. Stated equivalently, the variance of the observed value of the dependent variable around the regression line is non-constant. We can think of each observed value of the dependent variable as being drawn from a different conditional probability distribution with a different conditional variance. A general linear regression model with the assumption of heteroscedasticity can be expressed as follows

\begin{align*}

y_i & = \beta_0 + \beta_1 X_{i1} + \beta_2 X_{i2} + \cdots + \beta_p X_ip + \varepsilon_i\\

Var(\varepsilon_i)&=E(\varepsilon_i^2)\\

&=\sigma_i^2; \cdots i=1,2,\cdots, n

\end{align*}

Note that we have a $i$ subscript attached to sigma squared. This indicates that the disturbance for each of the $n$-units is drawn from a probability distribution that has a different variance.

If the error term has non-constant variance, but all other assumptions of the classical linear regression model are satisfied, then the consequences of using the OLS estimator to obtain estimates of the population parameters are:

- The OLS estimator is still unbiased
- The OLS estimator is inefficient; that is, it is not BLUE
- The estimated variances and covariances of the OLS estimates are biased and inconsistent
- Hypothesis tests are not valid

**Detection of Heteroscedasticity Regression Residual Plot**

The residual for the $i$th observation, $\hat{\varepsilon_i}$, is an unbiased estimate of the unknown and unobservable error for that observation, $\hat{\varepsilon_i}$. Thus the squared residuals, $\hat{\varepsilon_i^2} $, can be used as an estimate of the unknown and unobservable error variance, $\sigma_i^2=E(\hat{\varepsilon_i})$. You can calculate the squared residuals and then plot them against an explanatory variable that you believe might be related to the error variance. If you believe that the error variance may be related to more than one of the explanatory variables, you can plot the squared residuals against each one of these variables. Alternatively, you could plot the squared residuals against the fitted value of the dependent variable obtained from the OLS estimates. Most statistical programs (software) have a command to do these residual plots. It must be emphasized that this is not a formal test for heteroscedasticity. It would only suggest whether heteroscedasticity may exist.

Below there are residual plots showing the three typical patterns. The first plot shows a random pattern that indicates a good fit for a linear model. The other two plot patterns of residual plots are non-random (U-shaped and inverted U), suggesting a better fit for a non-linear model, than a linear regression model.