10. Surprises and announcements
A shock can arrive in two ways. Either nobody saw it coming, or it was announced some periods before it landed. The paths differ, and a simulation that cannot tell them apart is answering a different question from the one that was asked.
A plan entry carries two coordinates: the date, which is when the information arrives, and the page, which says how far ahead of the landing it arrives.
page 1 agents learn at the date that the shock hits that same date
page k agents learn at the date that the shock hits k-1 later
10.1. The default is perfect foresight
A plan whose entries all sit on page 1 keeps a single page, and a single page is one stacked solve over the whole span. Everything in it is known from the first period. That is what perfect foresight means, and it stays the default:
p = simplan(m, [0, 40], 1);
p = append(p, 'EfficiencyInnovation', 5, -0.10);
The path begins to move immediately, because the fall at date five is already known at date one.
10.2. Asking for a surprise
To solve period by period instead, each period seeing only what is known then, ask for it:
p = simplan(m, [0, 40], 1, 'recursive', true);
p = append(p, 'EfficiencyInnovation', 5, -0.10);
Now nothing moves before date five. The recursion is what gives a page-1 entry its surprise meaning: with one information set there is no difference between a surprise and a shock seen coming.
10.3. Announcing a shock
A page beyond the first announces:
% at date 5, agents learn that the shock hits at date 7
p = append(p, 'EfficiencyInnovation', 5, -0.10, 3);
The path moves at date five, when the announcement arrives, and again at date seven, when the shock lands.
The plan owns the horizon. Appending on a page the plan does not yet
have adds the pages that announcement needs, so solve_shock_horizon
does not have to be set on the model. The pages added are copies of the
page the constructor laid down, so a grown plan and a plan built wide
hold the same array and no conditioning is invented.
10.4. The three information structures side by side
The same shock, the same date, three ways of knowing about it:
Information |
Path first moves |
Shock lands |
|---|---|---|
perfect foresight |
period 1 |
period 5 |
surprise |
period 5 |
period 5 |
announced two ahead |
period 5 |
period 7 |
Reproduced by
rise-modern-tutorials/WorkingWithAModel/anticipation.
10.5. What a recursive pass can and cannot see
At each period the solver is given what is known then, and nothing else.
A future shock is hidden. Page 1 at a later column is what will be realized there, which the agent at the current date does not know, so it is dropped from the window. Two pages are enough for this whatever the distance between the current date and the shock.
A future endogenous target is not hidden. A target on a future endogenous cell is not a realization the economy springs on anyone; it is a restriction the forecaster holds from the outset. Conditional forecasting therefore behaves under a recursive plan as it does under an ordinary one.
A freed instrument stays free. Freeing a shock so a target can be hit leaves an empty page-1 cell, and the announcement pages do not pin it back.
10.6. Under simulate
Everything above is about perfect_foresight. simulate and
forecast use a stochastic solution, which agents cannot see past, so a
page-1 entry is a surprise there whether the plan is recursive or not. A
page beyond the first announces a shock the solution must anticipate: a
plan with N pages needs the model solved with solve_shock_horizon of
at least N-1, and simulate refuses it otherwise
(RISE:simulation:planExceedsShockHorizon). A recursive plan carries a
second page, so the rule applies to it too.
A solve paradigm (option solve_paradigm, for example the
piecewise-linear paradigm) also steps with the shocks of the model’s own
horizon. A later page that announces nothing, such as the second page of
a recursive plan, is dropped, so the recursive plan runs as surprises and
gives the path of the single-page plan. A page that announces something
beyond the horizon is refused
(RISE:simulation:planExceedsParadigmHorizon).
10.7. Compared with splitting into frames
Another way to do this is to split the span at each surprise date, solve each segment forward with later surprises zeroed, and splice the pieces.
The recursion here is the same construction, generalized. Instead of splitting at break points it visits every period, and where nothing new arrives it shifts the previous solution one period left rather than re-solving. In a deterministic problem that shift is exact, so the answer is the same and the work is strictly less.