A sudden collapse in spending hits Lowmarsh, and its central bank would like to cut its rate below zero, but it cannot: savers would just hold cash. Here y_t is the output gap, \pi_t inflation and i_t the policy rate in quarter t; \pi^* is the inflation target and a, b the rule's coefficients.
In quarter t (t = 0, 1, 2, ...) three equations hold, in this order:
- demand (IS): y_t = d_t - \sigma \, (i_{t-1} - \pi_{t-1} - r^*). The output gap y_t (output above normal, as a fraction of normal output) falls when last quarter's real rate i_{t-1} - \pi_{t-1} was above the neutral real rate r^*. The demand shock is d_t = \text{shock} \cdot \rho^t: it hits in quarter 0 and fades by the factor \rho each quarter (\rho^0 = 1, also when \rho = 0).
- Phillips curve: \pi_t = \pi_{t-1} + \kappa \, y_t. Inflation rises while output is above normal.
- policy rule: i_t = r^* + \pi_t + a \, (\pi_t - \pi^*) + b \, y_t, using this quarter's inflation and gap.
Before the shock (quarter -1) the economy is at rest: y_{-1} = 0, \pi_{-1} = \pi^* and i_{-1} = r^* + \pi^*. All rates are yearly rates written as fractions (2 % is 0.02), although the model steps one quarter at a time; sigma >= 0 and kappa >= 0 say how strongly demand reacts to the real rate and inflation to the gap.
With the zero lower bound, the rate actually set is \max(0, \text{rule}): the rule's value when it is at least 0, and 0 otherwise. That rate is the i_t that demand reacts to in quarter t + 1. In control terms the rate saturates, like a valve that cannot open past fully open.
Write zero_floor(e, a, b, T) that simulates quarters t = 0, 1, ..., T - 1 twice, once without the floor and once with it, and returns a dict:
"free": the pair(total_gap, lowest_inflation)without the floor: the sum of y_t and the smallest \pi_t;"floor": the same pair with the floor;"binding": in the run with the floor, the number of quarters in which the rule's value was below0, so the rate was raised to0.
The tests build each economy with the helper economy(sigma, kappa, r_star, pi_star, shock, rho), which returns the dict {"sigma": sigma, "kappa": kappa, "r_star": r_star, "pi_star": pi_star, "shock": shock, "rho": rho}; you may use it too.
Press Run with plot(inflation_free, label="free") and plot(inflation_floor, label="floor") to compare the two inflation paths.
Examples
Input: e = economy(1.0, 0.2, 0.01, 0.02, -0.06, 0.7), a = 0.5, b = 0.5, T = 40
Output: {"free": (-0.0109773, 0.0015068), "floor": (-0.0160455, -0.0044403), "binding": 11} (rounded here)
Explanation: quarter 0: y = -0.06, pi = 0.008, and the rule asks for
0.01 + 0.008 + 0.5 * (-0.012) + 0.5 * (-0.06) = -0.018. Without the floor, quarter 1
gets a real rate of -0.026 and y = -0.042 + 0.036 = -0.006. With the floor the real
rate is only -0.008, and y = -0.042 + 0.018 = -0.024: a deeper slump, and inflation
falls below zero.
Input: e = economy(1.0, 0.2, 0.01, 0.02, -0.05, 0.8), a = 0.5, b = 0.5, T = 40
Output: {"free": (-0.0159022, -0.0001479), "floor": (-0.1499834, -0.0099967), "binding": 40} (rounded here)
Explanation: with the floor, inflation sinks towards -0.01. There the real rate 0 - (-0.01)
equals the neutral rate, nothing pushes inflation back up, and the rate stays at 0.
Constraints
- answers are compared with a tolerance of
1e-6; do not round
Goals
- Simulate a policy rule whose rate is floored at zero
- Compare the same shock with and without the floor
- Count the quarters in which the floor binds and see how it deepens a slump