SPB Git

spb/wp29_uqo

Public

# F1-dev-01 — Analytic firm dataset and revenue aggregates

# Question

Build a documented, analysis-ready version of the synthetic firm cross-section data/firms.csv and report: the number of distinct firms, the mean and median revenue in millions of USD over firms with known revenue, and the mean head count over all distinct firms.

# Data and exclusions

data/firms.csv (simulated data; SHA-256 78f119a9…625a) has 445 data rows (n_input_rows) and 5 columns. The audit (out/state/data_audit.md) found three issues, all listed in data_issues:

  1. Exact duplicate rows: 45 rows are identical on all columns to another row. After removing them, every firm_id occurs once, so there were no conflicting records. Distinct firms: 400 (n_unique_firms).
  2. Mixed revenue units: 60 distinct firms report revenue in USD_thousands; the rest are in USD_millions. All values were converted to millions USD. After conversion both groups are on similar scales (median ≈ 132 vs ≈ 177 MUSD), which suggests the unit labels are correct.
  3. Unknown revenue: 6 distinct firms have an empty revenue cell (n_missing_revenue): F0048, F0121, F0129, F0269, F0348, F0399. F0399's two rows are duplicates and both are empty.

Exclusion ledger (out/exclusions.csv): 445 → (drop 45 exact duplicates) → 400 → (unit recoding, 0 removed) → 400 → (drop 6 firms with missing revenue) → 394 = n_analysed. out/analytic.csv has 394 rows, one per firm.

# Method

Everything is done by out/analysis.py, which reads only data/firms.csv and is deterministic; no randomness is used (random_seed = null).

  • Baseline: the mean of the raw revenue column over the non-empty rows, with no cleaning (mean_revenue_raw).
  • Exact duplicates are dropped, keeping the first occurrence. The script asserts that no conflicting duplicate firm_ids remain.
  • revenue_musd = revenue / 1000 when unit == USD_thousands, otherwise revenue. The script asserts that no other unit label is present.
  • mean_employees is computed over all 400 distinct firms, including the 6 with unknown revenue, as the task specifies.
  • Revenue mean and median are computed over the 394 firms with known revenue. No outliers were removed: revenue (5.7–2057.6 MUSD) and revenue per employee showed no implausible values.

# Results

  • Distinct firms: 400 (n_unique_firms). Firms with unknown revenue: 6 (n_missing_revenue). Firms analysed: 394 (n_analysed).
  • Mean revenue: 249.96 million USD (mean_revenue_musd). Median revenue: 162.31 million USD (median_revenue_musd). The mean is above the median, so the distribution is right-skewed.
  • Mean head count over all distinct firms: 1101.4 employees (mean_employees).
  • Baseline: the raw, uncleaned mean is 30,695.88 in mixed units (mean_revenue_raw). The thousands-unit rows inflate it by about two orders of magnitude, so it is not a valid estimate of mean revenue. This shows why unit harmonisation is needed.
  • Feasibility: complete (feasibility).

# Uncertainty

The estimands describe the file itself, so they are computed exactly and have no sampling error for this dataset. For context only, if the 394 firms were treated as a random sample, the standard deviation of revenue would be 274.30 MUSD (sd_revenue_musd) and the standard error of the mean 13.82 MUSD (se_mean_revenue_musd). These are supplementary keys, not required estimands. The main non-sampling uncertainty is the assumption that the unit labels are correct and that the missing revenues are not systematically different from the others.

# Limitations and open issues

  • The data are simulated (synthetic), so the results describe only this file.
  • We assumed that exact duplicate rows are assembly errors. Since no firm_id had conflicting values, nothing else had to be resolved.
  • The revenue aggregates exclude the 6 firms with unknown revenue (complete-case analysis). If revenue is not missing at random, the mean and median could be biased; no imputation was done. Two of these firms (F0129, F0269) have large head counts (>3000), which hints that the excluded firms may be larger than average.
  • Unit labels were taken at face value. The similar converted scales of the two unit groups support this, but it cannot be verified.
Files · main
Menu

Theme