SPB Git

spb/wp29_uqo

Public
4.2 KB · 38 lines markdown
1# F1-dev-01 — Analytic firm dataset and revenue aggregates23## Question4Build 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.56## Data and exclusions7`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`:81. **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`).92. **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.103. **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.1112Exclusion 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.1314## Method15Everything is done by `out/analysis.py`, which reads only `data/firms.csv` and is deterministic; no randomness is used (`random_seed` = null).16- Baseline: the mean of the raw `revenue` column over the non-empty rows, with no cleaning (`mean_revenue_raw`).17- Exact duplicates are dropped, keeping the first occurrence. The script asserts that no conflicting duplicate `firm_id`s remain.18- `revenue_musd = revenue / 1000` when `unit == USD_thousands`, otherwise `revenue`. The script asserts that no other unit label is present.19- `mean_employees` is computed over all 400 distinct firms, including the 6 with unknown revenue, as the task specifies.20- Revenue mean and median are computed over the 394 firms with known revenue.21No outliers were removed: revenue (5.7–2057.6 MUSD) and revenue per employee showed no implausible values.2223## Results24- Distinct firms: **400** (`n_unique_firms`). Firms with unknown revenue: **6** (`n_missing_revenue`). Firms analysed: **394** (`n_analysed`).25- 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.26- Mean head count over all distinct firms: **1101.4 employees** (`mean_employees`).27- 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.28- Feasibility: `complete` (`feasibility`).2930## Uncertainty31The 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.3233## Limitations and open issues34- The data are simulated (synthetic), so the results describe only this file.35- We assumed that exact duplicate rows are assembly errors. Since no `firm_id` had conflicting values, nothing else had to be resolved.36- 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.37- Unit labels were taken at face value. The similar converted scales of the two unit groups support this, but it cannot be verified.38
Files · main
Menu

Theme