SPB Git

spb/wp29_uqo

Public

# F2-smoke-01 — Slope estimate with firm-clustered uncertainty

# Question

Estimate the population slope β in the linear projection y = α + βx + ε for a synthetic firm panel. The standard error must allow for errors that are correlated within a firm and independent across firms.

# Data and exclusions

  • Input: data/panel.csv (synthetic). 2000 rows read; 50 firms, each with exactly 40 observations.
  • Checks: no missing values, no non-finite values, no exact duplicate rows. Nothing was excluded, so all 2000 observations were analysed. data_issues is empty.

# Method

  • Pooled OLS of y on x with an intercept (statsmodels).
  • Naïve baseline: conventional homoskedastic OLS standard error.
  • Main inference: cluster-robust (Liang–Zeger / CR1) variance clustered by firm_id, using the standard small-sample correction G/(G−1)·(N−1)/(N−K).
  • 95% CI: β̂ ± t(0.975, G−1)·SE_cluster with G−1 = 49 degrees of freedom (t = 2.0096). This is a common conservative choice when there are few clusters.
  • The procedure is deterministic, so no random seed is needed. out/analysis.py regenerates out/results.json.

# Results

quantity value
β̂ (slope) 0.8051
α̂ (intercept) 1.4440
SE, OLS (naïve) 0.0241
SE, clustered by firm 0.0731
95% CI (clustered) [0.6581, 0.9521]
N / clusters 2000 / 50

# Uncertainty

The firm-clustered SE is about 3.03 times the naïve OLS SE. This means x and the residuals are both strongly correlated within firms. The naïve SE therefore greatly overstates precision: its implied interval would be roughly a third as wide. Even with the clustered SE, the interval excludes 0 by a wide margin.

# Limitations and open issues

  • With 50 equal-sized clusters, CR1 with t(G−1) critical values should be reasonably reliable. Still, cluster-robust inference is asymptotic in G. A wild cluster bootstrap was not run.
  • β is a linear-projection (association) coefficient, not a causal effect. Pooled OLS mixes within-firm and between-firm variation in x. A firm fixed-effects slope could differ but was not the estimand asked for.
  • The data are synthetic, so the conclusions describe only this dataset.
Files · main
Menu

Theme