liveBook · Manning

Inflation risk

As explained in Build a Robo-Advisor with Python (From Scratch)

The risk that rising prices will reduce the purchasing power of money or the real value of investment returns.

Inflation risk threatens retirement sustainability by raising future spending and reducing the real value of savings. Monte Carlo analysis represents it as persistent but mean-reverting uncertainty rather than independent annual noise. section 5.0 section 5.7

A practical inflation-risk model proceeds as follows:

  • Download CPI-U data from FRED, resample monthly observations annually, and calculate year-over-year percentage changes. section 5.7
  • Estimate an AR(1) process by regressing inflation on its lagged value; the lag captures persistence while mean reversion pulls rates toward a long-term level. section 5.7
  • Generate inflation paths with the estimated intercept, autoregressive coefficient, residual volatility, and independent simulation shocks. section 5.7
  • Apply each path to retirement spending and count simulations that end in bankruptcy to estimate the probability of running out of money. section 5.13 section 5.7

Historical inflation and simulated retirement paths

The year-over-year CPI-U rate rose from 1.4% at the end of 2020 to 7.0% in 2021, then declined to 6.5% in 2022 and 3.5% in 2023. A simulation can begin with 3.5% inflation, $1.2 million in wealth, $60,000 spending, and 30 years of projected paths. section 5.7 section 5.7

Listing 5.6 Downloading inflation data
import pandas_datareader.data as web 

start = '01-01-1947'
end = '12-30-2023'
data = web.DataReader(name='CPIAUCNS', data_source='fred', start=start, 
 end=end)  #1
data = data.resample('Y').last()  #2
data['yoy'] = data['CPIAUCNS'].pct_change()  #3
data.tail()

Inspect the Python workflow for downloading CPI-U data, creating annual inflation rates, and preparing the series for modeling. section 5.7

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Descends from model choice through CPI-U data preparation, lagged regression, parameter estimation, and simulated inflation paths.
Examples
Uses CPI-U observations from 2020–2023 and simulated 30-year retirement paths starting with $1.2 million and $60,000 annual spending.
What it assumes
Assumes basic financial planning and regression familiarity while deriving the inflation process from observed CPI-U data.
What you can do after
Build Monte Carlo inflation paths and estimate bankruptcy probabilities for retirement spending scenarios.
How it connects
Connects inflation risk to Monte Carlo simulations, retirement planning, the Consumer Price Index, and autoregressive processes.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.