📘 ECON 320 Lab Problem Set 4¶

  • Name : [Your Name]

  • Lab Section: [Your Lab Section Here]

Please submit the exercise on Canvas in form of a HTML/PDF file.¶


🎯 Learning Objectives¶

By the end of this assignment, you should be able to:

  • Run a baseline OLS and read a two-sided $p$-value for a target coefficient.
  • Refit with HC0 robust standard errors and obtain the two-sided $p$-value.
  • Compare the two results and explain any difference using heteroskedasticity (non-constant spread).

📝 Grading (Total = 10 points)¶

  • Q1: Baseline OLS (classical SEs) — 2 pts
  • Q2: Robust OLS (HC0 SEs) — 4 pts
  • Q3: Compare & explain — 4 pts

🔧 Setup¶

⚠️ Please run the cells in this section before starting the problem set!!¶

📦 Import required libraries¶
In [ ]:
!pip install -q wooldridge statsmodels numpy pandas 

import numpy as np, pandas as pd
import statsmodels.api as sm
from wooldridge import data as wooldridge

np.random.seed(320)
pd.set_option("display.float_format", lambda v: f"{v:,.4f}")

📥 Load the dataset (hprice1) — prices in levels (often heteroskedastic)¶
In [ ]:
# Wooldridge hprice1 (house price cross-section)
df = wooldridge('hprice1').copy()

# Keep needed columns 
use_cols = ['price', 'lotsize', 'bdrms']
df = df[use_cols].dropna().copy()

# Rename to match your wording
df = df.rename(columns={'bdrms': 'bedrooms'})

# Quick peek
df.head()

❓ Q1 — Baseline OLS (classical SEs) — [2 pts]¶

Outcome: price (levels). Predictors: lotsize(focus), bedrooms.

Report for lotsize: the coefficient and two-sided $p$-value (classical).

In [ ]:
# Put your code here

Enter your numbers:

  • $\hat\beta_{\text{lotsize}} =$ ...
  • two-sided $p$-value (classical) = ...

❓ Q2 — Robust OLS (HC0 SEs) — [4 pts]¶

Refit the same regression with HC0 robust SEs (White/Huber/Eicker).
Report for lotsize: the coefficient and two-sided $p$-value.

In [ ]:
# Put your code here

Enter your numbers:

  • $\hat\beta_{\text{lotsize}}$ (robust) = ...
  • two-sided $p$-value (HC0, z) = ...

❓ Q3 — Compare & explain — [4 pts]¶

In 2–4 sentences, compare the lotsize coefficient and p‑value from classical vs HC0. Is the difference surprising? Explain using class terms (hint: non‑constant spread can change standard errors, not coefficients).

Your answer (2–4 sentences):


End of Problem Set.