Skip to main content
Statistics LibreTexts

8.3: Adjustments for Heteroskedasticity

  • Page ID
    57746
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Linear regression assumes constant error variance, i.e., homoskedasticity. When this assumption is violated, as often happens with real-world data like electoral results, our standard errors become unreliable, leading to invalid hypothesis tests and confidence intervals. While transformations can sometimes remedy this, they may introduce other model problems.

    This page re-introduces a powerful alternative: the Huber-White sandwich estimator. Instead of altering the model itself, this method directly adjusts the estimated standard errors to account for observed heteroskedasticity, providing "heteroskedasticity-consistent" inference. You will see the mathematical foundation of this adjustment and learn to implement it in R with a single command. Using the South Sudan referendum case, we'll compare original and adjusted results, highlighting how this correction can change — or affirm — your conclusions while leaving the original coefficient estimates unchanged. This technique is a crucial tool for robust statistical inference when model assumptions are violated.

    ✦•················• ✦ •··················•✦

    The previous transformations also work well on fixing problems with heteroskedasticity and non-Normality. Unfortunately, if you perform an appropriate transformation to fix the problem with model fit, further transformations to fix heteroskedasticity may end up creating a new problem with model fit. Thus, it may happen that you cannot find a way of fixing the heteroskedasticity without breaking something else. In such cases, we can adjust the standard errors using a technique introduced by White in 1980.

    Recall from ordinary least squares estimation that our estimator for \(\mathbf{B}\) is

    \begin{equation}
    \mathbf{b} = \left(\mathbf{X}^\prime \mathbf{X}\right)^{-1}\mathbf{X}^\prime \mathbf{Y}
    \end{equation}

    From this we showed that this estimator was unbiased; that is, \(E[\mathbf{b}] = \mathbf{B}\). We also calculated the variance of the estimator as

    \begin{equation}
    V[\mathbf{b}] = \sigma^2 \left( \mathbf{X}^\prime \mathbf{X}\right)^{-1}
    \end{equation}

    Homoskedasticity

    That result, however, required that \(V[\mathbf{Y}] = \sigma^2 \mathbf{I}\). This is the assumption of homoskedasticity. Under heteroskedasticity, \(V[\mathbf{Y}]\) cannot be reduced. This leaves the variance of our OLS estimators as

    \begin{equation}\label{eq:trans-sandwichRaw}
    V[\mathbf{b}] = \left(\mathbf{X}^\prime \mathbf{X}\right)^{-1}\mathbf{X}^\prime\ \ V[\mathbf{Y}\ |\ \mathbf{X}]\ \ \mathbf{X}\left(\mathbf{X}^\prime \mathbf{X}\right)^{-1}
    \end{equation}

    So, to better estimate \(V[\mathbf{b}]\), we need to estimate \(V[\mathbf{Y} \ |\ \mathbf{X}]\) from the data. (Everything else in Equation \(\ref{eq:trans-sandwichRaw}\) is known.)

    • How do we estimate \(V[\mathbf{Y} \ |\ \mathbf{X}]\) from the data?

    We recall that \(V[\mathbf{Y} \ |\ \mathbf{X}] = V[\mathbf{E}]\). Thus, we can estimate \(V[\mathbf{Y}]\) from the residuals, specifically from how large each residual is. If the \(i^{\text{th}}\) residual is large, then the value of \(V[Y_i]\) will be large; if \(e_i\) is small, then \(V[Y_i]\) will be small.

    Note

    The Huber-White Sandwich Estimator makes adjustments for heteroskedasticity. These adjustments, however, are based on the data, which are random. Including this new source of randomness affects all confidence intervals and needs to be acknowledged.

    It seems to me that it would be easier to create an entirely new estimation method than to just pile on adjustment after adjustment on OLS. This is, in fact, where we are headed in this book.

    This was all covered in greater detail in Section 6.3: Homoskedasticity. I encourage you to review that section before continuing.

    Having R Do This for Us

    Instead of performing the above calculations by hand, we can have R do the adjustments for us. That helps with the accuracy and precision. The summaryHCE function in the KnoxStats package provides the adjustment and presents it in the form of our usual regression table.

    Example \(\PageIndex{1}\): South Sudan Again

    To illustrate the operation of the summaryHCE function, let us calculate the White-adjusted standard errors for the South Sudanese model of Section 8.2: The South Sudanese Referendum.

    Solution.
    We have already calculated the regression table for the logit model. From looking at the graphic, it seems as though there may be heteroskedasticity. There appears to be a lot more variation in the invalidation rate for smaller values of secession support than for larger values of secession support.

    Running the following adjusts the standard errors to reflect the observed heteroskedasticity.

    summaryHCE(model.xsd)
    

    The heteroskedasticity-adjusted regression table is given below. Note that the estimates remain the same. That is because heteroskedasticity does not affect the estimates. The only changes are in the standard errors (and the test statistics and the p-values).

    Original Regression Table

                Estimate Std. Error t value Pr(>|t|)    
    (Intercept)   1.8978     0.7690   2.468   0.0155 *  
    p.ind        -9.3991     0.8287 -11.342   <2e-16 ***

    Heteroskedasticity-Adjusted Regression Table

                 Estimate HC Std. Error HC t value HC Pr(>|t|)
    (Intercept)  1.897846     0.6704021   2.830907    0.004642
    p.ind       -9.399121     0.7420048 -12.667196    0.000000

    Notice that adjusting the standard errors is rather easy using R. It is just a single line. Also, notice that we did not model the heteroskedasticity, we merely adjusted for it.

    Think About

    At some level, it is unsettling to me to merely adjust for model weaknesses. It is a strong model that does not need fixes. Thus, if you can avoid using these Huber-White standard errors, I recommend it strongly. Heteroskedasticity is an important part of the data/model. It seems sinful to ignore it.


    This page titled 8.3: Adjustments for Heteroskedasticity is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Ole Forsberg.

    • Was this article helpful?