Skip to content

feat(analysis): name the sectors in the N/D comparison CSV, and give it a sortable magnitude - #878

Open
WesIngwersen wants to merge 1 commit into
mainfrom
hists-csv-names-and-abs-change
Open

feat(analysis): name the sectors in the N/D comparison CSV, and give it a sortable magnitude#878
WesIngwersen wants to merge 1 commit into
mainfrom
hists-csv-names-and-abs-change

Conversation

@WesIngwersen

Copy link
Copy Markdown
Member

The n_d_nowcast_<year>_vs_v03.csv carried bare sector codes and percent differences only, which made the obvious question — which sectors moved most — awkward to answer.

Sorting on the percent column answers a different question. It puts near-zero sectors on top, because a small absolute move on a small base is a large percent. The magnitude of the move is what "moved most" means, and there was no column for it.

What is added

column
sector_name Cornerstone commodity description
N_change / D_change level change, nowcast − v0.3
N_abs_change / D_abs_change its magnitude — the sort key

⚠️ Names come from the Cornerstone taxonomy, not BEA 2017. The model runs on the 405-sector Cornerstone axis and cornerstone.commodities.COMMODITY_DESC has exactly those 405; the BEA 2017 dictionary is a different 408 and would leave the Cornerstone-specific codes blank. The script counts unnamed sectors and prints a note rather than silently writing empty cells — on the current build it reports none, 405 of 405 named.

What it shows

Top movers by N_abs_change on the current build — chemicals, all down hard:

sector name N v0.3 N nowcast change
327310 Cement 4.330 4.762 +10.0%
325130 Synthetic dyes and pigments 1.158 0.734 −36.6%
33131B Processed aluminum products 0.940 0.547 −41.9%
111900 Tobacco, cotton, sugarcane and other crops 2.048 1.664 −18.8%
325320 Pesticides 0.981 0.612 −37.7%
325520 Adhesives 0.790 0.487 −38.4%
562213 Solid waste combustors and incinerators 5.144 5.439 +5.7%
331313 Primary aluminum 1.083 0.790 −27.1%

On D_abs_change the same chemicals lead and fall further still — adhesives −70%, pesticides −62%, dyes −49% — so these are direct-intensity moves rather than something arriving through the supply chain.

Testing

Analysis script, no unit tests per repo convention.

uv run python -m bedrock.analysis.nowcasting.results.nowcast_vs_v03_hists
    # 405 rows, 405 named, no unnamed-sector note
uv run black --check . ; uv run ruff check .    # clean

🤖 Generated with Claude Code

…it a sortable magnitude

The CSV carried bare codes and percent differences only, which made the
obvious question - which sectors moved most - awkward to answer. Sorting
on the percent column answers a different question: it puts near-zero
sectors on top, because a small absolute move on a small base is a large
percent.

Adds the Cornerstone commodity description, the level change, and its
absolute value for both N and D. Sorting on N_abs_change now gives the
sectors that actually moved the model.

Names come from the CORNERSTONE taxonomy, not BEA 2017. The model runs on
the 405-sector Cornerstone axis and COMMODITY_DESC has exactly those 405;
the BEA 2017 dictionary is a different 408 and would leave the
Cornerstone-specific codes blank. The script counts and reports unnamed
sectors rather than silently writing empty cells - it reports none.

What it shows on the current build: the largest absolute movers are
chemicals, all down hard - synthetic dyes and pigments -37%, pesticides
-38%, adhesives -38%, processed aluminum -42% - against cement +10% and
solid waste incinerators +6%.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bl-young

bl-young commented Sep 8, 2026

Copy link
Copy Markdown
Member

see comment on #877 about the shifting the comparison to v0.3.2 instead of v0.3.1 (that change is really outside both of these PRs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants