The government of Calder wants unemployment kept at u, below the natural rate u_n, for as long as it can. Inflation follows an expectations-augmented Phillips curve: in year t (t = 0, 1, 2, ...)
with \kappa > 0. People form expectations from last year's inflation, partly pulled towards an anchor (the inflation rate the central bank has promised):
with 0 \le \theta \le 1. With \theta = 1 expectations are fully adaptive (last year's inflation); with \theta = 0 they never move from the anchor. Inflation in the year before the simulation starts is \pi_{-1} = pi0. Unemployment is u in every simulated year. All rates are fractions (2 % is 0.02).
Write overheating(pi0, anchor, theta, kappa, u_n, u, threshold, periods) that simulates years t = 0, 1, ..., periods - 1 and returns a tuple (first, final): the first year t with \pi_t strictly above threshold (None if no simulated year has it), and the inflation rate \pi_{\text{periods} - 1} of the last simulated year.
Collect the \pi_t in a list path and press Run with plot(path) to see the difference between a straight climb (\theta = 1) and a curve that levels off.
Examples
Input: pi0 = 0.02, anchor = 0.02, theta = 1, kappa = 0.5, u_n = 0.05, u = 0.04,
threshold = 0.051, periods = 10
Output: (6, 0.07)
Explanation: each year inflation is last year's plus 0.5 * 0.01 = 0.005:
0.025, 0.03, ..., 0.05, then 0.055 in year 6.
Input: pi0 = 0.02, anchor = 0.02, theta = 0.5, kappa = 0.5, u_n = 0.05, u = 0.04,
threshold = 0.051, periods = 10
Output: (None, 0.0299902) (rounded here)
Explanation: half of each rise is pulled back to the anchor:
0.025, 0.0275, 0.02875, ...; inflation levels off just under 0.03.
Constraints
- answers are compared with a tolerance of
1e-6; do not round
Goals
- Simulate inflation year by year when expectations follow last year's inflation
- See inflation accelerate when unemployment is held below its natural rate
- Compare fully adaptive expectations with expectations partly anchored to a target