# Simultaneous discrete and stochastic shocks

Hi,

I am trying to model two different, but simultaneous shocks: a deterministic and a stochastic.
I expected that the IRFs should reflect both shocks. This was not the case.

When using the command “stoch-simul”, no impacts were captured with respect to the deterministic component.
Likewise, upon using the command “simul”, the stochastic component was invariably not considered.

Help is appreciated.

Regards,
Jose

What exactly is it that your are trying to achieve?

Dear Johannes

Thank you. I already had a look at the script that you suggested; however it does not solve my query.

What I have in mind is to cause a determined reduction in the consumption Euler equation through a shifter, say for four periods, while simultaneously pursuing a stochastic booster by means of a money financed tax cut. The setting is a New Keynesian model with nominal rigidities.

Regards,
Jose

MFD2.mod (2.9 KB)

The easiest way is to use the `simult_`-function to simulate a combination of surprise and news shocks. A four period deterministic shock is the same as a simultaneous surprise shocks coupled with a 1, 2, and 3 period anticipated news shock. See https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod on how to do something like this.
What puzzles me in your mod file is that `z` is a shock entering an AR(1) process. That way, the four period shock will accumulate effects via shocks in every single one of the 4 periods. Is that desired?

Dear Johannes Pfeifer,

Thanks, once again.

I checked your script regarding a RBC model. As I understand, it captures two shocks on the same variable (z); however my intention is to specify a deterministic shock on z (in my script), while at the same time consider a stochastic shock on t… Please, note that z does not follow an AR(1) process.

Best,
Jose

1. I know that `z` does not follow an AR process, but it enters in
``````t = rhot*t(-1) - eps_t + z;
``````

which implies that it is a shock in an AR-process. If `z` is 1 in four periods, these four shocks will accumulate in `t`
2. At first order, due to certainty equivalence there is no difference between a stochastic news shock and a deterministic shock. See https://github.com/DynareTeam/dynare/blob/master/tests/forecast/Hansen_exo_det_forecast.mod

Dear Johannes Pfeifer

Thank you, once more.

Please drop z from that equation and limit it to the consumer’s Euler equation. If you run the script, using either simul or stoch_sim, the two shocks are not recognized. The script, as is, only recognizes one of them.

Best,
Jose

You cannot combine deterministic shocks and stochastic shocks for varexo. You would need to use `varexo_det` for the deterministic ones.

The solution I suggested relies on news shocks instead. It would be

``````%Variables
var yd cd gd ed id pip ld mud mg m bd rd tdb Ud  p t w n at z;% tdb;
varexo  eps_g eps_t eps_a z0 z1 z2 z3;
%Parameters
parameters sigma v B lambda theta a ep phi eta rho psib b x rhog rhot mu mp mw rhot ra;% rhot;
sigma = 1.0; %sigma -C*Ucc/Uc
v = 0; %separable real balances v = LUcl/Uc
B = 0.995;
%lambda = 0.0282;
theta = 3/4;%price regidity
a = 0.25;
ep = 9;
phi = 5;% phi = NVnn/Vn
eta = 7;%Gali 2017 eta = 7; Gali 2014 eta = 4
rho = (1-B)/B;
psib = 0.02;
b = 2.4;
x = 1/3;%Gali 2014 considers 1/4 while Gali 2017 assumes 1/3
rhog = 0.50;
rhot = 0.5;
ra = 0.50;
%mu = mp*mw;
mu = 1.44;
mp = 1.125;
mw = 1.28;
lambda = (1-theta)*(1-B*theta)*(1-a)/(theta*(1-a +a*ep));
%psib = 1+rho-0.90;

%Model

