12 Heteroscedasticity, Weighted Least Squares and Transformations
The assumption \(V(\varepsilon_i)=\sigma^2\) for all \(i\) is called homoscedasticity. When the error variance changes from observation to observation the errors are heteroscedastic. Heteroscedasticity is common in agricultural and economic data (Montgomery, Peck, and Vining 2021; Draper and Smith 1998; Gujarati and Porter 2009):
- Size effects: expenditure, income and output vary more among large farms than among small farms.
- Mean–variance relations: counts of insects or weeds follow Poisson-like distributions where the variance equals (or increases with) the mean; yields of high-yielding varieties vary more in absolute terms.
- Grouped or averaged data: an observation that is the mean of \(n_i\) units has variance \(\sigma^2/n_i\).
- Proportions: the variance \(\pi(1-\pi)/m\) of a proportion depends on its mean.
- Outliers and misspecification can also produce apparent heteroscedasticity.
12.1 Consequences
With \(V(\boldsymbol\varepsilon)=\sigma^2\mathbf V\), \(\mathbf V\) diagonal but \(\neq\mathbf I\):
- OLS estimates remain unbiased but are not BLUE: observations with large variance receive the same weight as precise ones.
- The true covariance matrix is \(\sigma^2(\mathbf X'\mathbf X)^{-1}\mathbf X'\mathbf V\mathbf X(\mathbf X'\mathbf X)^{-1}\), so the usual standard errors, \(t\) and \(F\) tests and confidence intervals are invalid.
- Prediction intervals have the wrong width: too wide where the variance is small and too narrow where it is large.
Detection uses residual plots (a funnel in residuals against \(\hat y\) or \(x_j\)) and the Breusch–Pagan, White or Goldfeld–Quandt tests of Chapter 8.
12.2 Generalized least squares
Suppose \(\mathbf y=\mathbf X\boldsymbol\beta+\boldsymbol\varepsilon\) with \(E(\boldsymbol\varepsilon)=\mathbf 0\) and \(V(\boldsymbol\varepsilon)=\sigma^2\mathbf V\), where \(\mathbf V\) is a known positive definite matrix. Since \(\mathbf V\) is positive definite, there is a non-singular matrix \(\mathbf K\) with \(\mathbf V=\mathbf K\mathbf K'\) (for example the Cholesky factor). Premultiplying the model by \(\mathbf K^{-1}\),
\[\mathbf K^{-1}\mathbf y=\mathbf K^{-1}\mathbf X\boldsymbol\beta+\mathbf K^{-1}\boldsymbol\varepsilon,\qquad\text{i.e.}\qquad \mathbf z=\mathbf B\boldsymbol\beta+\mathbf g,\]
where \(V(\mathbf g)=\mathbf K^{-1}\sigma^2\mathbf V\mathbf K'^{-1}=\sigma^2\mathbf I\). The transformed model satisfies the Gauss–Markov conditions, so OLS on it is BLUE:
\[\hat{\boldsymbol\beta}_{GLS}=(\mathbf B'\mathbf B)^{-1}\mathbf B'\mathbf z=(\mathbf X'\mathbf V^{-1}\mathbf X)^{-1}\mathbf X'\mathbf V^{-1}\mathbf y, \tag{12.1}\]
\[E(\hat{\boldsymbol\beta}_{GLS})=\boldsymbol\beta,\qquad V(\hat{\boldsymbol\beta}_{GLS})=\sigma^2(\mathbf X'\mathbf V^{-1}\mathbf X)^{-1}. \tag{12.2}\]
This is generalized (Aitken) least squares (Aitken 1935). It minimizes \((\mathbf y-\mathbf X\boldsymbol\beta)'\mathbf V^{-1}(\mathbf y-\mathbf X\boldsymbol\beta)\). The Cochrane–Orcutt transformation of Chapter 10 is a special case for AR(1) errors.
12.3 Weighted least squares
When the errors are uncorrelated but have unequal variances, \(\mathbf V\) is diagonal:
\[V(\varepsilon_i)=\frac{\sigma^2}{w_i},\qquad \mathbf V=\operatorname{diag}\left(\frac1{w_1},\ldots,\frac1{w_n}\right),\qquad \mathbf W=\mathbf V^{-1}=\operatorname{diag}(w_1,\ldots,w_n).\]
The weights \(w_i\) are inversely proportional to the error variances. The GLS estimator becomes the weighted least squares (WLS) estimator, which minimizes the weighted sum of squares \(S_W(\boldsymbol\beta)=\sum_{i=1}^nw_i(y_i-\mathbf x_i'\boldsymbol\beta)^2\):
\[\hat{\boldsymbol\beta}_W=(\mathbf X'\mathbf W\mathbf X)^{-1}\mathbf X'\mathbf W\mathbf y. \tag{12.3}\]
Equivalently, multiply each observation (including the column of ones) by \(\sqrt{w_i}\) and apply OLS to the transformed data.
Properties of WLS estimators
- Unbiased: \(E(\hat{\boldsymbol\beta}_W)=(\mathbf X'\mathbf W\mathbf X)^{-1}\mathbf X'\mathbf W\mathbf X\boldsymbol\beta=\boldsymbol\beta\).
- \(V(\hat{\boldsymbol\beta}_W)=\sigma^2(\mathbf X'\mathbf W\mathbf X)^{-1}\).
- BLUE among linear unbiased estimators when the weights are correct (Gauss–Markov theorem applied to the transformed model).
- \(\sigma^2\) is estimated by the weighted residual mean square \(MS_{Res,W}=\sum w_ie_i^2/(n-p)\).
- Observations with small variance (large weight) have more influence on the fit, as they should.
For simple linear regression, WLS gives
\[\hat\beta_{1W}=\frac{\sum w_i(x_i-\bar x_w)(y_i-\bar y_w)}{\sum w_i(x_i-\bar x_w)^2},\qquad \hat\beta_{0W}=\bar y_w-\hat\beta_{1W}\bar x_w, \tag{12.4}\]
where \(\bar x_w=\sum w_ix_i/\sum w_i\) and \(\bar y_w=\sum w_iy_i/\sum w_i\) are weighted means.
12.4 Choosing the weights
- Known structure. If \(V(\varepsilon_i)\propto x_i\) then \(w_i=1/x_i\); if the standard deviation is proportional to \(x_i\), \(V(\varepsilon_i)\propto x_i^2\) and \(w_i=1/x_i^2\). In the latter case, dividing the model \(y_i=\beta_0+\beta_1x_i+\varepsilon_i\) by \(x_i\) gives \(y_i/x_i=\beta_1+\beta_0(1/x_i)+\varepsilon_i/x_i\), a homoscedastic model in which the roles of slope and intercept are exchanged.
- Replicates. If there are replicate observations at each \(x\) level, estimate the variance \(s_i^2\) at each level and use \(w_i=1/s_i^2\) (or smooth the \(s_i^2\) against \(\bar x_i\) first).
- Grouped data. When each \(y_i\) is the mean of \(n_i\) observations, \(V(\bar y_i)=\sigma^2/n_i\), so \(w_i=n_i\) (Section 12.5).
- Estimated weights (feasible GLS). Fit OLS, regress \(|e_i|\) (or \(e_i^2\), or \(\ln e_i^2\)) on \(x\) or \(\hat y\) to model the variance function, set \(w_i=1/\hat\sigma_i^2\), and refit by WLS; iterate if necessary (iteratively reweighted least squares).
When the form of heteroscedasticity is unknown, OLS can be retained with heteroscedasticity-consistent (White) standard errors, \(\widehat V(\hat{\boldsymbol\beta})=(\mathbf X'\mathbf X)^{-1}\mathbf X'\operatorname{diag}(e_i^2)\mathbf X(\mathbf X'\mathbf X)^{-1}\), which give valid large-sample inference.
Example 12.1 Annual input expenditure (Rs ’000) and farm size (ha) for 30 farms are in csv/inputs.csv. Fit a regression of expenditure on size, test for heteroscedasticity, and refit by WLS if necessary.
Solution
OLS gives \(\widehat{\text{expend}}=2.456+10.424\,\text{size}\). The residual plot (Figure 12.1) shows a clear funnel, and the Breusch–Pagan test gives \(\chi^2=7.650\) on 1 df (\(p=0.0057\)): the variance increases with farm size.
Plotting \(|e_i|\) against size suggests that the standard deviation is roughly proportional to size, so \(w_i=1/\text{size}_i^2\). WLS gives \(\widehat{\text{expend}}=3.750+9.577\,\text{size}\).
| \(\hat\beta_0\) | SE | \(\hat\beta_1\) | SE | |
|---|---|---|---|---|
| OLS | 2.456 | 1.073 | 10.424 | 0.484 |
| WLS (\(w=1/\text{size}^2\)) | 3.750 | 0.255 | 9.577 | 0.346 |
The estimates are similar (both are unbiased), but WLS gives the small farms, whose expenditure is known precisely, more weight, and its standard errors are valid. The weighted residuals \(\sqrt{w_i}e_i\) show no funnel.
12.5 Regression equation on grouped data
Data are often available only as group means: average yield of farms in each size class, average weight of animals in each age group. If group \(i\) contains \(n_i\) units with mean response \(\bar y_i\) and mean regressor \(\bar x_i\), then
\[\bar y_i=\beta_0+\beta_1\bar x_i+\bar\varepsilon_i,\qquad V(\bar\varepsilon_i)=\frac{\sigma^2}{n_i}.\]
The appropriate analysis is WLS with weights \(w_i=n_i\), which gives exactly the same slope and intercept as OLS on the original ungrouped data when \(x\) is constant within groups. Unweighted regression on group means gives unbiased but inefficient estimates and wrong standard errors. Correlations computed from group means are generally much larger than those between individual observations (the ecological correlation fallacy), so conclusions from grouped data must not be transferred to individuals.
12.6 Variance-stabilizing transformations
When the variance is a function of the mean, \(V(y)=\sigma^2g(\mu)\), a transformation \(h(y)\) with \(h'(\mu)\propto1/\sqrt{g(\mu)}\) makes the variance approximately constant.
| Relation | Typical data | Transformation |
|---|---|---|
| \(\sigma^2\propto\) constant | none | |
| \(\sigma^2\propto\mu\) | counts (Poisson): insects, weeds, lesions | \(\sqrt y\) or \(\sqrt{y+0.5}\) |
| \(\sigma^2\propto\mu(1-\mu)\) | proportions: germination, mortality | \(\sin^{-1}\sqrt y\) |
| \(\sigma\propto\mu\) (\(\sigma^2\propto\mu^2\)) | yields, incomes, growth | \(\ln y\) or \(\ln(y+1)\) |
| \(\sigma\propto\mu^2\) | \(1/y\) |
Transformations may also linearize the relationship and make the errors more nearly normal. Their disadvantage is that the model is then for the transformed mean, and predictions must be back-transformed (for \(\ln y\), \(\exp(\hat\mu)\) estimates the median rather than the mean of \(y\)).
12.7 The Box–Cox family of transformations
Box and Cox (Box and Cox 1964) proposed choosing a power transformation of the response from the data. The family is
\[y^{(\lambda)}=\begin{cases}\dfrac{y^\lambda-1}{\lambda},&\lambda\neq0,\\[2mm]\ln y,&\lambda=0,\end{cases}\qquad y>0. \tag{12.5}\]
It includes no transformation (\(\lambda=1\)), square root (\(\lambda=0.5\)), logarithm (\(\lambda=0\)) and reciprocal (\(\lambda=-1\)). The form \((y^\lambda-1)/\lambda\) rather than \(y^\lambda\) makes the family continuous at \(\lambda=0\).
Because the residual sums of squares for different \(\lambda\) are on different scales, the normalized version
\[y^{(\lambda)}=\begin{cases}\dfrac{y^\lambda-1}{\lambda\,\dot y^{\lambda-1}},&\lambda\neq0,\\[2mm]\dot y\ln y,&\lambda=0,\end{cases}\qquad \dot y=\left(\prod_{i=1}^ny_i\right)^{1/n} \tag{12.6}\]
(\(\dot y\) is the geometric mean) is used. Assuming \(y^{(\lambda)}=\mathbf X\boldsymbol\beta+\boldsymbol\varepsilon\) with normal errors, maximizing the likelihood over \(\boldsymbol\beta\) and \(\sigma^2\) for fixed \(\lambda\) gives the profile log-likelihood
\[L_{\max}(\lambda)=-\frac n2\ln SS_{Res}(\lambda), \tag{12.7}\]
where \(SS_{Res}(\lambda)\) is the residual sum of squares of the regression of the normalized \(y^{(\lambda)}\) on \(\mathbf X\). The procedure is:
- For a grid of \(\lambda\) values (say \(-2\) to \(2\)), compute \(y^{(\lambda)}\), fit the model and record \(SS_{Res}(\lambda)\).
- Choose \(\hat\lambda\) that minimizes \(SS_{Res}(\lambda)\) (maximizes \(L_{\max}\)).
- An approximate \(100(1-\alpha)\%\) confidence interval for \(\lambda\) contains all \(\lambda\) with \(L_{\max}(\lambda)\ge L_{\max}(\hat\lambda)-\frac12\chi^2_{\alpha,1}\).
- In practice choose a convenient value inside the interval (such as 0, 0.5 or 1) that is easy to interpret, and refit using \(y^\lambda\) or \(\ln y\).
A related method, the Box–Tidwell procedure, chooses power transformations of the regressors.
Example 12.2 Aphid counts per plant were recorded at different days after infestation (csv/aphids.csv). Use the Box–Cox method to choose a transformation for a regression of count on day.
Solution
The straight-line fit to the raw counts has a curved, fan-shaped residual pattern. The profile log-likelihood (Figure 12.2) is maximized at \(\hat\lambda=-0.01\), with approximate 95% confidence interval \((-0.15,\ 0.13)\). The interval contains \(\lambda=0\) but not \(\lambda=1\), so the logarithmic transformation is indicated. The fitted model is
\[\widehat{\ln(\text{aphids})}=1.211+0.1826\,\text{day},\]
with \(R^2=0.970\): the population grows exponentially at about 20.0% per day.
12.8 R practical
inp <- read.csv("csv/inputs.csv")
ols <- lm(expend ~ size, data = inp)
lmtest::bptest(ols) # Breusch-Pagan#>
#> studentized Breusch-Pagan test
#>
#> data: ols
#> BP = 7.6499, df = 1, p-value = 0.005677
plot(inp$size, abs(resid(ols)), xlab = "size", ylab = "|e|") # variance function
wls <- lm(expend ~ size, data = inp, weights = 1 / size^2)
summary(wls)#>
#> Call:
#> lm(formula = expend ~ size, data = inp, weights = 1/size^2)
#>
#> Weighted Residuals:
#> Min 1Q Median 3Q Max
#> -2.8904 -0.6597 -0.2960 0.8635 3.1464
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 3.7503 0.2552 14.69 1.09e-14 ***
#> size 9.5774 0.3462 27.66 < 2e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 1.375 on 28 degrees of freedom
#> Multiple R-squared: 0.9647, Adjusted R-squared: 0.9634
#> F-statistic: 765.2 on 1 and 28 DF, p-value: < 2.2e-16
# Same fit by transforming: divide through by size
coef(lm(I(expend / size) ~ I(1 / size), data = inp)) # slope and intercept swap roles#> (Intercept) I(1/size)
#> 9.577377 3.750300
# Feasible GLS with estimated weights
sdfit <- lm(abs(resid(ols)) ~ size, data = inp)
w2 <- 1 / fitted(sdfit)^2
coef(lm(expend ~ size, data = inp, weights = w2))#> (Intercept) size
#> 3.719347 9.605570
# White heteroscedasticity-consistent standard errors
lmtest::coeftest(ols, vcov. = car::hccm(ols, type = "hc0"))#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 2.45553 0.83425 2.9434 0.006459 **
#> size 10.42410 0.61728 16.8871 3.255e-16 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
aph <- read.csv("csv/aphids.csv")
bc <- MASS::boxcox(lm(aphid ~ day, data = aph), lambda = seq(-1, 1.5, 0.01),
plotit = FALSE)
bc$x[which.max(bc$y)] # lambda-hat#> [1] -0.01
summary(lm(log(aphid) ~ day, data = aph))#>
#> Call:
#> lm(formula = log(aphid) ~ day, data = aph)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -0.46848 -0.11208 0.00463 0.10626 0.33081
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 1.210559 0.093273 12.98 1.41e-10 ***
#> day 0.182593 0.007516 24.29 3.28e-15 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 0.1931 on 18 degrees of freedom
#> Multiple R-squared: 0.9704, Adjusted R-squared: 0.9688
#> F-statistic: 590.2 on 1 and 18 DF, p-value: 3.276e-15
Box and Cox
George Box and David Cox were visiting the University of Wisconsin together in 1964 when, as Box later recalled, they decided that they ought to write a paper together simply because their names sounded so well as a pair. The result, An Analysis of Transformations (Box and Cox 1964), used both likelihood and Bayesian arguments to let the data choose a power transformation, and became one of the most cited papers in statistics. Weighted least squares is much older: Gauss himself weighted astronomical observations by their precision.
“Essentially, all models are wrong, but some are useful.”
- George E. P. Box and Norman R. Draper
12.9 Practical exercises
12.9.1 Practical 12.1: Regression on grouped data
Farm households were grouped into five size classes. The number of farms, mean farm size (ha) and mean annual expenditure on hired labour (Rs ’000) in each class are given below. Fit the regression of labour expenditure on farm size using the group means, with and without weights.
| Class | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Number of farms (\(n_i\)) | 42 | 30 | 18 | 8 | 4 |
| Mean size (\(\bar x_i\)) | 0.4 | 0.9 | 1.6 | 2.8 | 4.5 |
| Mean expenditure (\(\bar y_i\)) | 6.1 | 10.2 | 15.8 | 24.9 | 41.0 |
Solution
Since \(V(\bar y_i)=\sigma^2/n_i\), the weights are \(w_i=n_i\) (Section 12.5). The weighted means are \(\bar x_w=\sum n_i\bar x_i/\sum n_i=1.1078\) and \(\bar y_w=11.8608\). By Equation 12.4,
\[\hat\beta_{1W}=\frac{\sum n_i(\bar x_i-\bar x_w)(\bar y_i-\bar y_w)}{\sum n_i(\bar x_i-\bar x_w)^2}=8.2441,\qquad \hat\beta_{0W}=11.8608-8.2441(1.1078)=2.7276.\]
The unweighted fit on the five means is \(\hat y=2.392+8.4351x\). The unweighted fit gives the two largest classes, with only 12 farms between them, the same influence as the class of 42 small farms. The weighted fit represents all 102 farms correctly.
Doing it in R
grp <- data.frame(n = c(42, 30, 18, 8, 4), x = c(0.4, 0.9, 1.6, 2.8, 4.5),
y = c(6.1, 10.2, 15.8, 24.9, 41.0))
summary(lm(y ~ x, data = grp, weights = n))$coef # WLS, w = n_i#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 2.727645 0.3098421 8.80334 3.088258e-03
#> x 8.244073 0.2105820 39.14899 3.666824e-05
summary(lm(y ~ x, data = grp))$coef # unweighted, for comparison#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 2.392453 0.5959192 4.014727 2.774023e-02
#> x 8.435072 0.2369690 35.595682 4.875804e-05
12.9.2 Practical 12.2: Choosing a Box–Cox transformation
Bacterial colony counts on leaf discs at six days after inoculation were: day 1: 12, 15; day 2: 25, 31; day 3: 58, 49; day 4: 110, 98; day 5: 205, 240; day 6: 470, 410. Find the Box–Cox \(\hat\lambda\) for a regression of count on day and fit the indicated model.
Solution
The profile log-likelihood is maximized at \(\hat\lambda=-0.01\) with 95% interval \((-0.09,\ 0.08)\), which contains 0. The log transformation is indicated: \(\widehat{\ln(\text{count})}=1.905+0.6952\,\text{day}\), i.e. the population multiplies by \(e^{0.6952}=2.004\) each day.
Doing it in R
bac <- data.frame(day = rep(1:6, each = 2),
count = c(12, 15, 25, 31, 58, 49, 110, 98, 205, 240, 470, 410))
bc <- MASS::boxcox(lm(count ~ day, data = bac), lambda = seq(-1, 1, 0.01))
bc$x[which.max(bc$y)]#> [1] -0.01
summary(lm(log(count) ~ day, data = bac))#>
#> Call:
#> lm(formula = log(count) ~ day, data = bac)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -0.11506 -0.08187 -0.02148 0.08246 0.13881
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 1.90475 0.06509 29.27 5.06e-11 ***
#> day 0.69522 0.01671 41.60 1.54e-12 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> Residual standard error: 0.09887 on 10 degrees of freedom
#> Multiple R-squared: 0.9943, Adjusted R-squared: 0.9937
#> F-statistic: 1730 on 1 and 10 DF, p-value: 1.545e-12
12.10 Chapter Summary
Fill in the blanks
Answers are given at the end of the chapter.
Unequal error variances are called __________.
Under heteroscedasticity, OLS estimators are unbiased but not __________.
The GLS estimator is \(\hat{\boldsymbol\beta}_{GLS}=\) __________.
In WLS, the weights are inversely proportional to the __________.
If the error standard deviation is proportional to \(x_i\), the weight is \(w_i=\) __________.
When each observation is a mean of \(n_i\) units, the weight is \(w_i=\) __________.
For Poisson counts, the variance-stabilizing transformation is __________.
In the Box–Cox family, \(\lambda=0\) corresponds to the __________ transformation.
The Box–Cox \(\hat\lambda\) minimizes __________.
White’s standard errors are called __________-consistent standard errors.
Short-answer questions
List sources of heteroscedasticity in agricultural data.
What are the consequences of heteroscedasticity for OLS?
Derive the GLS estimator and show that it is BLUE.
Derive the WLS estimator and state its properties.
How are weights chosen in practice?
How should a regression be fitted to grouped data?
Explain the idea of variance-stabilizing transformations with examples.
Describe the Box–Cox family and the procedure for estimating \(\lambda\).
Why is the normalized Box–Cox transformation used?
What are heteroscedasticity-consistent standard errors?
Numerical and conceptual questions
Answers are given at the end of the chapter.
Five observations have variances \(\sigma^2,\ 2\sigma^2,\ 4\sigma^2,\ 4\sigma^2,\ 8\sigma^2\). Give the WLS weights.
Transform \(y_i=\beta_0+\beta_1x_i+\varepsilon_i\) with \(V(\varepsilon_i)=\sigma^2x_i^2\) to a homoscedastic model.
Group means of yield are 2.4, 3.1 and 3.9 t/ha based on 10, 25 and 15 farms. What weights should be used?
Write \(y^{(\lambda)}\) for \(\lambda=0.5\) and \(\lambda=-1\).
The Box–Cox profile likelihood has maximum \(-20.4\) at \(\hat\lambda=0.3\). Which values of \(\lambda\) are in the 95% confidence interval?
Percentage germination data show variance largest near 50%. Which transformation is appropriate?
If \(\ln y\) is used, how is a prediction back-transformed, and what does it estimate?
Show that WLS with \(w_i=1\) for all \(i\) is OLS.
Important formulae
Generalized least squares:
\[ \hat{\boldsymbol\beta}_{GLS}=(\mathbf X'\mathbf V^{-1}\mathbf X)^{-1}\mathbf X'\mathbf V^{-1}\mathbf y,\qquad V(\hat{\boldsymbol\beta}_{GLS})=\sigma^2(\mathbf X'\mathbf V^{-1}\mathbf X)^{-1} \]
Weighted least squares:
\[ \hat{\boldsymbol\beta}_W=(\mathbf X'\mathbf W\mathbf X)^{-1}\mathbf X'\mathbf W\mathbf y,\qquad w_i\propto\frac1{V(\varepsilon_i)} \]
Box–Cox transformation:
\[ y^{(\lambda)}=\frac{y^\lambda-1}{\lambda}\ (\lambda\ne0),\qquad y^{(0)}=\ln y,\qquad L_{\max}(\lambda)=-\frac n2\ln SS_{Res}(\lambda) \]
Confidence interval for \(\lambda\):
\[ \left\{\lambda:\ L_{\max}(\lambda)\ge L_{\max}(\hat\lambda)-\tfrac12\chi^2_{\alpha,1}\right\} \]
Quick revision
- Heteroscedasticity → OLS unbiased, not BLUE, SEs invalid.
- GLS/WLS → transform to constant variance; weights \(\propto1/\text{variance}\).
- SD ∝ \(x\) → \(w=1/x^2\); group means → \(w=n_i\).
- Transformations: counts → \(\sqrt y\); proportions → arcsine; SD ∝ mean → \(\ln y\).
- Box–Cox → let the data choose \(\lambda\); pick a convenient value in its CI.
- Unknown form → White’s robust SEs.
Answers to fill in the blanks
1. Heteroscedasticity 2. BLUE (efficient) 3. \((\mathbf X'\mathbf V^{-1}\mathbf X)^{-1}\mathbf X'\mathbf V^{-1}\mathbf y\) 4. Error variances 5. \(1/x_i^2\) 6. \(n_i\) 7. Square root 8. Logarithmic 9. \(SS_{Res}(\lambda)\) of the normalized transform 10. Heteroscedasticity
Solutions to numerical and conceptual questions
\(w_i\propto1/V\): \(1,\ 0.5,\ 0.25,\ 0.25,\ 0.125\) (any common multiple).
Divide by \(x_i\): \(y_i/x_i=\beta_1+\beta_0(1/x_i)+u_i\) with \(V(u_i)=\sigma^2\).
\(w=10,\ 25,\ 15\) (Section 12.5).
\(\lambda=0.5\): \(2(\sqrt y-1)\); \(\lambda=-1\): \(1-1/y\) (Equation 12.5).
All \(\lambda\) with \(L_{\max}(\lambda)\ge-20.4-3.84/2=-22.32\).
The arcsine square root transformation, \(\sin^{-1}\sqrt{p}\).
\(\exp(\hat\mu)\); it estimates the median of \(y\) (for the mean, multiply by \(\exp(\hat\sigma^2/2)\) under log-normality).
\(\mathbf W=\mathbf I\) gives \((\mathbf X'\mathbf X)^{-1}\mathbf X'\mathbf y\).