osr: Optimal Simple (Restricted) Policy Rules

View source: R/osr.R

osrR Documentation

Optimal Simple (Restricted) Policy Rules

Description

Optimises the coefficients of a user-specified policy rule to minimise an unconditional quadratic welfare loss, subject to the model's rational expectations equilibrium.

Usage

osr(
  model,
  params,
  shock_sd,
  osr_params,
  welfare_weights,
  lower = NULL,
  upper = NULL,
  method = "L-BFGS-B",
  control = list(),
  penalty = 1e+10
)

Arguments

model

A dsge_model or dsgenl_model object, or a Dynare model imported with read_dynare that declares osr_params and optim_weights (then params, shock_sd, osr_params, welfare_weights and the bounds default to the values in the file).

params

Named numeric vector of model parameter values. Must contain entries for every free parameter and structural parameter that solve_dsge requires. Values for any parameters listed in osr_params will be overwritten during the search.

shock_sd

Named numeric vector of shock standard deviations.

osr_params

Named numeric vector. Names are the parameters to optimise (must be in names(params)), values are starting guesses for the optimiser.

welfare_weights

A named list with elements Q_xx, Q_yy and optionally Q_xy, defining the loss

L = \mathrm{tr}(Q_{xx}\Sigma_x) + \mathrm{tr}(Q_{yy}\Sigma_y) + 2\,\mathrm{tr}(Q_{xy}\Sigma_{xy}').

Each weight may be supplied either as a square matrix (rows/columns in state/control order) or as a named numeric vector (interpreted as the diagonal of the corresponding matrix).

lower, upper

Numeric vectors of lower/upper bounds for the parameters being optimised. Default NULL uses c(-Inf, Inf) for each, in which case method should not be "L-BFGS-B".

method

Optimisation method passed to optim. Default "L-BFGS-B".

control

List of control options passed to optim.

penalty

Numeric. Penalty value returned when the candidate parameter vector yields a non-existent or unstable equilibrium. Default 1e10.

Details

Comparison to ramsey_policy()

ramsey_policy() computes the fully flexible commitment-optimal policy: it is the lower bound on welfare loss subject only to the model's equilibrium conditions. osr() restricts the policy to a parametric family (e.g. a Taylor rule r_t = \phi_\pi \pi_t + \phi_y x_t) and optimises within that family. The gap between Ramsey and OSR loss is the welfare cost of restricting to simple rules.

Value

An object of class "dsge_osr" containing:

optimal

Named numeric vector of optimal parameter values.

loss

Achieved welfare loss at the optimum.

loss_at_start

Loss at the starting values, for comparison.

converged

Logical (TRUE if optim returned convergence == 0).

n_iter

Iteration counts reported by optim.

params

Full parameter vector at the optimum.

weights

The welfare weight matrices used (with rows/cols named).

solution

The dsge_solution object at the optimum.

message

Optional diagnostic message from optim.

See Also

ramsey_policy, welfare_loss

Examples


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)
)
res <- osr(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),
  osr_params  = c(psi = 1.5),
  welfare_weights = list(Q_xx = c(u = 0, g = 0),
                         Q_yy = c(p = 1, x = 0.5, r = 0.1)),
  lower = 1.01, upper = 5.0)
print(res)



dsge documentation built on Sept. 25, 2026, 5:08 p.m.