Programming lesson
Econometrics II Homework 3 Spring 2025: Frisch-Waugh, Bivariate Normal, and OLS Dummy Variables
A comprehensive tutorial covering the Frisch-Waugh theorem, bivariate normal conditional density derivation, OLS estimation with quarterly dummy variables, and matrix operations in Matlab, including residual maker eigenvalues and square root of covariance matrix.
Understanding the Frisch-Waugh-Lovell Theorem with a Modern Twist
The Frisch-Waugh-Lovell (FWL) theorem is a cornerstone of econometrics, allowing you to isolate the effect of one regressor by partialling out others. In your homework, you are given a regression with two regressors (demeaned) where the fitted value is Ŷ = X1 + 4X2. You then consider the regression Y = γ1 X1 + γ2 M1X2 + error, where M1 is the residual maker from regressing on X1. If P1X2 = 1.5X1, what are γ1 and γ2?
Think of this like using a noise-canceling algorithm in a popular AI app: you remove the influence of X1 from X2 to see the pure effect of X2. The FWL theorem states that γ2 from the regression on M1X2 equals the coefficient on X2 in the original multiple regression, which is 4. For γ1, because X1 is included directly, the estimate is the same as in the original regression: 1. But careful: the presence of M1X2 does not affect γ1 because M1X2 is orthogonal to X1 by construction. So γ1 = 1 and γ2 = 4.
Deriving the Conditional Density of a Bivariate Normal Distribution
For a bivariate normal distribution, the conditional density f(X2|X1) is normal with mean μ2 + (σ12/σ11)(X1 - μ1) and variance σ22 - σ12^2/σ11. This is analogous to predicting a student's final exam score based on their midterm performance—a common scenario in school life. The derivation uses the joint density formula and completes the square in the exponent. In your homework, you must show this step-by-step, assuming all OLS assumptions including normality of errors. The key is to express the joint density and then condition on X1.
OLS with Quarterly Dummy Variables: A Practical Example
Consider a regression with quarterly dummies: D1t = 1 in Q2, D2t = 1 in Q3, D3t = 1 in Q4. Given overall mean ȳ = 5 and quarterly means ȳ2=4, ȳ3=2, ȳ4=0, and x̄=0 with xt orthogonal to all dummies, find OLS estimates β̂0, β̂1, β̂2, β̂3. The model is Yt = β0 + β1 D1t + β2 D2t + β3 D3t + β4 xt + error. Because xt is orthogonal to dummies and has mean zero, β̂4 is simply the coefficient from regressing Y on xt after partialling out dummies, but since dummies are orthogonal to xt, it's just the regression of Y on xt. However, we need the intercept and dummy coefficients. The intercept β0 is the mean of the base quarter (Q1). Since overall mean is 5 and the quarterly means are given, we can compute: β0 = ȳ1. With four quarters, ȳ = (ȳ1+ȳ2+ȳ3+ȳ4)/4. So 5 = (ȳ1+4+2+0)/4 => ȳ1 = 14. Thus β̂0 = 14. Then β̂1 = ȳ2 - ȳ1 = 4-14 = -10, β̂2 = 2-14 = -12, β̂3 = 0-14 = -14. The coefficient on xt is not determined by given means but would be estimated from data.
Matrix Operations in Matlab: Residual Maker, Eigenvalues, and Square Root
In the computer question, you regress consumption growth on income growth and interest rate. Using Matlab, calculate the residual maker M = I - X(X'X)^{-1}X'. Then compute eigenvalues and eigenvectors of M. Since M is idempotent, its eigenvalues are 0 or 1. The eigenvectors form an orthonormal basis. Next, generate matrix C of eigenvectors and diagonal matrix Λ of eigenvalues, and verify CΛC' = M. This is like decomposing a covariance matrix in portfolio optimization—a common task in finance apps.
For part 4, generate two standard normal vectors e1, e2 of length 100. Set X1 = e1, X2 = e1 + e2. The variance-covariance matrix Σ of X = (X1, X2) is [[1, 1], [1, 2]]. Find its square root Σ^{1/2} using Matlab's sqrtm function. Then compute Y = Σ^{-1/2} X and verify that covariance of Y1 and Y2 is near zero. This is akin to whitening data for machine learning, a popular technique in AI.
Connecting to Current Trends: Why This Matters
Understanding these econometric tools is crucial for data science roles in tech companies. For instance, the FWL theorem is used in causal inference for A/B testing, a staple in app development. The bivariate normal appears in risk assessment models for fintech apps. And matrix decompositions are fundamental to neural network implementations. By mastering these concepts, you'll be equipped to tackle real-world problems in finance, AI, and beyond.
Key Takeaways for Your Homework
- Frisch-Waugh: γ1 is unchanged, γ2 equals original coefficient.
- Conditional density: Derive by completing the square in the joint normal exponent.
- Dummy variables: Coefficients represent differences from base quarter mean.
- Matlab: Use eig for eigenvalues, sqrtm for matrix square root.
Remember to check your results against the given data. Good luck with your homework!