View source: R/counterfactual.R
| qpm_counterfactual | R Documentation |
Rewrites history with some shocks switched off or scaled: "what if the central bank had simply followed its rule through 2022?" is the path implied by setting the policy shocks to zero over that window and re-running the model from the same starting point with all other shocks unchanged.
qpm_counterfactual(fit, shocks, periods = NULL, factor = 0, label = NULL)
## S3 method for class 'qpm_counterfactual'
plot(x, vars = NULL, ...)
fit |
A |
shocks |
Shocks to modify. |
periods |
Periods over which to modify them (labels as in the data, or integer indices). Default: the whole sample. |
factor |
Multiplier applied to the selected shocks; |
label |
Optional name for the scenario. |
x |
A |
vars |
Variables to plot. |
... |
Unused. |
This differs from qpm_decompose(), which attributes the history that
happened; here the history is replayed under a different assumption.
The counterfactual is only as good as the model's invariance to the
intervention — a Lucas-critique caveat that applies to every exercise
of this kind and is worth stating in any write-up.
An object of class qpm_counterfactual holding the actual and
counterfactual paths and their difference.
sol <- qpm_solve(qpm_template("bkl"))
obs <- simulate(sol, nsim = 60, seed = 4, burn = 20)
obs$period <- next_quarters("2010-Q4", 60)
fit <- qpm_filter(sol, obs[, c("period", "pi", "i", "q")])
cf <- qpm_counterfactual(fit, shocks = "eps_i",
label = "no policy surprises")
cf
plot(cf, vars = c("pi", "i", "y_gap"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.