Inflation#

import pandas as pd
import warnings
#warnings.filterwarnings('ignore')
    
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (12,6)
plt.rcParams['font.size'] = 15
plt.rcParams['legend.fontsize'] = 13
from matplotlib.ticker import StrMethodFormatter
rawdata = pd.read_excel('../data/economic_data.xlsx',sheet_name='data').set_index('date')

FREQ = 4

if FREQ == 4:
    FREQcode = 'Q'
elif FREQ == 1:
    FREQcode = 'Y'
elif FREQ==12:
    FREQcode = 'M'

data = rawdata.resample(FREQcode).agg('last')
data.index = data.index - pd.tseries.offsets.BDay(1)

data_econ = data
/var/folders/zx/3v_qt0957xzg3nqtnkv007d00000gn/T/ipykernel_27142/4082269214.py:12: FutureWarning: 'Q' is deprecated and will be removed in a future version, please use 'QE' instead.
  data = rawdata.resample(FREQcode).agg('last')

Economic Aggregates#

The dual mandate#

The Fed has a dual mandate

  • price stability

  • full employment

There is a lot of controversey around how the Fed should specifically measure and prioritize these dual goals.

  • Traditionally, a view that economic growth and output are related.

  • Accordingly, tension in keeping inflation low while also stimulating the economy.

In particular, there is controversey about

  • How forcefully should the Fed act with monetary policy to reduce and control inflation?

  • Their primary tool is to raise interest rates.

  • Should they risk recession to control inflation?

The data#

The plots below give context about the economy, especially measured discussed relative to interest rates and the Fed.

inflation = (data['CPI-Core']/data['CPI-Core'].shift(1) -1 ) * FREQ

inflation_yoy = (data['CPI-Core']/data['CPI-Core'].shift(FREQ) -1 )
ax = inflation_yoy.plot(title='CPI Growth (yoy)',ylabel='inflation')
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.1%}'))
plt.show()
../_images/ae44a8383afddca5b832c263cb2ae9173be4f71cf0068c38226f6e42bc9519ee.png
gdp_growth_yoy = (data['GDP'] / data['GDP'].shift(FREQ) - 1)
ax = gdp_growth_yoy.plot()
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.1%}'))
data['Recession'].plot.area(ax=ax, alpha=0.5,color='gray')

plt.title('GDP Growth (yoy)')
plt.ylim(-.075,.175)
plt.legend(['gdp growth rate','recession'])
plt.show()

ax = gdp_growth_yoy.plot(title='GDP Growth (yoy)',xlim=('2018-01-01','2025-12-31'))
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.1%}'))
data['Recession'].plot.area(ax=ax, alpha=0.5,color='gray')
plt.ylim(-.10,.175)
plt.legend(['gdp growth rate','recession'])
plt.show()
../_images/303ac5e03a1ba2469780854487f81755e67a4b4594eb2ef1a4aa4f343300eeb2.png ../_images/db27e66d51ee09eb546bbb35005e87ff1a0eb8d81fc8ea6bdbcca6293c5affd4.png
ax = (data['Unemployment']/100).plot()
data['Recession'].plot.area(ax=ax, alpha=0.5,color='gray')
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.1%}'))

plt.title('Unemployment')
plt.ylim(.03,.12)
plt.legend(['gdp growth rate','recession'])
plt.show()


ax = (data['Unemployment']/100).plot()
data['Recession'].plot.area(ax=ax, alpha=0.5,color='gray')
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:.1%}'))

plt.title('Unemployment')
plt.xlim('2018-01-01','2022-12-31')
plt.ylim(.03,.12)
plt.legend(['gdp growth rate','recession'])
plt.show()
../_images/510b22b4b83da410051e2b4af6bbd109e560981435a1b6d89b33574cad1b4894.png ../_images/0b72411310056c6b565f9f60050bfe923b9b83dd56fd1e767bc6753db3dda63e.png
fig,ax = plt.subplots()
inflation_yoy.plot(ax=ax)
ax.legend(loc='upper left')
ax.set_ylabel('CPI Growth (YoY)', color='tab:blue')

ax2 = ax.twinx()
gdp_growth_yoy.plot(ax=ax2,color='red')
ax2.set_ylabel('GDP Growth (YoY)', color='tab:red')
ax2.legend()
fig.suptitle('CPI growth vs GDP growth')
plt.show()



fig,ax = plt.subplots()
inflation_yoy.plot(ax=ax,ylim=(0,.08))
ax.set_ylabel('CPI Growth (YoY)', color='tab:blue')
ax.legend(loc='upper left')

ax2 = ax.twinx()
gdp_growth_yoy.plot(ax=ax2,color='red',xlim=('2018-01-01','2022-12-31'))
ax2.set_ylabel('GDP Growth (YoY)', color='tab:red')
ax2.legend()
fig.suptitle('CPI growth vs GDP growth')
plt.show()
../_images/a553ffed399ff6a2797140815bf49a8d290d014dd946533b037a6fd50c6a3aee.png ../_images/5914b87d996543dd3d224fcc0c77c061ab0373f05d322b4896206654a6e65616.png

Inflation#

Several theories about the determinants of inflation.

  • Monetary theory: Money supply (particularly as measured by “M2” money).

  • Fiscal theory: Government spending, deficits, debt

Below are a few plots giving context.

Monetary Theory#

Historically, there is a strong correlation between money growth and inflation (with a lag.)

Milton Friedman famously believed that

Inflation is always and everhwere a monetary phenomenon.

money_growth_yoy = (data['M2 Money']/data['M2 Money'].shift(FREQ)-1)
money_growth_yoy.plot(title='Growth in M2 Money (yoy)')
plt.show()

money_growth_yoy.plot(title='Growth in M2 Money (yoy)',xlim=('2018-01-01','2023-12-31'))
plt.show()
../_images/66ac28f189f30f892fdf2b0c7aba3f7b15289815534e6d23026c98418c43160f.png ../_images/fd3d8acf0d6b04059c04721902872907ca8f2a3efbcfbd415fd7d298c530259e.png
fig,ax = plt.subplots()
inflation_yoy.plot(ax=ax)
ax.set_ylabel('CPI Growth (YoY)', color='tab:blue')
ax.legend()

ax2 = ax.twinx()
money_growth_yoy.plot(ax=ax2,color='red')
ax2.set_ylabel('Money Growth (YoY)', color='tab:red')
ax2.legend()
fig.suptitle('CPI growth vs Money growth')
plt.show()
../_images/d53e12d0c489aed27d2ef9a36b1ceb5de7498e6c4c321eb90ad180707b2bee1c.png
debt_growth_yoy = (data['Federal Public Debt']/data['Federal Public Debt'].shift(FREQ)-1)
debt_growth_yoy.plot(title='Growth in Fed Debt (yoy)')
plt.show()

debt_growth_yoy.plot(title='Growth in Federal Debt (yoy)',xlim=('2018-01-01','2025-06-30'))
plt.show()
../_images/236a3d4400a395f8d9d321ff181581d395dc951e55f4cc63caa1c0d9da9ce2e5.png ../_images/b98985be54a11d0e3987a61ec5e8ff105c22d91f183c1e2d9e6fce094152a699.png