Marx Max中文
Menu

Data acquisition

Open in Marx Max

Fetch six countries’ GDP growth and unemployment for 1991–2024 from the official API, calculate annual changes and country-level regressions, and download the public snapshot, Python and Stata code, figures and actual outputs.

Obtain six countries’ growth and unemployment from the official public API, preserve sources, check years and missing values, calculate annual changes and retain Python/Stata rerun artifacts.

Six country scatterplots of GDP growth and annual unemployment change, each with 33 observations, separate fitted lines and 95% confidence bands for the fitted conditional means.
Open the vector figure. Bands describe the fitted conditional mean, not a prediction interval for a year or a test of differences between country slopes.

Download the complete public-data package (ZIP)

This case follows a public-data task from indicator definitions and source preservation to country/year alignment, unemployment changes, figures and regressions. Below are actual Python and Stata calculations on the same public-data snapshot, available to download and rerun independently.

Read the guide: define a public-data task and check artifacts

Starting point: two indicators and six countries

The task retains the original six countries: United States, China, Japan, Germany, United Kingdom and Canada, with annual data for 1991–2024. NY.GDP.MKTP.KD.ZG measures real GDP growth (%); SL.UEM.TOTL.ZS measures unemployment as a share of the labor force using ILO modeled estimates. This series includes modeled and imputed values and does not directly substitute for each country’s headline unemployment statistics.

The snapshot contains 204 country/year rows with no empty values in either indicator. The year 1991 supplies the lag for the first difference; plots and regressions use 1992–2024, with 33 observations per country. This exercise adds no imputation.

Processing: calculate changes, then fit each country separately

Annual unemployment change equals this year’s rate minus the previous year’s rate, in percentage points. GDP growth is on the horizontal axis and unemployment change on the vertical axis. Each country receives a separate OLS regression with an intercept. The programs check consecutive years rather than treating changes across gaps as annual differences or pooling all countries into one slope.

CountryNSlopeConventional SE95% CIR²
United States33-0.5940.080-0.758–-0.4310.640
China33-0.0060.014-0.034–0.0220.006
Japan33-0.1070.027-0.162–-0.0510.334
Germany33-0.1810.059-0.302–-0.0600.230
United Kingdom33-0.1260.037-0.201–-0.0510.276
Canada33-0.4640.039-0.544–-0.3850.819

In this snapshot, the fitted negative slopes are more pronounced for the United States and Canada, while China’s fitted line is close to horizontal. The US slope of about −0.594 means a one-percentage-point difference in GDP growth corresponds to about −0.594 percentage points in annual unemployment change in this linear sample fit. It does not establish that increasing growth causes that change.

The exercise uses conventional OLS standard errors without adjustments for serial correlation, pandemic outliers or structural change. Figures and intervals are descriptive. The source warns about uncertainty in imputed values and their use for country rankings. Research requires additional checks on measurement, periods, lagged relationships and inference; six plots cannot establish a universal law.

Download: data, code, figures and actual output

The package includes raw API JSON, tidy CSV, provenance, separate Python and Stata programs, both sets of actual outputs and rerun instructions. Data are from World Bank WDI and its providers; both indicators specify CC BY 4.0. Attribution, modification notes and World Bank additional terms remain in the package. This exercise is not endorsed by the source institutions.

How to rerun

  1. Extract into a fresh empty directory and retain a reference copy of the outputs. The included data snapshot permits offline analysis without a World Bank account.
  2. For Python, prepare dependencies as described in the README and run python python/analyze.py from the package root. In a new licensed Stata session, change to the package root and run do stata/analysis.do; Python and third-party Stata commands are not required.
  3. Check six countries, 33 observations each, years 1992–2024, difference units and actual outputs. The two implementations were independently compared; maximum differences in coefficients, standard errors and intervals were below 10⁻¹⁰. Figure styles and file bytes need not match.
  4. For fresh data, copy the package separately, explicitly run python fetch-data.py and rerun analyses. Data revisions may change results; retain retrieval times and raw responses for comparisons.

Analysis programs overwrite named outputs in the practice directory, and Stata clear all clears that session’s memory state: save current work first. This run used macOS, Python 3.11.11 and Stata 19.5; Windows hardware reruns are not covered. In Marx Max, use a separate practice project and inspect actual code and output; cloud AI receives conversation and tool-returned content.

Return to the public-data guide · Understand AI data processing