# Replication Package — "Mixing It Up: Inflation at Risk"

> **Reference:** Schröder, M. (2026). *Mixing it up: Inflation at risk*, Journal of Money, Credit & Banking.

This repository contains the full replication package for the paper. All code is written in **MATLAB** and organised into self-contained application folders, each with its own `data/`, `functions/`, `figures/`, and `results/` sub-directories.

---

## License and Citation Policy

This replication package is provided for academic research and educational purposes only.

You are free to use, modify, and distribute the code contained in this package, provided that proper attribution is given. If you use this code or any part of it in your own research, publications, or derivative work, please cite the original work as:

> Schröder, M. (2026). Mixing it up: Inflation at risk, *Journal of Money, Credit & Banking*,

or as indicated in the final publication.

This code is distributed in the hope that it will be useful, but it is provided "as is", without any warranty of any kind, express or implied. The authors are not responsible for any errors, omissions, or results obtained from the use of this code. Any redistribution of this code, in whole or in part, must retain this notice. For uses beyond academic research and education, please contact the author(s) for permission.

---

## Inflation Aggregates

All empirical scripts (forecasting, in-sample, and risk applications) are configured by default for **Core PCE (excl. food & energy)**, but can be run for **any of the four aggregates** studied in the paper simply by loading the corresponding pre-processed `.mat` file. Pre-processed data files for all four aggregates are included in each application's `data/` folder:

| Aggregate | FRED ID | Forecasting data file | Risk data file |
|---|---|---|---|
| Core PCE (excl. food & energy) | `PCEPILFE` | `data_for_server_20250429_PCEx.mat` | `data_for_server_20250429_risk_PCEx.mat` |
| Headline PCE | `PCEPI` | `data_for_server_20250429_PCE.mat` | `data_for_server_20250429_risk_PCE.mat` |
| Core CPI (excl. food & energy) | `CPILFESL` | `data_for_server_20250429_CPIx.mat` | `data_for_server_20250429_risk_CPIx.mat` |
| Headline CPI | `CPIAUCSL` | `data_for_server_20250429_CPI.mat` | `data_for_server_20250429_risk_CPI.mat` |

To switch aggregates, simply change the `load(...)` statement at the top of each script to point to the desired `.mat` file. No other changes are needed — all estimation settings, evaluation metrics, and figure export code adapt automatically.

---

## Repository Structure

```
test_applications/
├── README.md                 ← you are here
├── simulations/              ← Monte Carlo exercises & SHAP-style decomposition simulations
│   ├── data/
│   ├── functions/
│   ├── figures/
│   └── results/
├── in-sample/                ← In-sample / motivational figure generation
│   ├── data/
│   └── figures/
├── forecasting/              ← Out-of-sample inflation density forecasting, evaluation & SPF comparison
│   ├── data/
│   ├── functions/
│   ├── figures/
│   ├── results/
│   ├── RossiSekhposyan/
│   └── VulnerableGrowth/
├── risk_rt/                  ← Real-time inflation risk estimation & density decomposition
│   ├── data/
│   ├── functions/
│   ├── figures/
│   ├── results/
│   └── miranda_aggripino_ricco/
│       ├── adjusted/         ← Updated proxy-SVAR with extended sample (to 2025M3)
│       └── miranda_aggripino_ricco_RAW/  ← Original replication code
└── tex/                      ← Compiled figures for the manuscript (EPS & PDF)
    ├── figures_eps/
    └── figures_pdf/
```

---

## Software Requirements

| Requirement | Purpose |
|---|---|
| **MATLAB** (R2022b or later recommended) | All scripts |
| **Statistics and Machine Learning Toolbox** | `ksdensity`, `quantile`, `skewness`, `kurtosis`, `norminv`, `normcdf`, etc. |
| **Parallel Computing Toolbox** *(recommended)* | `parfor` loops in simulations, forecasting, and risk estimation — speeds up replication |
| **Optimization Toolbox** *(optional)* | Used by some QR functions |

---

## Recommended Replication Workflow

The steps below reproduce every table and figure in the paper and online supplement. Each subfolder's README contains a detailed script-by-script guide.

### — Simulations (Online Appendix, Sections APPENDIX D and APPENDIX E)

```
cd test_applications/simulations/
```
1. `SIM1_DGPs.m` → Table D1 & Figure D1 (DGP histograms), in APPENDIX D.1 in the Online Appendix
2. `SIM2_H_select.m` → Table D2 (mixture component selection), in APPENDIX D.2 in the Online Appendix
3. `SIM3_density_decomposition.m` → Table D3 (density decomposition), in APPENDIX D.3 in the Online Appendix
4. `SIM3_loss_decomposition.m` → Table D4 (loss decomposition), in APPENDIX D.3 in the Online Appendix
5. `SIM4_models_density_decomposition.m` → Table D5 (model-based density decomposition), in APPENDIX D.4 in the Online Appendix
6. `SIM4_models_loss_decomposition.m` → Table D6 (model-based loss decomposition), in APPENDIX D.4 in the Online Appendix

### — In-Sample Motivational Figure (Online Appendix, Figure E1)

