Hello all,
Is there a way to implement a monetary policy shock under Ramsey optimal policy?

The typical answer is “no”, but I wonder why we cannot represent a monetary policy shock, even if the monetary policy is optimal. It could be considered as an optimal policy shock. Such a path (irf) should be available/possible.

Without entering the discussion of why you would like to do that and the economic meaningfulness and interpretation, you could define an auxiliary variable corresponding to the interest rate “observed by the economy”, r_obs, such that, assuming a linear model,

r_obs = r + eps_mp;

Then substitute all occurrences of r in the model with r_obs.

The planner will control r via his or her optimization program, but r will be subject to shocks eps_mp, whose nature and interpretation I leave to you, such that the rate that is relevant for economic decisions in the model, r_obs, is affected by monetary policy shocks.

You will then be able to access the irfs to such shock in the usual way .

Be careful about the timing. In Dynare, period t shocks are observed before decision are made. So the optimal policy is conditional on the shocks observed at the beginning of the current period.