REPLICATION PACKAGE
"China's Undervalued Currency Is Driving Its Trade Surplus Higher"

------------------------------------------------------------------------
HOW TO RUN
------------------------------------------------------------------------
1. Put the whole China_REER_replication folder anywhere on your computer.
2. Open 00_master.do and change ONE line (global ROOT) to the path of that folder.
3. Run 00_master.do. It runs the three files in code/ in order and writes
   the final data, figures and tables. Nothing else needs to be changed.


------------------------------------------------------------------------
VALUES HARDCODED (in 00_master.do, section 3)
------------------------------------------------------------------------
BIS2025 = 88.558, BIS2026 = 91.333
    BIS broad real effective exchange rate for China: average of the 2025 monthly
    values and of the Jan-Sep 2026 monthly values. Used only to extend the WDI REER
    to 2026: REER(2026) = WDI REER(2025) x BIS2026 / BIS2025.

GEXP26 = 21.1, GIMP26 = 177.5
    China's nonmonetary gold exports and imports, Jan-Sep 2026, USD bn
    (China customs, HS 7108). Annualized: (exports - imports) x 12/9.

CAB1993-CAB1996 = -2.6, 1.2, 0.2, 0.8
    Current account, % of GDP. Taken from WDI

------------------------------------------------------------------------
VARIABLE CONSTRUCTION (01_build_data.do)
------------------------------------------------------------------------
CAB      = current account, % of GDP (WEO; 1993-96 hand-entered)
NETGOLD  = net nonmonetary gold exports, USD bn (negative = net imports)
             1993-2014: mirror data (partners' gross imports from China
                        minus partners' gross exports to China); 0 if no record
             2015-2025: China-reported exports minus imports
             2026:      Jan-Sep 2026 x 12/9
GOLD     = 100 x NETGOLD / NGDPD
CABXG    = CAB - GOLD   (current account excluding nonmonetary gold)
OPEN     = WDI trade (% of GDP) / 100, not lagged
REERf    = WDI REER to 2025; 2026 = WDI 2025 x BIS change
RELGDP trend, two versions, both estimated over 1990-2030 (WEO projections at the end):
    HP: Hodrick-Prescott filter, lambda = 100            (baseline)
    MA: centred 11-year moving average, window(5 1 5)    (robustness)
REER trend   = fitted values from REER on the RELGDP trend, 1990-2025
lnREERGAP    = ln(REERf / REER trend)
lnRELGDPGAP  = ln(RELGDP / RELGDP trend)
RG23 = average of lnREERGAP at t-2 and t-3 (baseline); RG12 = average at t-1 and t-2
ORG23, ORG12 = OPEN x RG23, OPEN x RG12
Suffix _HP / _MA = which RELGDP trend the variable is based on.

