# Alternative Policies

This section describes forecasting under an alternative monetary policy rule. That is:

- The state space system is split into two exogenous and unanticipated regimes,

the "historical" regime and the "forecast" regime. The historical policy rule applies during the "historical" regime, and the alternative policy rule applies to the "forecast' regime.

- Filtering and smoothing is done under the historical monetary policy rule, i.e. the one defined in the
`eqcond`

method for the given model. - Forecasts and IRFs are computed under the alternative rule.

See Regime-Switching Forecasts for details on how forecasting works when the state space system includes exogenous regime-switching.

Alternative policies can be either permanent or temporary. To use alternative policies, the user needs to ensure that the model can be solved with regime-switching (see Regime-Switching).

## Procedure for Permanent Alternative Policies

The user defines some instance of the `AltPolicy`

type (described below) and then calls the function `setup_permanent_altpol!`

. Then the function calls made to forecast and compute means and bands remain the same as usual (see Forecasting and Computing Means and Bands).

For example, suppose you have defined the functions `taylor93_eqcond`

and `taylor93_solve`

corresponding to Taylor (1993)'s proposed monetary policy rule. Then you can run:

```
m = AnSchorfheide()
setup_permanent_altpol!(m, AltPolicy(:taylor93, taylor93_eqcond, taylor93_solve); cond_type = :none)
forecast_one(m, :mode, :none, [:forecastobs, :forecastpseudo])
compute_meansbands(m, :mode, :none, [:forecastobs, :forecastpseudo])
```

Permanent alternative policies utilize some of the same machinery as temporary alternative policies, but they use different algorithms for converting the equilibrium conditions from gensys form to the reduced form transition matrices for a state space system. The function `setup_permanent_altpol!`

performs the setup required to interface with this machinery. The keyword argument `cond_type`

is necessary because when the alternative policy is applied depends on whether the forecast is conditional or not. If a forecast is conditional, it is assumed that the alternative policy does not occur until after the conditional horizon, to maintain the idea that the alternative policy is entirely unanticipated.

## Procedure for Temporary Alternative Policies

Another counterfactual exercise is temporarily imposing a different monetary policy rule, i.e. a temporary alternative policy, before switching back to either the historical rule or some (permanent) alternative rule. To implement this, we utilize exogenous regime switching in the forecast horizon.

In a rational expectations equilibrium, agents will take into account the fact that the temporary policy is expected to terminate. A different algorithm than Chris Sims's standard `gensys`

algorithm is required, which we have implemented as `gensys2`

. Note that this `gensys2`

is different from the `gensys2`

Chris Sims has implemented to calculate second-order perturbations.

To set up a temporary alternative policy, a user first needs to specify alternative policy using the type `AltPolicy`

. For instance, this code implements a Nominal GDP targeting policy, and the `AltPolicy`

is constructed by calling `DSGE.ngdp()`

, or equivalently

`AltPolicy(policy, DSGE.ngdp_eqcond, DSGE.ngdp_solve, forecast_init = DSGE.ngdp_forecast_init)`

where the inputs to `AltPolicy`

here are

`DSGE.ngdp_eqcond`

— Function`ngdp_eqcond(m::AbstractDSGEModel, reg::Int = 1)`

Solves for the transition equation of `m`

under a price level targeting rule (implemented by adding a price-gap state)

Missing docstring for `DSGE.ngdp_replace_eq_entries`

. Check Documenter's build log for details.

`DSGE.ngdp_solve`

— Function`ngdp_solve(m::AbstractDSGEModel)`

Solves for the transition equation of `m`

under a price level targeting rule (implemented by adding a price-gap state)

`DSGE.ngdp_forecast_init`

— Function`init_ngdp_forecast(m::AbstractDSGEModel, shocks::Matrix{T}, final_state::Vector{T})`

Adjust shocks matrix and final state vector for forecasting under the NGDP rule

Note that `ngdp_replace_eq_entries`

is called by `ngdp_eqcond`

but is not a direct input to `AltPolicy`

.

The user also needs to complete the following steps to apply temporary alternative policies.

Adding a regime for every period during which the alternative policy applies, plus one more regime for the policy which will be permanently in place after the temporary policies end.

Adding the setting

`Setting(:gensys2, true)`

to indicate`gensys2`

should be used. If this setting is false or non-existent, then alternative policies will be treated as if they are permanent. Their equilibrium conditions will be solved using`gensys`

, which can lead to determinacy and uniqueness problems if the alternative policy should be temporary (e.g. a temporary ZLB).Adding the setting

`Setting(:replace_eqcond, true)`

to indicate equilibrium conditions will be replaced.Adding the setting

`Setting(:regime_eqcond_info, info)`

, where`info`

should be a`Dict{Int, DSGE.EqcondEntry}`

