I’m trying to do a surface analysis of the loss function of a DSGE model.
I have tried several ways, but I cannot find the solution, I would like to make a graphic similar to the one attached below.
in my case the surface should be made up of the inflation coefficient, the output gap coefficient and the loss function.
I hope you give me some hints.
you need mesh command, but be careful of your order, that is,
if L(phiP, phiX) is taken from Ls(phiPs, phiXs), then you should type
mesh(phiXs,phiPs,Ls);
instead of
mesh(phiPs,phiXs,Ls);
The other error dynare reports is BK condition violated, if you temporarily erase noprint in your stoch_simul. You need to quantify your phiP greater than 1. Here I set phiPs to start from 1.1
So I add and modify some codes as follows:
phiPs = 1.1:0.5:3.1;
phiXs = 0:0.5:3;
Ls = -Inf*ones(length(phiPs),length(phiXs));
for ii = 1:length(phiPs)
phiP = phiPs(ii);
for jj = 1:length(phiXs)
phiX = phiXs(jj);
stoch_simul(order=1, nograph, noprint)
x y bl piD pi pD p ti er Der i il rR M a g iS pS;
Then I slightly rearrange some parts of your codes, to let Dynare compute moments in each iteration. Your original codes may not work very well for the mission of “looping over parameters”.
Because welfare is a second order property that cannot be computed within a first simulation. Hence, you need to recover the variances outside of the model block.
Thank your for the clarifation. Can we have a code that include the model variable (not L as above), so that we can develop a mesh plot with two paramteres varying in the loop. I want to replace L with the model variable from the model, but I am unable to do so.
That is okay sir. My point is considering the above mod file and the code. If I want to examine the response of x (which is a variable in the model), due to any of the shocks as mentioned in the model, when the paramters sigma and delta are changing in some interval, say like sigma = start value:0.1:end value; delta = start value:0.1:end value; How can I do that through the loop and generate the Ls(ii,jj)=x;. So that I can develop the mesh plot as mesh(sigma,delta,x). Sorry, If I could not pose my question rightly. Can you please refer to some code.
Thank you for your response.
I am interested in IRF when two parameters vary at the same time for the above example. Can you please share some code or refer to some loop.
Dear Sir,
From the attached mode file, I want to create a mesh plot, after examining the impact of monetary policy shock (epsR in the mod file) on interest rate (MP rule) when psi1 and psi3 ranges between (0:0.1:1.5) and (0:0.1:1) at a time. In the contour plot, I want my x-axis as psi1; y-axis as psi3 and the final effect on interest rate as z-axis like the one in this thread above. CA_LS07_s.mod (2.8 KB).
Hope for your assistance.