F2-smoke-01 — Slope of y on x with firm-clustered uncertainty
Question
What is the population linear-projection slope β in y = α + βx + ε for a synthetic panel of firms? The standard error has to allow for a shared firm-level shock, meaning observations are independent across firms but not within a firm. β is a descriptive projection coefficient, not a causal effect.
Data and exclusions
- Input:
data/panel.csv(simulated). Rows read: 2000 (n_input_rows). SHA-256968410b9…5ce5a8(input_sha256). - No values are missing, no values are non-finite and no rows are exact duplicates. There are 50 firms with exactly 40 observations each (
n_clusters,obs_per_cluster_min,obs_per_cluster_max). - No rows were excluded (
out/exclusions.csv). Observations analysed: 2000 (n_analysed). No data issues were found (data_issues= []).
Method
- OLS of y on a constant and x (statsmodels).
- Baseline: the conventional homoskedastic OLS standard error (
se_ols) and its 95% t-interval (baseline_ci_ols_low,baseline_ci_ols_high). - Main uncertainty measure: a cluster-robust (CR1) sandwich standard error clustered by
firm_id, using the small-sample factor G/(G−1)·(N−1)/(N−K) (se_cluster). The script cross-checks it against a manual sandwich computation. - 95% CI = beta_hat ± t₀.₉₇₅(G−1)·se_cluster, with G−1 = 49 degrees of freedom (
cluster_df) and critical valuet_crit_cluster_df= 2.0096. - The analysis is deterministic and uses no randomness (
random_seed= null).
Results
- Slope
beta_hat= 0.8051; interceptalpha_hat= 1.4440. - 95% cluster-robust CI for β: [0.6581, 0.9521] (
beta_ci_low,beta_ci_high). - Status:
feasibility= "complete".
Uncertainty
- Naive OLS SE
se_ols= 0.0241. Firm-clustered SEse_cluster= 0.0731. - The ratio
se_ratio_cluster_to_olsis 3.03, so the naive SE understates sampling uncertainty by a factor of about 3. As a result, the naive interval [0.7578, 0.8524] (baseline_ci_ols_low,baseline_ci_ols_high) is far too narrow. This pattern fits a model in which both x and the error share firm-level components. - Both intervals exclude zero.
Limitations and open issues
- Cluster-robust inference is asymptotic in the number of clusters. With G = 50 balanced clusters the CR1 + t(G−1) approach is usually adequate, but its coverage is not guaranteed. A wild cluster bootstrap was not run because the task does not require it.
- β is a linear projection coefficient. It carries no causal interpretation, and firm fixed effects were deliberately not included, because they would change the estimand to a within-firm slope.
- The data are synthetic. The conclusions describe this sample only.