SPB Git

spb/wp29_uqo

Public
2.7 KB · 41 lines markdown
1# F2-dev-01 — Two-way FE slope with firm-clustered uncertainty23## Question4Estimate β in y_it = a_i + g_t + β x_it + u_it (firm and year fixed effects), with standard errors that allow arbitrary within-firm dependence over time. The data are simulated (synthetic).56## Data and exclusions7`data/firm_panel.csv`: 1200 rows read. 100 firms (IDs 1001–1100) × 12 years (2008–2019), one row per firm–year. I checked for missing values, duplicated firm–year keys, imbalance, and firms with no within-firm variation in x. None of these problems turned up, so no rows were excluded (`data_issues` = []). All 1200 observations are used.89## Method10- Baseline: pooled OLS of y on x with an intercept.11- Two-way FE: OLS of y on x plus firm and year dummies (LSDV), which is numerically identical to the two-way within estimator in a balanced panel. Residual df = 1200 − 1 − 99 − 11 − 1 = 1088.12- Conventional SE: the homoskedastic OLS SE from the LSDV fit (df = 1088).13- Clustered SE: the CR1 sandwich estimator clustered by `firm_id` (100 clusters). It uses the statsmodels small-sample factor G/(G−1)·(N−1)/(N−K), where K counts all dummies (like Stata `areg`/`reg … i.firm, vce(cluster firm)`).14- 95% CI: β̂ ± t_{0.975, G−1} · se_cluster, with G−1 = 99 df (t = 1.984).15- No randomness is involved (`random_seed` = null).1617## Results18| quantity | value |19|---|---|20| pooled OLS slope | 1.2684 |21| two-way FE β̂ | 0.6045 |22| conventional SE | 0.0326 |23| firm-clustered SE | 0.0471 |24| 95% CI (clustered) | [0.5111, 0.6978] |2526The pooled slope is about twice the FE slope. This means x is correlated with the firm and/or year effects, so the naïve estimate is biased upward relative to the within-firm, within-year association.2728## Uncertainty29The clustered SE is about 1.44 times the conventional SE. This suggests positive within-firm dependence in the residuals and/or x over time, which the conventional SE ignores. The result changes little under other small-sample conventions (see `sensitivity` in results.json):30- clustered SE with no finite-sample correction: 0.0446;31- clustered SE with K excluding the absorbed fixed effects (Stata `xtreg, fe` style): 0.0448;32- normal-critical-value CI: [0.5122, 0.6967].3334I report the most conservative variant (0.0471) as `se_cluster`.3536## Limitations and open issues37- β is a within-firm, within-year association. It is not a causal effect unless x is strictly exogenous given the fixed effects.38- Inference relies on asymptotics in the number of firms. G = 100 is moderate, so it should be adequate.39- The choice of finite-sample correction for the clustered SE is a convention. The alternatives differ by about 5%.40- These are synthetic data. The conclusions apply only to this dataset.41
Files · 452964ee0fbbaa40fbbed2c87a54ca798ffd6a85
Menu

Theme