SPB Git

spb/wp29_uqo

Public

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

# Question

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

# Data and exclusions

  • Input: data/panel.csv, 2,000 rows read, columns firm_id, x, y. The data are synthetic.
  • 50 firms with exactly 40 observations each (a balanced panel).
  • Checks run: missing values (none), non-finite values (none), exact duplicate rows (none). No rows were excluded, so n_analysed = 2,000. data_issues is empty.

# Method

  • Pooled OLS of y on x with an intercept (statsmodels).
  • Naïve baseline: the conventional homoskedastic OLS standard error.
  • Main inference: a cluster-robust (Liang–Zeger sandwich) standard error clustered by firm_id. It uses the standard CR1 small-sample correction G/(G−1)·(N−1)/(N−K).
  • 95% CI: β̂ ± t(0.975, G−1 = 49) × SE_cluster. With G = 50 clusters, the t reference with G−1 degrees of freedom is the usual conservative choice. The normal-based interval is also given in results.json as a supplement and is nearly identical.
  • The method is deterministic, so no random seed is used.

# Results

quantity value
β̂ (slope) 0.8051
α̂ (intercept) 1.4440
SE, conventional OLS 0.0241
SE, clustered by firm 0.0731
95% CI (clustered, t49) [0.6581, 0.9521]
95% CI (conventional OLS, for comparison only) [0.7578, 0.8524]
N / clusters 2000 / 50

# Uncertainty

  • The clustered SE is about 3.0 times the conventional SE. This fits the descriptive picture: firm means account for a large share of the variance of both x and y (variance of firm means is about 0.79 against 1.76 total for x, and 1.62 against 3.18 for y). That pattern is what produces strong within-firm error correlation.
  • The conventional CI is therefore too narrow by a factor of about 3 and should not be used.
  • Under the clustered interval, β is clearly positive and different from zero. Its plausible range is roughly 0.66–0.95.
  • Asymptotic validity depends on the number of clusters (50), not on N = 2,000. Fifty equal-sized clusters is generally enough for CR1 with a t(G−1) reference.

# Limitations and open issues

  • β is a linear-projection (associational) slope, not a causal effect.
  • Firm-level shocks can be correlated with x; the large share of between-firm variance in x suggests they may be. In that case the pooled slope mixes within-firm and between-firm variation and differs from a within-firm (fixed-effects) slope. The task asks for the pooled projection slope, so no fixed-effects estimate is reported.
  • I did not use a wild cluster bootstrap. With 50 balanced clusters, CR1 with t(49) should be adequate, but this was not checked by simulation.
  • The data are synthetic, so the results say nothing about any real population.
Files · main
Menu

Theme