model(linear);
yd = cd + gd; %yd=log(Yt/Y) cd=log(Ct/C) gt follows AR(1) process. Equilbria is considered around the steady state with zero inflation and zero government purchases
ed = ed(+1) + id -pip(+1)+ z; %ed =log(Uc,t/Uc)
z=z0 + z1(-1)+ z2(-2)+ z3(-3);
ed = -sigma*cd + v*ld  ;%ld = log(Lt/L)
pip = B*pip(+1) - lambda*mud;
mud = ed - ((a+phi)/(1-a))*yd;
ld = cd - eta*id;
ld = m - p;
%id = 0;
ld = ld(-1) -pip + mg;
mg = m - m(-1);
bd = (1+rho-psib)*bd(-1) + b*(1+rho)*(id(-1) - pip)-t - x*mg;%+tdb -x*mg; %exogenous tax rebates (increase in government spending) are assumed to be zero
gd = rhog*(gd(-1))+ eps_g;
%tdb = rhot*(tdb(-1))+ eps_t;
mg = (1/x)*(-1*t + b*(1+rho)*(id(-1) -pip));%money financed- it is assumed that seignorage is adjusted such that real debt is unchanged; otherwise consider the line below
%mg = -t/x;
%id = 1.5*pip;%debt financing with a Taylor rule
%pip = 0; %inflation targeting
rd = id -pip(+1);
Ud = (1- 1/mu)*yd - gd + x*(1-B)*ld; %Ud = UcC* rhs : Welfare effects
tdb = psib*bd(-1) + t;
t = rhot*t(-1) - eps_t;
w = p + cd + phi*n;
n = (yd -at)/(1-a);
at = ra*(at(-1)) + eps_a;%***
end;

check;

stoch_simul(order=1);

//initialize IRF generation
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in columns
// set z to 1 for four periods via news shocks
shock_matrix(1,strmatch('z0',M_.exo_names,'exact')) = 1;
shock_matrix(1,strmatch('z1',M_.exo_names,'exact')) = 1;
shock_matrix(1,strmatch('z2',M_.exo_names,'exact')) = 1;
shock_matrix(1,strmatch('z3',M_.exo_names,'exact')) = 1;
// set t shock
shock_matrix(1,strmatch('eps_t',M_.exo_names,'exact')) = 1;

y2 = simult_(initial_condition_states,oo_.dr,shock_matrix,1);
y_IRF = y2(:,M_.maximum_lag+1:end)-repmat(oo_.dr.ys,1,options_.irf); %deviation from steady state
// manually select variables for figure
figure
subplot(2,1,1)
plot(y_IRF(strmatch('yd',M_.endo_names,'exact'),:)); % use strmatch to select values
title('Output');
subplot(2,1,2)
plot(y_IRF(strmatch('z',M_.endo_names,'exact'),:));
title('z');
``````

Dear Johannes Pfeifer,

I say you are a scholar and a gentleman.

As a next step, I will try to run the program and digest your codes w.r.t. the IRF generation. In the meantime, I was wondering about formulating the shock to t (taxes) as a deterministic process, such as t = rhot^n with n = 0, 1,…, thus ending up with deterministic shocks (only).

Thank you so much for your time and patience.

Best regards,
Jose

You can do that, but then you should have a nonlinear model if the shock process you have in mind is nonlinear.

Dear Johannes Pfeifer,

I trust I am not imposing on you.

I proceeded with the work. The nonlinearity was apparently dealt with, as described in lines 74-76. Do you agree?

Upon running the model each variable contains n+2 figures, n being the number of simulations. The first number in the vector equals invariably 0. My understanding is that it represents the initial s.s…The last number is also 0. What is it? If I want to obtain a graph (Matlab may be more user friendly) how can this last digit be eliminated?

When considering a debt-financed fiscal stimulus, I was able to set a lower bound to the nominal interest rate (id) using line 65 to specify a ZLB restriction. How can I extend this restriction to a money-financed fiscal stimulus? I tried the specification 67 (id>0), as well as a deterministic shock (lines 82-84) to no avail. Any recommendation?

Best regards,
Jose

MFDA.mod (2.5 KB)