第8章: 重回帰分析:不均一分散

Jeffrey Wooldridge (2016).
Introductory Econometrics: A Modern Approach
Seventh Edition. Cengage Learning.

2026-03-08

準備

必要なパッケージの読み込み

library(wooldridge)
library(sandwich)
library(lmtest)

8-1 不均一分散の含意

不均一分散 (Heteroskedasticity) とは

不均一分散がOLSに与える影響

  1. 不偏性・一致性には影響しない。 OLS推定量は依然として不偏かつ一致である。
  2. OLSはもはや最良線形不偏推定量 (BLUE) ではない。 より効率的な推定量が存在し得る。
  3. 標準誤差の推定が正しくなくなる。 通常の \(t\) 統計量や \(F\) 統計量を用いた仮説検定が妥当ではなくなる。

8-2 不均一分散に頑健な推論

頑健な標準誤差 (Robust Standard Errors)

Rでの実装例 (gpa3)

data(gpa3)
res <- lm(cumgpa ~ sat + hsperc + tothrs + female + black + white, 
          data = gpa3, subset = (spring == 1))

# 通常の標準誤差
# summary(res)$coefficients[1:3, 1:2]

# 頑健な標準誤差 (sandwichパッケージを使用)
coeftest(res, vcov = vcovHC(res, type = "HC1"))[1:3, 1:2]
##                 Estimate   Std. Error
## (Intercept)  1.470064766 0.2206802109
## sat          0.001140728 0.0001915317
## hsperc      -0.008566358 0.0014179275

8-3 不均一分散の検定

ブロイシュ=ペーガン検定 (Breusch-Pagan Test)

ホワイト検定 (White Test)

BP検定の実装例

# BP検定 (lmtestパッケージ)
bptest(res)
## 
##  studentized Breusch-Pagan test
## 
## data:  res
## BP = 44.557, df = 6, p-value = 5.732e-08

ホワイト検定の実装例

# ホワイト検定(簡略版)
# 手動計算: 残差2乗を予測値とその2乗で回帰
# 残差2乗
u2 <- resid(res)^2
# 予測値
yhat <- fitted(res)
# 補助回帰
white_reg <- lm(u2 ~ yhat + I(yhat^2))
summary(white_reg)
## 
## Call:
## lm(formula = u2 ~ yhat + I(yhat^2))
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.26795 -0.18863 -0.12831  0.02872  2.18250 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)   0.7980     0.5707   1.398    0.163
## yhat         -0.5270     0.4962  -1.062    0.289
## I(yhat^2)     0.1159     0.1061   1.092    0.276
## 
## Residual standard error: 0.3492 on 363 degrees of freedom
## Multiple R-squared:  0.003455,   Adjusted R-squared:  -0.002036 
## F-statistic: 0.6292 on 2 and 363 DF,  p-value: 0.5336

LM統計量の実装例

# LM統計量 (n * R2) と p値
n <- length(u2)
lm_stat <- n * summary(white_reg)$r.squared
p_val <- 1 - pchisq(lm_stat, df = 2)
data.frame(LM = lm_stat, p_value = p_val)
##         LM   p_value
## 1 1.264452 0.5314075

8-4 加重最小二乗法 (WLS)

加重最小二乗法 (Weighted Least Squares)

実行可能な一般化最小二乗法 (FGLS)

まとめ