```
cd test_applications/in-sample/
```
1. `OS_Figure2_motivational_plot.m` → Figure E1 (inflation distribution comparison), in APPENDIX E in the Online Appendix

### — Forecasting Application (Main Paper & Online Appendix)

```
cd test_applications/forecasting/
```
1. `MAIN_forecasting_exercise_pipe.m` → Forecasting results `.mat` files + LaTeX tables, in Section 4.2 of the main body and APPENDIX E.1 and E.2 in the Online Appendix
2. `quantilechart.m` → Figure E2 (quantile fan chart), in APPENDIX E.3 in the Online Appendix
3. `SPF_comparison.m` → Figures Main-2a/b/c (cumulative quantile scores vs. SPF disagreement), in Section 4.2 in the main body

> **Note:** Repeating step 1 for all four inflation aggregates by swapping the `load(...)` statement reproduces the full set of forecasting results in the main body and Online Appendix.

### — Miranda-Agrippino Monetary Policy Shock Update (entirely optional for reproduction of paper results)

```
cd test_applications/risk_rt/miranda_aggripino_ricco/adjusted/
```
1. `MAIN_SVARIV_proxySVAR.m` → re-estimates the proxy-SVAR with the extended sample (1969M1–2025M3), saves updated IRFs (`IRFs_6925.mat`) and quarterly aggregated shocks (`shocksnew.mat`)

> **Note:** The replication files and precomputed datasets contain the estimated shocks necessary for reproducing the results. For the purpose of reproduction, re-running these codes can be skipped.  

### — Real-Time Risk Application (Main Paper & Online Appendix)

```
cd test_applications/risk_rt/
```
1. *(Optional)* `download_Baumeister_shocks.m` → downloads Baumeister & Hamilton shock series
2. `risk_measures_RT_annualized_rate_unstan_h1.m` → h=1 risk estimation, decomposition, and figures, Figure E3 in APPENDIX E.3 in the Online Appendix
3. `risk_measures_RT_annualized_rate_unstan_h4.m` → h=4 risk estimation, decomposition, and figures, Figures 3/4/5 in the  main body and Figures E4-E9 in APPENDIX E.3 in the Online Appendix 
4. `Compare_BH_shocks.m` → Figure Main-6 (scatter comparison with oil supply/demand shocks)

> **Note:** Steps 2–4 can be repeated for all four aggregates by swapping the `load(...)` statement.

---

## Input Data Summary

All raw and pre-processed data files are included. No external downloads are required for the core replication (the Baumeister shock download is optional/pre-cached). Key data sources:

| File | Source | Used in |
|---|---|---|
| `data_for_server_20250429_*.mat` | Pre-processed quarterly inflation + predictors for all four aggregates | `forecasting/`, `in-sample/` |
| `data_for_server_20250429_risk_*.mat` | Pre-processed inflation for risk application (all four aggregates) | `risk_rt/` |
| `FREDQD_new.xlsx` | FRED-QD quarterly macro database | `forecasting/`, `risk_rt/` |
| `SPFmicrodata.xlsx` | Philadelphia Fed Survey of Professional Forecasters, individual-level | `forecasting/` |
| `BH_shocks.mat` | Baumeister & Hamilton oil supply/demand shocks | `risk_rt/` |
| `indices.xlsx` | Commodity & financial indices | All empirical applications |

Pre-processed `.mat` files contain variables `y` (inflation series), `x` (predictor matrix), `T` (number of observations), `n` (number of predictors), and `dates_` (date vector).

---

## Dependency Audit Note

External replication folders such as:
- `RossiSekhposyan/` — Rossi, B. and T. Sekhposyan (2019), *Journal of Econometrics*
- `VulnerableGrowth/` — Adrian, T., N. Boyarchenko, and D. Giannone (2019), *American Economic Review*
- `miranda_aggripino_ricco/` — Miranda-Agrippino, S. (2016), Bank of England Staff Working Paper 626

were left largely unchanged and are included for convenience. The `miranda_aggripino_ricco/adjusted/` folder contains a modified version of the original proxy-SVAR code with an **extended sample window** (up to 2025M3) and updated FRED-MD data (`CRBI_constructed_new.xlsx`). The updated script exports the quarterly-aggregated monetary policy shock series (`shocksnew.mat`) used in the risk decompositions. The original unmodified code is preserved in `miranda_aggripino_ricco/miranda_aggripino_ricco_RAW/` for reference.

Additional files were adapted from Mitchell, J., Poon, A., & Zhu, D. (2024), *International Journal of Forecasting*.

---

## Computational Notes

- Individual scripts are efficient thanks to the variational Bayes implementation (e.g. the full recursive forecasting exercise completes in about 20 minutes per aggregate).
- Reproducing **all** results across all scripts, all four aggregates, both horizons, and all decompositions will take **several hours** in total.
- Several scripts use `parfor`; the Parallel Computing Toolbox is recommended but not required.
- 16 GB+ RAM is recommended for the risk estimation scripts.
- Pre-computed results are included in all `results/` folders — figures and tables can be regenerated from these without re-running the estimation.
- Results may vary slightly across machines due to floating-point arithmetic, parallel scheduling order, and MATLAB version differences.