mapping regimes to instances of`EqcondEntry`

, a type which holds any information needed to update equilibrium conditions to implement a given alternative policy. Borrowing the example of temporary NGDP targeting, the relevant`EqcondEntry`

would be constructed as`EqcondEntry(DSGE.ngdp())`

. Note that the user only needs to populate this dictionary with regimes in which the`eqcond`

function differs from the default.

To see an example of using temporary alternative policies, see the example script for regime-switching.

## Alternative Policy Uncertainty and Imperfect Awareness

Click on the section header for details on how to add policy uncertainty or imperfect credibility to alternative policies (both permanent and temporary).

`MultiPeriodAltPolicy`

Click on the section header to see the primary use of the type `MultiPeriodAltPolicy`

, which extends `AltPolicy`

to specify multiple regimes. In particular, one of the fields of `MultiPeriodAltPolicy`

is `regime_eqcond_info`

, which stores a dictionary that can be used to update a model's `regime_eqcond_info`

`Setting`

, i.e.

`m <= Setting(:regime_eqcond_info, multi_period_altpol.regime_eqcond_info)`

## Types

`DSGE.AltPolicy`

— Type`mutable struct AltPolicy`

Types defining an alternative policy rule.

**Fields**

`key::Symbol`

: alternative policy identifier`eqcond::Function`

: a version of`DSGE.eqcond`

which computes the equilibrium condition matrices under the alternative policy. Like`DSGE.eqcond`

, it should take in one argument of mutable struct`AbstractDSGEModel`

and return the`Γ0`

,`Γ1`

,`C`

,`Ψ`

, and`Π`

matrices.`solve::Function`

: a version of`DSGE.solve`

which solves the model under the alternative policy. Like`DSGE.solve`

, it should take in one argument of mutable struct`AbstractDSGEModel`

and return the`TTT`

,`RRR`

, and`CCC`

matrices.`forecast_init::Function`

: a function that initializes forecasts under the alternative policy rule. Specifically, it accepts a model, an`nshocks`

x`n_forecast_periods`

matrix of shocks to be applied in the forecast, and a vector of initial states for the forecast. It must return a new matrix of shocks and a new initial state vector. If no adjustments to shocks or initial state vectors are necessary under the policy rule, this field may be omitted.`color::Colorant`

: color to plot this alternative policy in. Defaults to blue.`linestyle::Symbol`

: line style for forecast plots under this alternative policy. See options from`Plots.jl`

. Defaults to`:solid`

.

`DSGE.EqcondEntry`

— Type`mutable struct EqcondEntry`

Type to hold the entries in the regime*eqcond*info dictionary for alternative policies, regime switching, and imperfect awareness.

`DSGE.MultiPeriodAltPolicy`

— Type`mutable struct MultiPeriodAltPolicy`

Types defining an alternative policy rule.

**Fields**

`key::Symbol`

: alternative policy identifier`regime_eqcond_info::AbstractDict{Int64, EqcondEntry}`

: a dictionary mapping regimes to equilibrium conditions which replace the default ones in a given regime.`gensys2::Bool`

: if true, the multi-period alternative policy needs to call`gensys2`

instead of`gensys`

to work.`temporary_altpolicy_names::Union{Vector{Symbol}, Nothing}`

: specifies the names of temporary policies which may occur, e.g.`[:zero_rate]`

if a temporary ZLB is implemented using the`zero_rate`

`AltPolicy`

.`temporary_altpolicy_length::Int64`

: the temporary alternative policy's length which is used to determine which regimes need to be solved using`gensys2`

instead of`gensys`

.`infoset::Union{Vector{UnitRange{Int64}}, Nothing}`

: either a vector specifying the information set used for expectations in the measurement equation or`nothing`

to indicate myopia in expectations across regimes.`perfect_credibility_identical_transitions::Union{Dict{Int64, Int64}, Nothing}`

: if not a`Nothing`

, then this field specifies regimes which have identical transition equations in the case of perfect credibility.`identical_eqcond_regimes::Union{Dict{Int64, Int64}, Nothing}`

: if not a`Nothing`

, then this field specifies regimes which have identical equilibrium conditions.`forecast_init::Function`

: a function that initializes forecasts under the alternative policy rule. Specifically, it accepts a model, an`nshocks`

x`n_forecast_periods`

matrix of shocks to be applied in the forecast, and a vector of initial states for the forecast. It must return a new matrix of shocks and a new initial state vector. If no adjustments to shocks or initial state vectors are necessary under the policy rule, this field may be omitted.`color::Colorant`

: color to plot this alternative policy in. Defaults to blue.`linestyle::Symbol`

: line style for forecast plots under this alternative policy. See options from`Plots.jl`

. Defaults to`:solid`

.