# Dynare Simulation: baseline New Keynesian model

Dear Professor Jpfeifer,

Please I need a help on this:

The objective is to analyse a version of the baseline New Keynesian model in which there are three shocks: interest rate shocks, cost-push shocks and aggregate demand shocks. The basic structure of the model is a dynamic IS curve, a Phillips curve, and a simple rule for monetary policy. Please see attached for detailed information.
Dynare Simulation.docx.pdf (207.9 KB)

Please see the earlier attached document for detailed information regarding the questions. Meanwhile, here are few questions that I really need to address:

1. Which are the backward-looking variables in the model? Which are the forward-looking variables?
2. Calculate via simulation the following stylised facts of this model economy: volatility, autocorrelation and correlations between output gap, inflation and interest rate.
3. Show the responses of interest rates, output gap and inflation to the three different shocks. Explain using the model, the intuition for the response of each type of shock.
4. Use the forecast error variance decomposition to verify which of the three shocks contributes most to fluctuations in interest rates, the output gap and inflation.

Regards,
Maxwell

Dear Professor Jpfeifer,

The attached document provides some models that need to be simulated and calibrated using dynare. I am new to dynare simulation, hence need your assistance to model that. Your assistance will be highly appreciated.

Regards,
Maxwell

Sorry, but these are not Dynare questions, but rather look like a problem set from a university course. You need to put in some effort yourself. Some of the stuff is really basic and is mainly a variant of https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Gali_2015_chapter_3.mod
Also note that the AR-processes have an incorrect timing. If the dependent variable is dated t+1, the shock needs to have the same timing.

Dear Professor Jpfeifer,

Thank so much for your response. I recently included learning and using Dynare to solve problems in DSGE models in one of the courses that I am teaching at the University. I visited some few Dynare users’ websites and drafted those questions for the purpose of teaching and learning. Hence, the problem set is actually from a university course designed to learn, teach and understand modelling DSGE models using Dynare.

I have made an effort to answer few questions via simulation. However, I need someone who is an expert to double check the work to ensure that the work is properly done for me. I have few challenges in the process of trying to solve those questions. How is volatility computed in Dynare? How do we identify forward-looking and backward-looking variables in Dynare? Given a loss function, how is welfare function calculated in Dynare? These are very few challenges that I need help. Meanwhile, I tried to calculate welfare function based on the Mod files I downloaded from your link but I encountered further challenges.

Please find attached the progress I have made. Please assist me to calculate welfare function of this economy. Your assistance on this direction will be highly appreciated.

// Declare variables

var y pi i g mu upsilon;
varexo g1 g2 g3;

parameters sigma beta phip omega alpha kappa rho1 rho2 rho3;
//Value of parameters

sigma = 1;
beta = 0.99;
phip = 1.5;
omega = 0.5;
alpha = 3;
kappa = ((1-omega)(1-betaomega)/(alpha*omega));

rho1 = 0.3;
rho2 = 0.8;
rho3 = 0.5;

model;
y = y(+1) - (1/sigma)(i - pi(+1)) + g;
pi = beta
pi(+1) + kappay + mu;
i = phip
pi + upsilon;
g = rho1g(-1) + g1;
mu = rho2
mu(-1) + g2;
upsilon = rho3*upsilon(-1) + g3;
end;

initval;
y = 0;
pi = 0;
i = 0;
end;

shocks;
var g1; stderr 1;
var g2; stderr 0.5;
var g3; stderr 1;
end;

stoch_simul(linear,irf=20)i,pi,y;

=======================================================================

// Welfare analysis

// Declare variables
var y pi i g mu upsilon;

@#define Ramsey_policy_timeless=1
@#define Ramsey_policy_t0_optimal=0
@#define discretionary_policy=0

varexo g1 g2 g3;

parameters sigma beta phip omega alpha kappa rho1 rho2 rho3;
//Value of parameters

sigma = 1;
beta = 0.99;
phip = 1.5;
omega = 0.5;
alpha = 3;
kappa = ((1-omega)(1-betaomega)/(alpha*omega));

rho1 = 0.3;
rho2 = 0.8;
rho3 = 0.5;

model(linear);
y = y(+1) - 1/sigma*(i - pi(+1)) + g;
pi = betapi(+1) + kappay + mu;
i = phippi + upsilon;
g = rho1
g(-1) + g1;
mu = rho2mu(-1) + g2;
upsilon = rho3
upsilon(-1) + g3;
end;

initval;
y = 0;
pi = 0;
i = 0;
end;

planner_objective(pi^2 + y^2);
ramsey_model(planner_discount=0.99);