Econometrics · Week 8
Heteroskedasticity異方差
Week 7 showed that OLS is unbiased under A1–A3 and that its usual standard errors need one more assumption, A4: the errors have the same variance for every observation. With real data that assumption often fails. Richer households differ far more in their savings than poorer ones. This week shows what goes wrong when the variance changes, how to test for it, and how to fix the standard errors so the t and F tests can still be trusted.
第 7 週說明了 OLS 在 A1–A3 下無偏,而它的一般標準誤還需要多一個假設 A4:所有觀測值的誤差方差相同。在真實數據中,這個假設經常不成立。富裕住戶之間儲蓄的差異,遠大於較貧窮住戶之間的差異。本週說明方差改變時會出現甚麼問題、怎樣檢定,以及怎樣修正標準誤,令 t 檢定和 F 檢定仍然可信。
- Reading time 閱讀時間
- About 50 minutes
- Data 數據
k401ksubs- Code 程式碼
- R, Python
What heteroskedasticity is甚麼是異方差
Assumption A4 from Week 7, , bundles two conditions:
第 7 週的假設 A4,,其實包含兩個條件:
Homoskedasticity: for every , the same number for all observations.
同方差:對每個 都有 ,所有觀測值都是同一個數。
No serial correlation: for .
沒有序列相關:對 有 。
This week keeps the second and drops the first. The errors are heteroskedastic when their variances differ: the covariance matrix is still diagonal, but its diagonal entries are no longer equal.
本週保留第二個條件,放棄第一個。當誤差的方差各不相同時,誤差便是異方差的:協方差矩陣仍然是對角矩陣,但對角元素不再相等。
Typically depends on the regressors of observation : the spread of around the regression line is wider for some values of than for others.
通常 取決於第 個觀測值的解釋變數:在某些 值上, 圍繞回歸線的離散程度比其他值大。
Where it comes from異方差的成因
More room to choose. A household earning little spends most of it on necessities, so its food spending or saving is tightly constrained. A rich household can save a lot or nothing. The variance of spending or saving rises with income.
選擇空間較大。收入低的住戶大部分收入都花在必需品上,食物開支或儲蓄受到很大限制。富裕住戶則可以大量儲蓄,也可以完全不儲蓄。開支或儲蓄的方差隨收入上升。
Turbulent periods. Share prices move more in a crisis than in calm years, so the variance of returns changes over time.
動盪時期。危機期間股價的波動比平穩年份大,所以回報的方差隨時間改變。
Averages over groups of different sizes. If each observation is an average, such as a district’s crime rate, larger groups give more precise averages.
對大小不一的群組取平均。如果每個觀測值都是平均數,例如一個地區的罪案率,較大的群組會得出較精確的平均數。
The last cause can be made exact. If district reports the average of independent individual errors, each with variance , then
最後一個成因可以準確寫出。如果地區 報告的是 個獨立個人誤差的平均 ,每個誤差的方差都是 ,那麼
The variance falls with the population of the district: heteroskedasticity by construction.
方差隨地區人口增加而下降:這是由構造本身產生的異方差。
What it does to OLS異方差對 OLS 的影響
Heteroskedasticity breaks only A4. A1–A3 still hold, so the Week 7 proof still goes through: OLS is still unbiased. What changes is its variance. With ,
異方差只違反 A4。A1–A3 仍然成立,所以第 7 週的證明依然有效:OLS 仍然無偏。改變的是它的方差。當 時,
which is not . This is called the sandwich form: is the filling between two slices of . Three consequences follow.
它不等於 。這稱為三文治形式: 是夾在兩片 之間的餡料。由此產生三個後果。
The usual standard errors are wrong. They estimate σ²(X′X)⁻¹, a formula that no longer applies. They can be too small or too large.
一般標準誤是錯的。它們估計的是 σ²(X′X)⁻¹,但這條公式已不再適用。它們可能偏小,也可能偏大。
The usual t and F tests are invalid. Their statistics no longer follow t and F distributions, even in large samples, so p-values and confidence intervals are off.
一般的 t 和 F 檢定無效。即使樣本很大,統計量也不再服從 t 和 F 分佈,所以 p 值和置信區間都不準確。
OLS is no longer BLUE. The Gauss–Markov proof used A4. A weighted least squares estimator that gives less weight to noisier observations is more precise.
OLS 不再是 BLUE。高斯-馬可夫定理的證明用到了 A4。給予雜訊較大的觀測值較少權重的加權最小二乘估計量會更精確。
Show every step 顯示完整推導
The sandwich. From Week 7, . With fixed given , the rule gives
三文治形式。由第 7 週,。給定 時 是固定的,用規則 得到
If , the middle collapses to and cancels one , giving back . Otherwise it does not.
如果 ,中間部分化簡為 ,並與一個 抵銷,便回到 。否則就不會。
Simple regression. With one regressor, the slope is . The are uncorrelated given , so the variance of the sum is the sum of the variances:
簡單回歸。只有一個解釋變數時,斜率是 。給定 ,各 互不相關,所以總和的方差等於各方差之和:
Which way is the usual formula wrong? The usual standard error estimates roughly , where is the average error variance. Subtract it from the true variance, using :
一般公式錯在哪個方向?一般標準誤大致估計的是 ,其中 是誤差方差的平均。利用 ,從真實方差中減去它:
The numerator is times the sample covariance between and . When the error variance is largest for observations far from , as with a fan that opens to the right, it is positive and the usual standard error is too small. Tests then reject too often.
分子是 與 的樣本協方差的 倍。當遠離 的觀測值誤差方差最大時(例如向右張開的扇形),它是正數,一般標準誤便偏小,檢定也會過於頻繁地拒絕。
Looking at the residuals觀察殘差
Example. The k401ksubs data come from a 1991 US survey. For the 2,017 people who live alone, regress net financial assets (nettfa, in thousands of dollars) on annual income (inc, thousands of dollars), age and age squared:
例子。k401ksubs 數據來自 1991 年美國的一項調查。以 2,017 名獨居人士為樣本,把淨金融資產(nettfa,千美元)對年收入(inc,千美元)、年齡和年齡平方做回歸:
Each extra $1,000 of income goes with $825 more in financial assets, holding age fixed. Before trusting the standard errors, look at the residuals. A plot against a regressor that might drive the variance is the quickest check:
在年齡不變時,收入每多 1,000 美元,金融資產多 825 美元。在相信標準誤之前,先看看殘差。把殘差對可能影響方差的解釋變數作圖,是最快的檢查方法:
Residuals from the wealth regression in Section 4, one dot per household. 2 residuals above 600 are off the chart; the largest is 1,116.
第 4 節財富回歸的殘差,每點代表一個住戶。有 2 個殘差超過 600,未能顯示;最大的是 1,116。
The residuals fan out. Below $20,000 of income they hardly leave the zero line; above $40,000 they spread widely. Grouping households by income makes the pattern numerical:
殘差呈扇形散開。收入低於 20,000 美元時,殘差幾乎貼著零線;高於 40,000 美元時則大幅分散。按收入把住戶分組,可以把這個規律量化:
| Income ($1,000s) 收入(千美元) | Households | Residual spread 殘差離散程度 |
|---|---|---|
| 10–20 | 643 | 16.4 |
| 20–30 | 628 | 25.6 |
| 30–40 | 366 | 62.5 |
| 40–50 | 178 | 78.5 |
| 50–75 | 147 | 52.9 |
| 75–150 | 55 | 93.9 |
The spread is the root mean squared residual within each band, in thousands of dollars.
離散程度是每組殘差的均方根,單位為千美元。
The spread is almost six times larger in the top band than in the bottom one. A plot is a good first look, but it cannot say whether a pattern is beyond chance, and with several regressors it is hard to see. For that we need a test.
最高收入組的離散程度接近最低組的六倍。作圖是很好的第一步,但它無法判斷規律是否超出隨機波動;解釋變數多時也難以看清。因此我們需要檢定。
The Breusch–Pagan testBreusch–Pagan 檢定
Under A3 the error has mean zero given the regressors, so its conditional variance is the conditional mean of its square:
在 A3 下,給定解釋變數時誤差均值為零,所以它的條件方差等於其平方的條件均值:
Homoskedasticity says this equals the constant . The Breusch–Pagan (BP) test lets it depend linearly on some variables , usually the regressors themselves,
同方差表示它等於常數 。Breusch–Pagan(BP)檢定容許它線性地取決於一些變數 (通常就是解釋變數本身),
and tests . We do not observe , but the squared OLS residuals stand in for it in large samples. The ’s can be any variables that might affect the variance, including some that are not in the model.
並檢定 。我們觀察不到 ,但在大樣本中可以用 OLS 殘差的平方 代替。 可以是任何可能影響方差的變數,包括不在模型中的變數。
Fit the model 估計模型
Run OLS and save the residuals .
進行 OLS 估計並保存殘差 。
Auxiliary regression 輔助回歸
Keep its .
記下它的 。
Test statistic 檢定統計量
Decide 作出結論
Reject homoskedasticity if BP exceeds the critical value, or equivalently if its p-value is below the significance level. Alternatively, use the usual F test that all slopes of the auxiliary regression are zero.
如果 BP 超過 的臨界值,或其 p 值低於顯著水平,便拒絕同方差。另一種做法是對輔助回歸的所有斜率等於零做一般的 F 檢定。
The logic is that of the overall F test in Week 4: if the ’s explain nothing about the size of the squared residuals, should be close to zero, and measures how far it is from zero on a scale that does not depend on under .
原理與第 4 週的整體 F 檢定相同:如果 完全不能解釋殘差平方的大小, 應該接近零; 則在 下以不受 影響的尺度量度它離零多遠。
Example. Regress the squared residuals of the wealth regression on income, age and age squared ():
例子。把財富回歸的殘差平方對收入、年齡和年齡平方回歸():
The p-value is 0.004, so we reject homoskedasticity at the 1% level. The F version gives on 3 and 2,013 degrees of freedom, with the same p-value to three decimals. Income drives the result: its coefficient in the auxiliary regression has , while the age terms are insignificant.
p 值為 0.004,所以在 1% 水平下拒絕同方差。F 版本得出 ,自由度為 3 和 2,013,p 值到小數點後三位相同。結果主要由收入帶動:它在輔助回歸中的係數 ,而年齡各項都不顯著。
The White testWhite 檢定
The BP test only looks for variance that is linear in the ’s. Hal White’s test keeps the same null, , but allows the variance to be any smooth function of the regressors. Its auxiliary regression adds the squares and cross products of the regressors. With three regressors:
BP 檢定只尋找與 成線性關係的方差。Hal White 的檢定保留相同的虛無假設 ,但容許方差是解釋變數的任何平滑函數。它的輔助回歸加入了解釋變數的平方和交叉乘積。有三個解釋變數時:
The statistic is again , compared with with as many degrees of freedom as there are slopes in the auxiliary regression: here, and in general. Duplicated terms are dropped and reduce the count.
統計量仍然是 ,與 分佈比較,自由度等於輔助回歸中斜率的數目:這裏是 ,一般為 。重複的項要剔除,自由度亦相應減少。
Example. In the wealth regression the regressors are income, age and age², so age × age duplicates age², which is already in the list. That leaves 8 distinct slopes: inc, age, age², inc², age⁴, inc·age, inc·age² and age³. The auxiliary is 0.01401, so
例子。財富回歸的解釋變數是收入、年齡和年齡平方,所以年齡 × 年齡與已在列表中的年齡平方重複。剩下 8 個不同的斜率:inc、age、age²、inc²、age⁴、inc·age、inc·age² 和 age³。輔助回歸的 是 0.01401,所以
with a p-value of 0.0004. White’s test also rejects homoskedasticity.
p 值為 0.0004。White 檢定同樣拒絕同方差。
A shorter version. With many regressors the full White regression uses up degrees of freedom fast: ten regressors need 65 slopes. A special case uses only the fitted values and their square:
簡化版本。解釋變數多時,完整的 White 輔助回歸很快便用盡自由度:十個解釋變數需要 65 個斜率。一個特殊情況只用擬合值及其平方:
and tests with . Since is a linear combination of the regressors, is a particular combination of all their squares and cross products, so two slopes stand in for the whole set. In the example, and
並以 檢定 。由於 是解釋變數的線性組合, 就是所有平方項和交叉乘積的一個特定組合,所以兩個斜率便可代表整組項目。在例子中,,而
Why ŷ² covers the squares and cross products 為甚麼 ŷ² 涵蓋了平方項和交叉乘積
Write the fitted value with three regressors and square it:
寫出有三個解釋變數時的擬合值,然後平方:
Every term of the full White regression appears, with weights fixed by the OLS estimates. The full test estimates nine free coefficients; the special case estimates two, on the levels and on this fixed mixture of squares and products. It loses some generality but keeps the degrees of freedom.
完整 White 回歸中的每一項都出現了,權重由 OLS 估計值固定。完整檢定估計九個自由係數;特殊情況只估計兩個:水平項的 ,以及這個平方和乘積的固定組合的 。它失去一些一般性,但保留了自由度。
Robust standard errors and t tests穩健標準誤與 t 檢定
Rejecting homoskedasticity does not mean abandoning OLS. The estimates are still unbiased; only their standard errors need repair. White’s idea is to estimate the sandwich directly, replacing each unknown σᵢ² by the squared residual of that observation. In the simple regression,
拒絕同方差並不代表要放棄 OLS。估計值仍然無偏,需要修正的只是標準誤。White 的想法是直接估計三文治形式,把每個未知的 σᵢ² 換成該觀測值的殘差平方。在簡單回歸中,
The first is the usual standard error; the second is the heteroskedasticity-robust (or White) standard error. In matrix form,
前者是一般標準誤,後者是異方差穩健(或 White)標準誤。以矩陣表示,
where is row of , and the robust standard errors are the square roots of its diagonal. One is a poor estimate of one , but that is not needed: the middle term is an average over observations, and that average converges to the right thing. So robust standard errors are justified in large samples, and the robust t statistic is only approximately .
其中 是 的第 行,穩健標準誤就是其對角元素的平方根。單一個 並不是 的好估計,但這並不需要:中間項是 個觀測值的平均,而這個平均會收斂到正確的值。所以穩健標準誤的理據建立在大樣本之上,穩健 t 統計量也只是近似服從 。
For the wealth regression:
財富回歸的結果:
| Estimate | Usual | Robust | |||
|---|---|---|---|---|---|
| se | se | ||||
| Intercept 截距 | −1.204 | 15.28 | −0.08 | 19.73 | −0.06 |
inc 收入 | 0.8248 | 0.0603 | 13.68 | 0.1039 | 7.94 |
age 年齡 | −1.322 | 0.7675 | −1.72 | 1.1055 | −1.20 |
age² 年齡平方 | 0.02556 | 0.00900 | 2.84 | 0.01415 | 1.81 |
Robust standard errors are HC1, the version in the lecture output and Stata’s default. The estimates are identical in both columns; only the standard errors change.
穩健標準誤採用 HC1,即課堂結果所用的版本,也是 Stata 的預設。兩欄的估計值完全相同,改變的只是標準誤。
Every robust standard error is larger, by 29% to 72%. The income effect remains overwhelming (). But age squared, significant at the 1% level with the usual standard error (), is not significant at 5% once heteroskedasticity is allowed for (). The evidence that wealth accelerates with age was partly an artefact of the wrong standard errors.
每個穩健標準誤都較大,增幅由 29% 至 72%。收入效應依然非常顯著()。但年齡平方用一般標準誤時在 1% 水平下顯著(),容許異方差後在 5% 水平下已不顯著()。「財富隨年齡加速增長」的證據,部分是錯誤標準誤造成的假象。
Show every step: the robust standard error 顯示完整推導:穩健標準誤
From Section 3, the true variance in simple regression is . Replace each by and take the square root:
由第 3 節,簡單回歸的真實方差是 。把每個 換成 ,再開方:
If the errors are homoskedastic, the weights are unrelated to , so , and the robust standard error is close to the usual one, . In the matrix form, estimates in the same way.
如果誤差同方差,權重 與 無關,所以 ,穩健標準誤便接近一般標準誤 。在矩陣形式中, 以同樣方式估計 。
Robust F tests穩健 F 檢定
The usual F test from Week 4 compares sums of squared residuals, which only works under homoskedasticity. The robust alternative tests , with a matrix of restrictions, directly from the estimates and their robust covariance matrix. It is called the heteroskedasticity-robust Wald statistic:
第 4 週的一般 F 檢定比較殘差平方和,只在同方差下有效。穩健的替代方法直接利用估計值及其穩健協方差矩陣,檢定 ,其中 是代表 個約束的 矩陣。它稱為異方差穩健 Wald 統計量:
measures how far the estimates are from the restrictions, and is the robust covariance matrix of that distance, so is a squared distance in units of its own standard errors. With one restriction it is the square of the robust t statistic. Software often reports as an F statistic.
量度估計值離約束有多遠, 是這段距離的穩健協方差矩陣,所以 是以自身標準誤為單位的平方距離。只有一個約束時,它就是穩健 t 統計量的平方。軟件通常把 作為 F 統計量報告。
Example. For the wealth regression, test that all three slopes are zero. The usual overall F is 93.99; the robust version is . For the joint significance of age and age², the usual F is 46.11 and the robust one 45.30. Every version rejects decisively (all p-values below ), but the overall F more than halves once the noisy high-income observations are given their due.
例子。在財富回歸中,檢定三個斜率全部為零。一般的整體 F 是 93.99;穩健版本是 。至於年齡和年齡平方的聯合顯著性,一般 F 是 46.11,穩健 F 是 45.30。所有版本都明確拒絕(p 值全部低於 ),但當雜訊大的高收入觀測值得到應有的考慮後,整體 F 減少了一半以上。
Usual or robust?用一般還是穩健標準誤?
If robust standard errors are valid whether or not the errors are homoskedastic, why not always use them? Many applied economists do. The trade-off is between two kinds of validity:
既然無論誤差是否同方差,穩健標準誤都有效,為甚麼不一直使用它們?很多應用經濟學家正是這樣做。取捨在於兩種有效性之間:
Usual standard errors give exact t and F distributions in any sample size, but only if A4 and normality (A5) hold.
一般標準誤在任何樣本大小下都給出準確的 t 和 F 分佈,但前提是 A4 和正態性(A5)成立。
Robust standard errors need neither, but are justified only as n grows. In small samples their tests can reject a true null too often.
穩健標準誤兩者都不需要,但只在 n 增大時才有理據。在小樣本中,它們的檢定可能會過於頻繁地拒絕正確的虛無假設。
The demo tests a true null hypothesis over and over. A valid 5% test should reject about 5% of the time. Start at γ = 1 and n = 200, then try the corners.
這個示範反覆檢定一個正確的虛無假設。一個有效的 5% 檢定應約有 5% 的時間拒絕。先從 γ = 1、n = 200 開始,再試試各個極端情況。
- Samples 樣本數
- 0
- True sd of β̂₁ β̂₁ 的真實標準差
- –
- Usual se, average 一般標準誤平均
- –
- Robust se, average 穩健標準誤平均
- –
- Usual t test rejects 一般 t 檢定拒絕
- –
- Robust t test rejects 穩健 t 檢定拒絕
- –
Each sample uses the incomes of the first households, sets , and draws normal errors with standard deviation . Both tests are of the true null at the 5% level, so a valid test rejects about 5% of the time. is homoskedastic.
每個樣本使用首 個住戶的收入,設 ,誤差服從正態分佈,標準差為 。兩個檢定都在 5% 水平下檢定真實的虛無假設 ,所以有效的檢定應約有 5% 的時間拒絕。 即同方差。
γ = 1, n = 200 or 2,017: the usual se is about half the true sd, and the usual test rejects the true null around 35–40% of the time. The robust se tracks the truth and its test rejects about 5–9%.
γ = 1,n = 200 或 2,017:一般標準誤只有真實標準差的一半左右,一般檢定拒絕正確虛無假設的比率約為 35–40%。穩健標準誤貼近真值,其檢定的拒絕率約為 5–9%。
γ = 0, n = 50: no heteroskedasticity. The usual test is exact at 5%; the robust one rejects about 11% of the time because its standard error is too small in a sample this size.
γ = 0,n = 50:沒有異方差。一般檢定準確地拒絕 5%;穩健檢定則約有 11% 的拒絕率,因為在這樣小的樣本中它的標準誤偏小。
γ = 1.5, n = 50: both fail, the usual test badly (about 60%) and the robust one less badly (about 29%). Small samples with strong heteroskedasticity have no easy fix.
γ = 1.5,n = 50:兩者都失效:一般檢定錯得很嚴重(約 60%),穩健檢定則較輕(約 29%)。強烈異方差加上小樣本,並沒有簡單的解決辦法。
In short: with a few hundred observations or more, report robust standard errors. In small samples, check for heteroskedasticity with BP or White first, and treat robust p-values near the cut-off with caution.
總括而言:有數百個或以上的觀測值時,應報告穩健標準誤。在小樣本中,先用 BP 或 White 檢定異方差,並對接近臨界值的穩健 p 值保持審慎。
Reproduce the results自己重現結果
The data come with the free wooldridge package. The R code computes the robust covariance matrix and the tests by hand, so you can see each formula at work; the sandwich and lmtest packages do the same in one line each. Both snippets reproduce every figure in Sections 4–8.
數據收錄在免費的 wooldridge 套件中。R 程式碼親手計算穩健協方差矩陣和各項檢定,讓你看到每條公式如何運作;sandwich 和 lmtest 套件各用一行便可完成同樣的工作。兩段程式碼都會重現第 4 至 8 節的所有數字。
library(wooldridge)
k401 <- subset(k401ksubs, fsize == 1) # 2,017 single-person households
m <- lm(nettfa ~ inc + age + I(age^2), data = k401)
summary(m) # usual standard errors
n <- nobs(m)
# Breusch-Pagan: regress squared residuals on the regressors
k401$e2 <- resid(m)^2
aux <- lm(e2 ~ inc + age + I(age^2), data = k401)
bp <- n * summary(aux)$r.squared
c(bp, pchisq(bp, 3, lower.tail = FALSE)) # LM = 13.49, p = 0.004
# White test: levels, squares and cross products (8 distinct terms)
white <- lm(e2 ~ (inc + age + I(age^2))^2 + I(inc^2) + I(age^4), data = k401)
n * summary(white)$r.squared # LM = 28.25
# Special White test with the fitted values
k401$yh <- fitted(m)
sw <- lm(e2 ~ yh + I(yh^2), data = k401)
n * summary(sw)$r.squared # LM = 15.65
# Robust (HC1) covariance matrix: the sandwich, by hand
X <- model.matrix(m); u <- resid(m); k <- ncol(X) - 1
bread <- solve(crossprod(X))
V <- bread %*% crossprod(X * u) %*% bread * n / (n - k - 1)
se <- sqrt(diag(V))
cbind(estimate = coef(m), robust_se = se, robust_t = coef(m) / se)
# robust se 19.73, 0.1039, 1.106, 0.01415
# Robust Wald tests of R b = 0, reported as F = W / q
wald <- function(R) {
Rb <- R %*% coef(m)
drop(t(Rb) %*% solve(R %*% V %*% t(R)) %*% Rb) / nrow(R)
}
wald(cbind(0, diag(3))) # all slopes: F = 40.12
wald(cbind(0, 0, diag(2))) # age terms: F = 45.30
# pip install wooldridge statsmodels
import statsmodels.formula.api as smf
from statsmodels.stats.diagnostic import het_breuschpagan, het_white
import wooldridge as wd
k401 = wd.data("401ksubs") # k401ksubs in R
k401 = k401[k401.fsize == 1].copy() # 2,017 single-person households
f = "nettfa ~ inc + age + I(age**2)"
m = smf.ols(f, data=k401).fit()
print(m.summary()) # usual standard errors
# Breusch-Pagan: regress squared residuals on the regressors
k401["e2"] = m.resid ** 2
aux = smf.ols("e2 ~ inc + age + I(age**2)", data=k401).fit()
print(len(k401) * aux.rsquared) # LM = 13.49
print(het_breuschpagan(m.resid, m.model.exog)) # LM, p-value, F, p-value
# White test: levels, squares and cross products (8 distinct terms)
print(het_white(m.resid, m.model.exog)[:2]) # LM = 28.25, p = 0.0004
# Special White test with the fitted values
k401["yh"] = m.fittedvalues
sw = smf.ols("e2 ~ yh + I(yh**2)", data=k401).fit()
print(len(k401) * sw.rsquared) # LM = 15.65
# Robust (HC1) standard errors, t tests and F (Wald) tests
r = smf.ols(f, data=k401).fit(cov_type="HC1")
print(r.summary()) # se 19.73, 0.1039, 1.106, 0.01415
print(r.f_test("inc = 0, age = 0, I(age ** 2) = 0")) # F = 40.12
print(r.f_test("age = 0, I(age ** 2) = 0")) # F = 45.30
In Python, het_breuschpagan() and het_white() give the same LM statistics, 13.49 and 28.25, with het_white() dropping the duplicated age term itself.
在 Python 中,het_breuschpagan() 和 het_white() 得出相同的 LM 統計量 13.49 和 28.25,het_white() 會自行剔除重複的年齡項。
Check your understanding自我測驗
-
A classmate finds heteroskedasticity and concludes that the OLS coefficients are biased. Is that right?
一位同學發現有異方差,便斷定 OLS 係數有偏誤。這對嗎?
Answer 答案
No. Unbiasedness needs only A1–A3, and heteroskedasticity violates A4. The coefficients are fine; their usual standard errors, t tests and F tests are not, and OLS is no longer the most efficient linear unbiased estimator.
不對。無偏性只需要 A1–A3,而異方差違反的是 A4。係數沒有問題;有問題的是它們的一般標準誤、t 檢定和 F 檢定,而且 OLS 不再是最有效的線性無偏估計量。
-
A BP test with variables on observations gives an auxiliary of 0.03. Do you reject homoskedasticity at 5%?
一個 、 的 BP 檢定,輔助回歸的 是 0.03。在 5% 水平下是否拒絕同方差?
Answer 答案
, above the critical value of 9.49, so yes.
,高於 的臨界值 9.49,所以拒絕。
-
How many slopes does the full White auxiliary regression have with k = 4 regressors, none of them powers of another? How many does the special version have?
有 k = 4 個解釋變數(沒有一個是另一個的冪)時,完整 White 輔助回歸有多少個斜率?特殊版本又有多少個?
Answer 答案
: four levels, four squares and six cross products. The special version always has two, and .
:四個水平項、四個平方項和六個交叉乘積。特殊版本永遠只有兩個: 和 。
-
In the wealth regression, would you conclude at the 5% level that wealth rises faster with age at older ages? Why do the usual and robust results differ?
在財富回歸中,你會否在 5% 水平下斷定財富在較高年齡時隨年齡增長得更快?為甚麼一般結果與穩健結果不同?
Answer 答案
No. That claim rests on the age² coefficient, whose robust t is 1.81 (p = 0.071). The usual t of 2.84 uses a standard error that is too small, because the error variance is largest for high-income households, which are also the ones that pull hardest on the coefficients.
不會。這個說法取決於年齡平方的係數,其穩健 t 值是 1.81(p = 0.071)。一般的 t 值 2.84 所用的標準誤偏小,因為高收入住戶的誤差方差最大,而他們對係數的影響也最大。
-
You have 40 observations and a BP test does not reject. Usual or robust standard errors?
你有 40 個觀測值,BP 檢定沒有拒絕。應該用一般還是穩健標準誤?
Answer 答案
With 40 observations the robust standard errors may be too small and their tests can over-reject, as the demo shows at n = 50. With no evidence of heteroskedasticity, the usual standard errors are the safer choice, preferably reported alongside the robust ones so readers can see whether the conclusions depend on the choice. Note that a BP test with 40 observations has little power, so not rejecting is weak evidence.
只有 40 個觀測值時,穩健標準誤可能偏小,其檢定可能過於頻繁地拒絕,正如示範在 n = 50 時所示。既然沒有異方差的證據,一般標準誤是較穩妥的選擇,最好同時報告穩健標準誤,讓讀者看到結論是否取決於這個選擇。留意 40 個觀測值的 BP 檢定檢定力很低,所以沒有拒絕只是很弱的證據。
Sources and acknowledgement 資料來源與鳴謝
- Lecture materials for Introductory Econometrics (ETC2410) by Associate Professor Didier Nibbering, Department of Econometrics and Business Statistics, Monash Business School.
- Jeffrey M. Wooldridge, Introductory Econometrics: A Modern Approach, Chapter 8.1–8.3.
- Data: k401ksubs (401ksubs in the Python package), single-person households, distributed with the textbook and in the wooldridge R package. All estimates on this page were computed from it.
Any errors are our own.