Running Simple DSGE Model in Dynare III – Further Analysis

Last time we analyzed the steady-state of our model. We have developed equations which we can use to calculate the steady-state values for given parameters values. Today, we use these equations to see how could changes in parameters values affect the variables values. We can use the Octave (or Matlab) script which we developed last time. We just do minor updates. We select one variable and we assign a range of value instead of single value to this variable.

Let’s take parameter \psi . We would expect that lower values of this parameter would mean that the household would work more and also consume more because its willingness to work would increase. Let’s test our theory. We will examine an interval between 1.0 and 1.8. We will ask Octave to generate a vector of values between these two boundaries. We will to it by this command:


The value in the middle sets a size of space between these two values. In fact, this values defines the size of the vector. The value 0.001 is small enough to provide us a smooth plot. We also substitute all *, / and ^ operators with .*, ./ and .^. The standard operators without dots are used to operations with two numbers, two vectors or two matrices. But in our case, we want to multiply (or divide or power) all values of the vector by a single value. This is completely different operation than multiplying two vectors or two matrices. That’s why we use the operators with dots.

So this is our code.


c=((A.*(beta.*A.*alpha)./(beta.*(delta-1)+1)).^(alpha./(1-alpha)).*(1-alpha))./psi ;
subplot (3, 1, 1);
subplot (3, 1, 2);
subplot (3, 1, 3);

We use the subplot command to generate three plots in one window – one plot for each variable. As we can see on the image below, our assumption was right. Higher values of the \psi parameter result into higher consumption and higher labor supply. It also means that there will be more capital in the economy.


Let’s analyze one more parameter. I have selected \alpha . If we increase the value of this variable, we would increase the marginal productivity of capital and decrease the marginal productivity of labor. Consumers will probably react by increasing its savings and decreasing the time spent in work. Is this statement true? We can check it on the picture below.


So far, we have been changing the value of one parameter, leaving the other parameters constant. But can we change values simultaneously? Yes, we can? The result will be a three-dimensional plot. We will use the mesh command to render the plot. We also need the meshgrid command to generate a matrix of values which is a combination of all values from both of the vectors. In this case, the “dot operators” perform the operation on all values of the matrix.

We will change values of \alpha and \psi .This is the final code. I rotate the plot by R command before saving it. (Please note that this is an Octave/MATLAB code, not Dynare code.)

talpha = linspace (0.9, 0.5, 200)';
tpsi = linspace (1.2, 1.8, 200)';
[alpha, psi] = meshgrid (talpha, tpsi);


c=((A.*(beta.*A.*alpha)./(beta.*(delta-1)+1)).^(alpha./(1-alpha)).*(1-alpha))./psi ;

mesh(talpha, tpsi, n);

Here you can see the result. As you can see, decreasing of both parameters simultaneously causes the household to work less.


Let’s try one more combination. What would do a change of \alpha and \delta with the capital stock? As we can see from the plot, lowering the  \alpha and increasing the \delta causes the capital stock to decrease.



Thank you so much for your sharing. Can you please help me to review the error?
ERROR: DSGE2.mod: line 38, col 1 – line 42, col 0: syntax error, unexpected $end
Error using dynare (line 217)
DYNARE: preprocessing failed


    Could you please post me the code that gives you the error? If you don’t want to share it publicly, you can send it to me via the contact form (link is above).


      Hi Jiří Pešík,

      When I run the code in Dynare and it showed below error.

      However, when I tried to run same code in the matlab file .m , it is successful.

      I wonder whether the code is written in .mod or .m?

      Thank you again for your support.

      Sent from Mail for Windows 10


      Hi, thank you for your response. You are right – I have forgotten to write that the code in this article is a Matlab/Octave code, not Dynare code. So the .m extension is right. I will update the article, thank you for your feedback!


      ANOTHER ISSUE WITH THE STEADYSTATE var c k l z w r y i n a mu; varexo e; parameters alpha beta delta psi sigma A rho; alpha = 0.4; beta = 0.95; delta = 0.1; psi = 2; sigma = 0.01; rho = 0.9; model; c(-1) + a = w(-1) * l(-1) + r(-1) * a(-1) + (1) * a(-1); 1/c = beta * 1 / c(+1) * (r(+1) + 1); psi / (1 – n) = w / c; i = a – a(-1); y = exp (z) * k ^ (alpha) * l ^ (1 – alpha); mu = r + delta; w = A * exp(z) * k ^ alpha * (1 – alpha) * l ^ (- alpha); mu = A * exp(z) * alpha * k ^ (alpha – 1) * l ^ (1 – alpha); y = c + i; n = l; z = rho*z(-1)+e; end; initval; l = 0.28904; k = 1.4398; c = 0.40543; w = 1.1405; r = 0.15263; y = 0.54941; i = 0.14398; z = 0; e = 0; end; steady; check;

      shocks; var e = sigma^2; end;


      Sent from Mail for Windows 10


Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: