Skip to content

Commit d864b87

Browse files
Merge pull request #1 from com-480-data-visualization/analysis-2008
Add 2008 analysis and general updates
2 parents 6c4249a + fcafa73 commit d864b87

36 files changed

Lines changed: 39583 additions & 4953 deletions

REPORT.md

Lines changed: 445 additions & 0 deletions
Large diffs are not rendered by default.

data/stock/history/EPP.csv

Lines changed: 4685 additions & 0 deletions
Large diffs are not rendered by default.

data/stock/history/IEV.csv

Lines changed: 5006 additions & 0 deletions
Large diffs are not rendered by default.

data/stock/history/ILF.csv

Lines changed: 4656 additions & 0 deletions
Large diffs are not rendered by default.

data/stock/history/IPAC.csv

Lines changed: 1526 additions & 0 deletions
Large diffs are not rendered by default.

data/stock/history/SPY.csv

Lines changed: 6908 additions & 0 deletions
Large diffs are not rendered by default.

dataset-sources.md

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ GDP, PPP: https://data.worldbank.org/indicator/NY.GDP.MKTP.PP.KD
5959
GDP per capita: https://data.worldbank.org/indicator/NY.GDP.PCAP.CD
6060
GDP per capita, PPP: https://data.worldbank.org/indicator/NY.GDP.PCAP.PP.KD
6161

62+
Current preprocessing uses the PPP-adjusted constant-dollar files for GDP and
63+
GDP per capita:
64+
65+
- `data/worldbank/gdp-ppp-international-usd-2021.csv`
66+
- `data/worldbank/gdp-capita-ppp-international-usd-2021.csv`
67+
68+
Current-USD GDP is still loaded as a conversion factor for asset-market proxies.
69+
6270
## ISO country data
6371

6472
Country codes, names, and region and continent classification
@@ -98,6 +106,11 @@ Gaps are filled using the country's iShares MSCI ETF price as a proxy:
98106

99107
> MC(year) ≈ MC(last_known_year) × (ETF_price(year) / ETF_price(last_known_year))
100108
109+
Market cap is converted from current USD to a constant-2021 PPP-equivalent
110+
valuation proxy:
111+
112+
`MC_real_ppp = MC_current_usd * GDP_PPP_constant_2021 / GDP_current_USD`
113+
101114
## ETF Price Data (iShares MSCI country ETFs)
102115

103116
iShares MSCI country ETF daily price history. Files: `data/nasdaq/etf/EW*.csv`
@@ -106,3 +119,297 @@ Data after 2020 was supplemented using yfinance.
106119

107120
Countries for which reliable data from 2000 was not easily available are
108121
excluded for now.
122+
123+
ETF prices are source adjusted-close prices, not inflation-adjusted prices. The
124+
preprocessing converts them to a constant-2021 PPP-equivalent valuation proxy:
125+
126+
`ETF_real_ppp = ETF_nominal_usd * GDP_PPP_constant_2021 / GDP_current_USD`
127+
128+
This is an approximation: ETF prices are asset valuations, not GDP. The purpose
129+
is to keep normalized trend comparisons on one broad real/PPP basis.
130+
131+
## Regional equity benchmarks
132+
133+
These are not yet shown in the UI, but the preprocessing setup now tracks them
134+
as documented regional market proxies for later comparison views.
135+
136+
### Europe
137+
138+
- Fund: iShares Europe ETF (`IEV`)
139+
- Official source: https://www.ishares.com/us/products/239736/ishares-europe-etf
140+
- Local history file: `data/stock/history/IEV.csv`
141+
- Coverage in repo: 2000 to 2020
142+
- Use: broad Europe market benchmark, suitable for pre/post-2008 split work
143+
144+
### Asia-Pacific
145+
146+
- Fund: iShares MSCI Pacific ex Japan ETF (`EPP`)
147+
- Official source: https://www.ishares.com/us/products/239674/ishares-msci-pacific-ex-japan-etf
148+
- Local history file: `data/stock/history/EPP.csv`
149+
- Coverage in repo: 2001 to 2020
150+
- Caveat: excludes Japan, so it is only an approximate Asia-Pacific benchmark
151+
152+
Alternative local file:
153+
154+
- Fund: iShares Core MSCI Pacific ETF (`IPAC`)
155+
- Official source: https://www.ishares.com/us/products/264619/
156+
- Local history file: `data/stock/history/IPAC.csv`
157+
- Coverage in repo: 2014 to 2020
158+
- Caveat: too late for the full 2000-to-2008 story
159+
160+
### Latin America
161+
162+
- Fund: iShares Latin America 40 ETF (`ILF`)
163+
- Official source: https://www.ishares.com/us/products/239761/ishares-latin-america-40-etf
164+
- Local history file: `data/stock/history/ILF.csv`
165+
- Coverage in repo: 2001 to 2020
166+
167+
### North America
168+
169+
- Official benchmark found: iShares MSCI North America UCITS ETF (`INAA`)
170+
- Official fact sheet: https://www.ishares.com/uk/individual/en/literature/fact-sheet/inaa-ishares-msci-north-america-ucits-etf-fund-fact-sheet-en-gb.pdf
171+
- Current repo status: no matching local history snapshot yet
172+
- Implication: North America can be aggregated from country series today, but not
173+
yet benchmarked against a dedicated regional ETF inside the repo
174+
175+
## Regional macro aggregates
176+
177+
World Bank regional aggregates exist for major regions, including:
178+
179+
- Europe & Central Asia
180+
- North America
181+
- East Asia & Pacific
182+
183+
Official explorer examples:
184+
185+
- https://data.worldbank.org/?locations=Z4-Z7-ZJ-ZQ
186+
- https://data.worldbank.org/?locations=XU-ZJ-Z7-Z4
187+
188+
These are useful later for region selector views, but they should be treated as
189+
separate benchmark series, not mixed blindly with country averages, because the
190+
World Bank regional definitions are broader than the current country subset used
191+
in the narrative.
192+
193+
## ECB household balance-sheet add-on
194+
195+
This is a separate narrative module, not part of the core country/region
196+
preprocessing pipeline. It exists to test the "growth for whom?" question
197+
without coupling the main map/spider workflow to ECB-specific data.
198+
199+
Current local file:
200+
201+
- `public/ecb_household_assets.json`
202+
203+
Refresh command:
204+
205+
```bash
206+
python scripts/fetch_ecb_household_assets.py
207+
```
208+
209+
Current series:
210+
211+
- Euro area household financial assets
212+
- ECB Data Portal page:
213+
https://data.ecb.europa.eu/data/datasets/QSA/QSA.Q.N.I9.W0.S1M.S1.N.A.LE.F._Z._Z.XDC._T.S.V.N._T
214+
- API:
215+
https://data-api.ecb.europa.eu/service/data/QSA/Q.N.I9.W0.S1M.S1.N.A.LE.F._Z._Z.XDC._T.S.V.N._T?format=csvdata
216+
- Euro area household net worth relative to gross disposable income
217+
- ECB Data Portal page:
218+
https://data.ecb.europa.eu/data/datasets/QSA/QSA.Q.N.I9.W0.S1M.S1._Z.B.B90._Z._Z._Z.XDC_R_B6G_CY._T.S.V.N._T
219+
- API:
220+
https://data-api.ecb.europa.eu/service/data/QSA/Q.N.I9.W0.S1M.S1._Z.B.B90._Z._Z._Z.XDC_R_B6G_CY._T.S.V.N._T?format=csvdata
221+
222+
Display rule in UI:
223+
224+
- both series are rebased to `2008-Q4 = 1`
225+
- panel remains separate from the core post-2008 market/fundamentals analysis
226+
so it can be removed cleanly later if the final story changes
227+
228+
## OECD living-cost and pay add-on
229+
230+
This is a separate narrative module for testing whether post-2008 growth showed
231+
up as wage gains, broad living-cost pressure, or asset-price pressure.
232+
233+
Current local file:
234+
235+
- `public/living_cost_pay_data.json`
236+
237+
Refresh command:
238+
239+
```bash
240+
python scripts/fetch_living_cost_pay.py
241+
```
242+
243+
Current sources:
244+
245+
- OECD annual average wages:
246+
https://sdmx.oecd.org/public/rest/data/OECD.ELS.SAE,DSD_EARNINGS@AV_AN_WAGE,1.0/all?startPeriod=2000&dimensionAtObservation=AllDimensions
247+
- OECD residential property prices and housing CPI:
248+
https://sdmx.oecd.org/public/rest/data/OECD.SDD.TPS,DSD_RHPI@DF_RHPI_ALL,1.0/all?startPeriod=2000&dimensionAtObservation=AllDimensions
249+
250+
Current derived series:
251+
252+
- Real average annual wages: OECD `WG`, `USD_PPP`, constant 2024 prices,
253+
indexed to 2008.
254+
- Housing CPI / wage: broad housing CPI index divided by nominal average-wage
255+
index, then indexed to 2008.
256+
- House price / wage: residential house-price index divided by nominal
257+
average-wage index, then indexed to 2008.
258+
- Headline lens check: World Bank GDP per capita in current USD versus GDP per
259+
capita in constant-PPP international dollars, both indexed to 2008.
260+
261+
Caveats:
262+
263+
- Europe is a simple average of available countries from the project sample, not
264+
an official EU aggregate.
265+
- OECD broad housing CPI coverage is narrower than wage coverage for this
266+
comparison; the Europe housing CPI / wage series currently uses Germany, the
267+
United Kingdom, the Netherlands, Sweden, and Switzerland.
268+
- Actual-rent CPI has no comparable US annual series in the fetched OECD slice,
269+
so the visualization uses broad housing CPI and residential house-price
270+
indexes instead.
271+
272+
## Inequality add-on
273+
274+
This is a second separate narrative module focused on the question:
275+
`who captured the post-2008 rebound?`
276+
277+
Current local file:
278+
279+
- `public/inequality_addon.json`
280+
281+
Refresh command:
282+
283+
```bash
284+
python scripts/fetch_inequality_addon.py
285+
```
286+
287+
Series included:
288+
289+
- US wealth shares from Federal Reserve Distributional Financial Accounts
290+
- main page: https://www.federalreserve.gov/releases/z1/dataviz/dfa/
291+
- ZIP download used in preprocessing:
292+
https://www.federalreserve.gov/releases/z1/dataviz/download/zips/dfa.zip
293+
- Euro-area wealth shares from ECB Distributional Wealth Accounts
294+
- dataset guide: https://data.ecb.europa.eu/data/datasets/DWA/data-information
295+
- top 10% share:
296+
https://data-api.ecb.europa.eu/service/data/DWA/Q.I9.S14._Z._Z.NWA.T10.PT.S.N?format=csvdata
297+
- bottom 50% share:
298+
https://data-api.ecb.europa.eu/service/data/DWA/Q.I9.S14._Z._Z.NWA.B50.PT.S.N?format=csvdata
299+
- Labour share from ILO modelled estimates
300+
- bulk table index:
301+
https://rplumber.ilo.org/files/website/bulk/indicator.html
302+
- direct CSV used:
303+
https://rplumber.ilo.org/data/indicator?id=LAP_2GDP_NOC_RT_A&format=.csv
304+
- geography used in UI:
305+
- `USA` = United States
306+
- `X92` = European Union 27
307+
- Capital gains vs disposable income comparison
308+
- source paper:
309+
https://www.ecb.europa.eu/press/key/date/2025/html/ecb.sp251009~49b985af53.en.pdf
310+
- currently stored as cited headline values in local JSON:
311+
- United States: `24.0%`
312+
- Euro area: `4.2%`
313+
314+
## Three-part 2008 story data
315+
316+
This module is generated by `scripts/build_analysis_lab_data.py` and stored in
317+
`public/analysis_lab_data.json`. It keeps the main story reversible: all new
318+
panels depend on this generated JSON, not on ad-hoc calculations inside the
319+
renderer.
320+
321+
Refresh command:
322+
323+
```bash
324+
python scripts/build_analysis_lab_data.py
325+
```
326+
327+
Pre-2008 growth uses the existing processed project series:
328+
329+
- GDP
330+
- GDP per capita
331+
- ETF price proxy
332+
- listed market capitalization
333+
334+
The pre-2008 panel also stores a `runup` view:
335+
336+
- 2000 baseline is `1`
337+
- 2007 dot shows the pre-crisis run-up
338+
- 2008 dot shows the immediate break-year endpoint
339+
- this avoids hiding the 2007-to-2008 market-cap drop inside a single
340+
2000-to-2008 multiple
341+
342+
Industrial-structure data is fetched directly from the World Bank API for
343+
`USA` and `EUU`, using the latest available observation up to 2008:
344+
345+
- Manufacturing value added, `% GDP`: `NV.IND.MANF.ZS`
346+
- Industry value added, `% GDP`: `NV.IND.TOTL.ZS`
347+
- Services value added, `% GDP`: `NV.SRV.TOTL.ZS`
348+
- Gross capital formation, `% GDP`: `NE.GDI.TOTL.ZS`
349+
- R&D expenditure, `% GDP`: `GB.XPD.RSDV.GD.ZS`
350+
351+
These industrial indicators are not additive:
352+
353+
- manufacturing is a subset of industry
354+
- industry and services are value-added shares
355+
- investment and R&D are capacity/intensity measures, not output sectors
356+
357+
Current interpretation rule:
358+
359+
- the pre-2008 section is descriptive, not causal
360+
- industrial structure is shown as context only
361+
- any claim that sector composition caused the post-2008 divergence needs a
362+
separate sector-level analysis with output, market, employment, and export
363+
exposure data
364+
365+
Normalization explorer and break-fit fields:
366+
367+
- PPP GDP: World Bank `NY.GDP.MKTP.PP.KD`, constant 2021 international dollars
368+
- current-USD GDP: World Bank `NY.GDP.MKTP.CD`, current US dollars
369+
- ETF and market cap: processed project valuation proxies
370+
- `breakFinder`: piecewise-linear break-year fit for US/Europe gaps, including
371+
PPP GDP, current-USD GDP, ETF, and market capitalization
372+
373+
Other generated story fields:
374+
375+
- `counterfactual`: actual post-2008 path versus extrapolated 2000-2008 trend
376+
- `scorecard`: post-2008 market, macro, labour-share, life-expectancy, and
377+
happiness comparison
378+
- `heatmap`, `timeline`, `archetypes`, and `gainMatrix`: backup views parked in
379+
the UI under "Backup analysis"
380+
381+
Section-3 scorecard units:
382+
383+
- GDP per capita uses World Bank `NY.GDP.PCAP.PP.KD`: PPP-adjusted GDP per
384+
person in constant 2021 international dollars
385+
- market rebound uses the PPP-equivalent ETF price proxy generated by preprocessing
386+
- capital gains / income is a household financial-asset valuation measure
387+
- labour share is percentage-point change in labour share of GDP
388+
- life expectancy is change in years
389+
- happiness is change in Cantril ladder score
390+
391+
Break-year methodology:
392+
393+
- gap series is `log(US / Europe)` for each metric
394+
- candidate break years are 2005 through 2015
395+
- model is `gap = intercept + time + post_break_time`
396+
- each candidate model is scored with BIC
397+
- displayed score is inverted and min-max normalized across candidate years:
398+
`1` = lowest BIC / best candidate, `0` = highest BIC / worst candidate
399+
- this score is a relative fit ranking, not a probability or confidence interval
400+
401+
Counterfactual methodology:
402+
403+
- current counterfactual panel uses GDP per capita, not total GDP
404+
- model fits `log(GDP per capita)` from 2000 through 2008
405+
- post-2008 line compares actual normalized GDP per capita against that projected
406+
log-linear pre-break trend
407+
408+
Normalization explorer adjustment:
409+
410+
- all lines use the same preprocessed `public/spider_data.json` output
411+
- GDP/cap lines use World Bank `NY.GDP.PCAP.PP.KD`
412+
- ETF and market-cap lines use the PPP-equivalent valuation proxies generated in
413+
preprocessing
414+
- for regions, GDP and market cap are summed across countries in the current
415+
project sample; GDP/cap and ETF proxy are averaged across countries

0 commit comments

Comments
 (0)