SPB Git

spb/wp29_uqo

Public

# F2-dev-01 — Two-way fixed-effects slope in a firm–year panel with firm-clustered uncertainty

# Scientific question

Estimate the within-firm, within-year association between an outcome y and a regressor x in a balanced panel of firms observed over several years. The estimand is the slope β in the two-way fixed-effects model y_it = a_i + g_t + β x_it + u_it, where a_i is a firm effect and g_t is a year effect (both unrestricted, possibly correlated with x). Its sampling uncertainty must allow for arbitrary dependence of the disturbances within a firm over time (observations are independent across firms, not within firms).

# Inputs

  • data/firm_panel.csv — simulated data (a synthetic dataset generated for this exercise; it is not observed data). Columns: firm_id (integer firm identifier), year (integer calendar year), x (regressor, dimensionless), y (outcome, dimensionless). One row per firm–year; rows are in random order.

# Information-availability rules

  • Use only data/firm_panel.csv. No other input exists.

# Required outputs

  • out/results.json with the keys:
key type unit meaning
task_id string – "F2-dev-01"
beta_pooled number – pooled OLS slope of y on x with an intercept and no fixed effects — the naïve baseline
beta_fe number – two-way fixed-effects (firm + year) estimate of β
se_conventional number – conventional (homoskedastic, independent errors) standard error of beta_fe
se_cluster number – standard error of beta_fe clustered by firm_id
beta_ci_low, beta_ci_high number – 95% confidence interval for β built from se_cluster
n_firms integer – number of distinct firms used
n_years integer – number of distinct years used
n_analysed integer – firm–year observations used in the fixed-effects estimate
feasibility string – "complete", "partial" or "infeasible"
feasibility_reason string or null – explanation if not complete
data_issues array of {"issue","handling"} – data problems detected and how handled (empty list if none)
n_input_rows object – {"firm_panel.csv": rows read}
random_seed integer or null – seed used, if any
  • out/report.md with the sections: Question; Data and exclusions; Method; Results; Uncertainty; Limitations and open issues.
  • out/analysis.py — running ~/wp29/venv/bin/python out/analysis.py from the workspace root must regenerate out/results.json from data/ only, deterministically.
  • out/claims.json — a list of the central claims of the report: [{"id": "C1", "text": "...", "results_keys": ["..."], "status": "supported"|"unsupported"|"not_evaluated", "caveat": "..."}].

# Constraints

  • No network access. Python: ~/wp29/venv/bin/python (numpy, pandas, scipy, statsmodels available). Do not modify data/.
  • This task is designed to be completed in well under 15 minutes of work.
Files · main
Menu

Theme