1# F2-smoke-01 — Slope estimate with firm-clustered uncertainty23## Question4Estimate 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.56## Data and exclusions7- Input: `data/panel.csv`, 2,000 rows read, columns `firm_id`, `x`, `y`. The data are synthetic.8- 50 firms with exactly 40 observations each (a balanced panel).9- 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.1011## Method12- Pooled OLS of y on x with an intercept (statsmodels).13- Naïve baseline: the conventional homoskedastic OLS standard error.14- 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).15- 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.16- The method is deterministic, so no random seed is used.1718## Results19| quantity | value |20|---|---|21| β̂ (slope) | 0.8051 |22| α̂ (intercept) | 1.4440 |23| SE, conventional OLS | 0.0241 |24| SE, clustered by firm | 0.0731 |25| 95% CI (clustered, t49) | [0.6581, 0.9521] |26| 95% CI (conventional OLS, for comparison only) | [0.7578, 0.8524] |27| N / clusters | 2000 / 50 |2829## Uncertainty30- 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.31- The conventional CI is therefore too narrow by a factor of about 3 and should not be used.32- Under the clustered interval, β is clearly positive and different from zero. Its plausible range is roughly 0.66–0.95.33- 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.3435## Limitations and open issues36- β is a linear-projection (associational) slope, not a causal effect.37- 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.38- 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.39- The data are synthetic, so the results say nothing about any real population.40