# In-Sample / Motivational Figure

This folder produces the motivational figure showing how the unconditional distribution of U.S. inflation changed across sub-samples (Online Appendix, Figure E1).

---

## Script

### `OS_Figure2_motivational_plot.m`

| Step | Detail |
|---|---|
| **Loads** | `data/data_for_server_20250429_PCEx.mat` — pre-processed Core PCE inflation (quarterly, 1974Q2–2024Q4) containing variables `y` and `dates_` |
| **Processing** | Splits the sample at 1989Q4 / 1990Q1 into two sub-periods; fits kernel density estimates to each |
| **Generates** | `figures/OS_Figure2_pdf_comparison_motivation.pdf` and `.eps` — overlaid histograms with kernel-density curves for the two regimes |

---

## Running for Other Aggregates

The script can be run for any of the four inflation aggregates by changing the `load(...)` statement. Pre-processed data for all aggregates is included in `data/`:

- `data_for_server_20250429_PCEx.mat` — Core PCE (default)
- `data_for_server_20250429_PCE.mat` — Headline PCE
- `data_for_server_20250429_CPIx.mat` — Core CPI
- `data_for_server_20250429_CPI.mat` — Headline CPI

Results for other aggregates are not reported in the paper.
---

## Folder Contents

```
in-sample/
├── OS_Figure2_motivational_plot.m    ← main script
├── data/
│   ├── data_for_server_20250429_PCEx.mat   ← pre-processed PCE-ex-food-energy data
│   ├── FREDQD.xlsx                         ← FRED-QD raw data (for re-generation)
│   ├── data.xlsx                           ← additional raw series
│   ├── indices.xlsx                        ← commodity/financial indices
│   └── load_data.m                         ← helper to rebuild .mat from raw sources
└── figures/
    └── OS_Figure2_pdf_comparison_motivation.{pdf,eps}
```

---

## Reproducing the Data from Scratch

If you wish to rebuild the `.mat` file rather than using the pre-processed version, use the `load_data.m` function in `data/` with the appropriate FRED series ID (e.g. `PCEPILFE`), lag specification (4), sample window (1973Q2–2024Q4), and indicator selection. See the commented-out block at the top of the forecasting scripts for the exact call signature.

---

## Requirements

- MATLAB with Statistics and Machine Learning Toolbox (`histfit`, `ksdensity`).
- Runtime: < 1 minute.
