| irf_match | R Documentation |
Estimates the free parameters of a linear DSGE model by minimising the weighted squared distance between the model's impulse responses and a user-supplied target (e.g. impulse responses estimated from a VAR or local projections).
irf_match(
model,
params_start,
shock_sd_start,
target,
shock_sd_fixed = NULL,
weight = NULL,
lower = NULL,
upper = NULL,
method = "Nelder-Mead",
control = list(),
penalty = 1e+10
)
model |
A |
params_start |
Named numeric vector of starting values for the structural parameters to estimate. |
shock_sd_start |
Named numeric vector of starting values for the
shock standard deviations to estimate. Pass an empty vector
( |
target |
A data frame with columns |
shock_sd_fixed |
Named numeric vector of shock SDs to keep fixed
while estimating. Their values come from this argument. The full
vector passed to |
weight |
Optional |
lower, upper |
Numeric vectors of bounds (length =
|
method |
Optimisation method for |
control |
List of control arguments for |
penalty |
Penalty value returned when the candidate parameters
yield an unstable / non-existent solution. Default |
The objective stacks all (impulse, response, period) rows of
target into a vector and computes
(\text{irf}_\text{model}(\theta) - \text{irf}_\text{target})^\top
W (\text{irf}_\text{model}(\theta) - \text{irf}_\text{target}).
If the candidate parameters make the model unstable or fail to solve,
penalty is returned (effectively rejecting that vector).
The asymptotic variance of the IRF-matching estimator is
(J' W J)^{-1} J' W \Omega W' J (J' W J)^{-1}
where J is the Jacobian of model IRFs at the optimum and
\Omega is the variance of the target IRFs. Computing this
efficiently requires user knowledge of \Omega; this function
returns the point estimates only.
An object of class "dsge_irf_match" containing:
paramsEstimated structural parameter values.
shock_sdEstimated shock standard deviations.
objectiveAchieved minimum objective value.
convergedLogical (optim convergence == 0).
n_iterIteration counts returned by optim.
targetThe supplied target IRF data frame, augmented
with the model-implied fitted values at the optimum
(column fitted).
solutionThe dsge_solution at the optimum.
Christiano, L.J., Eichenbaum, M. and Evans, C.L. (1999). Monetary policy shocks: What have we learned and to what end? In Handbook of Macroeconomics, Volume 1A, ch. 2.
nk <- dsge_model(
obs(p ~ beta * lead(p) + kappa * x),
unobs(x ~ lead(x) - (r - lead(p) - g)),
obs(r ~ psi * p + u),
state(u ~ rhou * u),
state(g ~ rhog * g),
fixed = list(beta = 0.99),
start = list(kappa = 0.1, psi = 1.5, rhou = 0.7, rhog = 0.9)
)
# Build a target IRF from a "true" parameterisation
sol_true <- solve_dsge(nk,
params = c(kappa = 0.1, psi = 1.5, rhou = 0.7, rhog = 0.9),
shock_sd = c(e.u = 1.0, e.g = 0.5))
target_df <- irf(sol_true, periods = 12)$data
# Estimate, starting away from the truth
est <- irf_match(nk,
params_start = c(kappa = 0.2, psi = 2.0, rhou = 0.5, rhog = 0.5),
shock_sd_start = c(e.u = 1.0, e.g = 1.0),
target = target_df)
print(est)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.