Write concise lecture notes on linear regression: assumptions, estimation, diagnostics, interpretation, extensions, and common pitfalls. Include derivations, examples, and short exercises with solutions.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
The user wants comprehensive lecture notes on linear regression. This is a substantial request that needs to cover:
Assumptions
Estimation
Diagnostics
Interpretation
Extensions
Common pitfalls
Plus derivations, examples, and exercises with solutions.
Let me structure this properly as lecture notes. I'll be concise but thorough, including the mathematical rigor expected in a statistics/econometrics course.
Can shrink coefficients exactly to zero (variable selection)
No closed-form solution
Elastic Net: Combines Ridge and LASSO penalties.
8.5 Polynomial and Spline Regression
Polynomial regression:Y=β0+β1X+
Still linear in parameters; estimates via OLS.
Spline regression: Piecewise polynomials with smooth connections at knots.
9. Common Pitfalls
9.1 Omitted Variable Bias
True model: Y=β0+β1X
Estimated model: Y=γ0+γ1X1
Bias formula:E[γ^1]=β
where δX2,X1 is the coefficient from regressing on .
Direction of bias:
Sign of β2
Sign of Corr(X1,X
9.2 Reverse Causality
If Y also affects X, then X is endogenous:
Cov(X,ε)=
OLS is biased and inconsistent. Solutions: instrumental variables, panel data methods.
9.3 Measurement Error
Error in the dependent variable:Yi∗=Yi+u
If ui is independent of everything, OLS remains unbiased but less efficient.
Error in an independent variable:Xi∗=Xi+v
OLS is biased toward zero (attenuation bias):
plim(β^1)=β
9.4 Sample Selection Bias
If observations are not randomly selected (e.g., only observe Y when Y>0), OLS is biased.
Solution: Heckman selection model (two-stage procedure).
9.5 Extrapolation
Predictions outside the range of observed data are unreliable. Model validity doesn't extend beyond training data range.
9.6 Ecological Fallacy
Relationships observed at aggregate level may not hold at individual level.
9.7 Simpson's Paradox
A trend that appears in several groups may reverse when groups are combined, often due to a lurking confounding variable.
10. Worked Example
Data: Study of factors affecting house prices (n = 100 houses)
Variable
Description
PRICE
Sale price (thousands $)
SQFT
Square footage
BEDS
Number of bedrooms
POOL
Has pool (1 = Yes, 0 = No)
Estimated Model:PRICE=25.3+0.085⋅SQFT+8.2⋅BEDS
Variable
Coefficient
SE
t-statistic
p-value
Intercept
25.3
12.4
2.04
0.044
SQFT
0.085
0.012
7.08
<0.001
BEDS
8.2
3.1
2.65
0.009
POOL
15.7
5.8
2.71
0.008
R2=0.72, Rˉ2=0.71, , (p < 0.001)
Interpretation:
Each additional square foot adds $85 to price, holding other variables constant
Each additional bedroom adds $8,200 to price, holding other variables constant
Houses with pools sell for $15,700 more on average, holding other variables constant
The model explains 72% of variation in house prices
All coefficients are significantly different from zero at α = 0.05
95% CI for POOL coefficient:15.7±1.985×5.8=[4.19,27.21]
11. Exercises
Exercise 1: OLS Derivation
For simple linear regression Yi=β0+β1, derive the OLS estimators and by minimizing .
Minimize S=∑i=1n(Yi−
FOC with respect to β0:∂β
FOC with respect to β1:∂β
Substituting β0=Yˉ−β1:
⇒β^1
Exercise 2: Variance of OLS
Show that for simple linear regression, Var(β^1)=.
Write β^1 as a linear combination of Yi:
where ci=∑
Since Yi are independent with variance σ2:
Exercise 3: Omitted Variable Bias
Suppose the true model is Y=2+3X1+4X2+. You estimate . Given that the regression of on yields a coefficient of 0.5, what is ?
Using the omitted variable bias formula:
E[γ^1]=β
where:
β1=3 (true coefficient on X1)
(true coefficient on )
E[γ^1]=3+4×0.5
The OLS estimator is biased upward by 2 units because X2 is positively correlated with both Y (through β2>0) and (through ).
Exercise 4: Hypothesis Testing
From a regression with n = 50 and k = 3, you obtain β^2=2.5 with SE(.
(a) Test H0:β2=0 vs H at α = 0.05.
(b) Construct a 95% confidence interval for β2.
(c) Test H0:β2=2 vs H at α = 0.05.
Degrees of freedom: n−k−1=50−3−1=46
Critical value: t0.025,46≈2.013
(a) Test statistic:
t=0.82.5−0=3.125
Since ∣3.125∣>2.013, reject H0. The coefficient is statistically significant.
(b) 95% CI:
2.5±2.013×0.8=2.5±1.61=[0.89,4.11]
(c) Test statistic:
t=0.82.5−2=0.625
Since ∣0.625∣<2.013, fail to reject H0. Cannot conclude β2.
Note: This is consistent with (b)—2 is within the 95% CI.
Exercise 5: Interpretation
Interpret the coefficients in the following estimated model:
ln(WAGE)=1.2+0.08⋅EDUC+0.02⋅EXPER−0.15⋅
where WAGE is hourly wage, EDUC is years of education, EXPER is years of experience, and FEMALE = 1 for women.
Since the dependent variable is in logs:
EDUC (0.08): Each additional year of education is associated with approximately an 8% increase in wages, holding experience and gender constant.
More precisely: e0.08−1=0.0833, or 8.33% increase.
EXPER (0.02): Each additional year of experience is associated with approximately a 2% increase in wages, holding education and gender constant.
FEMALE (−0.15): Women earn approximately 15% less than men, holding education and experience constant.
More precisely: e−0.15−1=−0.139, or 13.9% less.
Intercept (1.2): When EDUC = 0, EXPER = 0, and FEMALE = 0 (a man with no education or experience), the predicted log-wage is 1.2, meaning predicted wage is e^{1.2} \approx \3.32$/hour.
Exercise 6: Multicollinearity
A researcher estimates a model with three predictors and obtains the following VIF values: VIF₁ = 1.2, VIF₂ = 8.5, VIF₃ = 12.3.
(a) Which variables have multicollinearity problems?
(b) If the R2 from regressing X3 on X1 and were available, what would its value be?
(c) What are potential remedies?
(a) Using the rule of thumb VIF > 5 or VIF > 10:
X1: VIF = 1.2 — No problem
X2: VIF = 8.5 — Moderate multicollinearity
X: VIF = 12.3 — Serious multicollinearity
(b)VIF3=1−R32
12.3=1−R321
So 91.9% of the variation in X3 is explained by X1 and X.
(c) Potential remedies:
Remove one of the collinear variables (if theoretically justified)
Combine collinear variables into an index/composite
Use ridge regression or LASSO
Collect more data (helps but doesn't eliminate the issue)
Accept wider confidence intervals if coefficient estimates remain stable
Exercise 7: Model Comparison
Two models are estimated on the same dataset (n = 200):
Model
Variables
R2
Rˉ2
AIC
A
Which model would you prefer and why?
Comparing metrics:
R2: Model B is higher (0.67 vs 0.65), but R2 always increases with more variables, so this comparison is not fair.
Rˉ: Model B is higher (0.660 vs 0.645). This accounts for the number of parameters, suggesting the additional variables improve fit even after penalizing for complexity.
Conclusion: Model B is preferred by both adjusted R2 and AIC. The additional variables X3 and X4 appear to genuinely improve the model.
However, one should also consider:
Theoretical justification for including X3 and X4
Statistical significance of the additional coefficients
Potential multicollinearity
Predictive performance on held-out data
Exercise 8: Diagnostics
Examine these diagnostic plots and identify potential problems:
Plot A: Residuals vs. fitted values shows a U-shaped pattern.
Plot B: Residuals vs. fitted values shows a fan shape (wider spread for larger fitted values).
Plot C: Q-Q plot shows residuals deviating from the line at both tails.
Plot A (U-shaped pattern):
Problem: Non-linearity. The linear model is misspecified.
Solution: Add polynomial terms (e.g., X2), use a different functional form (log, square root), or add omitted variables.
Plot B (Fan shape):
Problem: Heteroskedasticity. Variance increases with fitted values.
Solution:
Use robust (heteroskedasticity-consistent) standard errors
Transform the dependent variable (e.g., log)
Use weighted least squares
Model the variance explicitly (GARCH, etc.)
Plot C (Deviations at tails):
Problem: Non-normality. Specifically, this pattern suggests heavier tails than normal (leptokurtic distribution).
Impact:
OLS estimates remain unbiased and consistent
t-tests and F-tests may be unreliable in small samples
Solution:
With large n, rely on asymptotic normality (CLT)
Use bootstrap inference
Consider robust regression methods
12. Quick Reference Card
Key Formulas
Item
Formula
OLS estimator
β^=(X′X)
Assumption Violations and Consequences
Violation
OLS Unbiased?
OLS BLUE?
Valid Inference?
Omitted variable
✗
✗
✗
Heteroskedasticity
✓
✗
✗
Autocorrelation
✓
✗
✗
Non-normality
✓
✓
✗ (small n)
Multicollinearity
✓
✓
✓ (but imprecise)
Measurement error (X)
✗
✗
✗
References for Further Study
Wooldridge, J.M. Introductory Econometrics: A Modern Approach