Running Simple DSGE Model in Dynare II – The Results

In the previous article, we described the simple DSGE model and prepared source code to run this code in Dynare. Today we will go through results of the simulation. We will explain the most important outputs and we will make an economic interpretation of them. Just to remind you, you run the model by typing the following command into your Octave or Matlab console.

dynare model.mod

I saved the model into a file named model.mod. Also, make sure that your current directory is the one where the file is stored. I used Octave for the simulation because I don’t have a Matlab license. However, you should get the same results using Matlab.


Dynare computes the steady-states values. The values are computed numerically. If you have no knowledge of principles of numerical analysis, you can read something about it on Wikipedia. To perform the numerical approximation of steady-state, we need some initial point. This initial point must be “close” to real steady-state values. If it’s too far, the computation would take too much time or Dynare would stop computation before finding the solution.

I provided some initial values in the Dynare code. But what would we do if we didn’t have them? In our case, it would be possible to directly compute the steady-state, because our model is really simple. The computation will also help you to understand what the steady-state is.

Direct computation of the steady-state

If the economy is in the steady-state, it would stay in the steady-state forever (if no external impulse come). In other words, if we have steady-state values for consumption, capital, and labor in one time period, we would have exactly the same values in next period (if the exogenous shock doesn’t come). To compute the steady-state, we remove time indexes from are equations.

This is our Euler euqation without time indexes.

\frac{1}{\bar{c}} = \beta \frac{1}{\bar{c}} \left[ A \cdot \bar{k}^{\alpha - 1} \cdot \alpha \cdot \bar{n}^{1-\alpha} + 1 - \delta \right]

We can immidiately emilinate the \frac{1}{\bar{c}} because now we have the exactly same variable on both sides of euqation.

1 = \beta \left( A \cdot \bar{k}^{\alpha - 1} \cdot \alpha \cdot \bar{n}^{1-\alpha} \right) + \beta \left( 1 - \delta \right)

Let’s now shift the second part of the right side to the left.

\beta \left( \delta  - 1 \right) + 1 = \beta \left( A \cdot \bar{k}^{\alpha - 1} \cdot \alpha \cdot \bar{n}^{1-\alpha} \right)

Now we will divide the equation by $latex \bar{k}^{\alpha – 1} $.

\left[ \beta \left( \delta  - 1 \right) + 1 \right] \bar{k}^{1-\alpha} = \beta \left( A \cdot \alpha \cdot \bar{n}^{1-\alpha} \right)

Now we will idenfity a “relationship” between kapital and work. Kapital and labor are in fixed proportion which is given by the parameters values.

\bar{k}^{1-\alpha} = \frac{ \beta \cdot A \cdot \alpha}{ \beta \left( \delta  - 1 \right) + 1 } \cdot \bar{n}^{1-\alpha} 

Now we will do the last update to get the k variable which we could substitute to another equation.

\bar{k} = \sqrt[1-\alpha]{ \frac{ \beta \cdot A \cdot \alpha}{ \beta \left( \delta  - 1 \right) + 1 }} \cdot \bar{n}

Now we need the second first order condition.

\bar{c} \cdot \psi  = [ A \cdot \bar{k}^{\alpha} \cdot \bar{n}^{-\alpha} \cdot (1 - \alpha ) ]  \, .

We will subsitute the kapital variable.

\bar{c} \cdot \psi  = \left[ A \cdot \left( \frac{ \beta \cdot A \cdot \alpha}{ \beta \left( \delta  - 1 \right) + 1 } \right)^{\frac{\alpha}{1-\alpha}} \cdot \bar{n}^{\alpha} \cdot \bar{n}^{-\alpha} \cdot (1 - \alpha ) \right]  \, .

We can easily eliminate the labor variable and we can calculate the value of c variable because there is no variable left on the right side of the equation.

\bar{c} = \frac{ A \cdot \left( \frac{ \beta \cdot A \cdot \alpha}{ \beta \left( \delta  - 1 \right) + 1 } \right)^{\frac{\alpha}{1-\alpha}} \cdot (1 - \alpha )}{\psi}  \, .

To make following computation easier, we will create a new constant denoted by X . This constant is defined as X = \sqrt[1-\alpha]{ \frac{ \beta \cdot A \cdot \alpha}{ \beta \left( \delta  - 1 \right) + 1 }} . Now we will proceed to the equation of law of capital motion:

\bar{c} + \bar{k} - (1 - \delta) \cdot \bar{k} = A \cdot \bar{k}^{\alpha} \cdot \bar{n}^{1-\alpha} \, .

We will make a subsitution for the capital variable:

\bar{c} + X \cdot \bar{n} - (1 - \delta) \cdot X \cdot \bar{n} = A \cdot X^{\alpha} \cdot \bar{n}^{\alpha} \cdot \bar{n}^{1-\alpha} \, .

We can simplify the euqation to:

\bar{c} + X \cdot \bar{n} - (1 - \delta) \cdot X \cdot \bar{n} = A \cdot X^{\alpha} \cdot \bar{n} \, .

We will move all parts with n on the right side and others on the left:

X \cdot \bar{n} - (1 - \delta) \cdot X \cdot \bar{n} - A \cdot X^{\alpha} \cdot \bar{n} = - \bar{c} \, .

Now we will separate the variable:

\bar{n} \left( X - (1 - \delta) \cdot X - A \cdot X^{\alpha} \right) = - \bar{c} \, .

Finally, we have a formula to computate the steady-state value of n:

\bar{n} = \frac{-\bar{c}}{ X - (1 - \delta) \cdot X - A \cdot X^{\alpha} } \, .

Now we are finished. We could calculate the steady-state values by hand, but we will use Octave. Below you can see a simple script which calculates and displays the result.


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

You should get the following result:


So the steady-state values are

\bar{c} = 2.7731 \, , \bar{n} = 0.57074 \, \bar{k} = 39.502 \, .

Now we will check the results.

Running the simulation in Dynare

Let’s assume you save the script into the model.mod file. You can run it by entering a command

dynare model

into Octave or Matlab console. We will go through the result.

In the beginning, there are some system messages, which are not interesting for us.

Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Starting Dynare (version 4.4.3).
Starting preprocessing of the model file ...
Found 4 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

Below you can see the steady-state numeric approximations:


c 2.77311
k 39.5018
n 0.570743
z 0

As you can see, these values equal to our results above. There would be probably some difference between them because Dynare gives us only numeric approximations of exact values, but we have confirmed that our calculations were correct.

Eigenvalues and policy transition functions follow. These are quite complicated topics so I will write a new article about them.

Modulus Real Imaginary

4.89e-016 -4.89e-016 0
0.9 0.9 0
0.9438 0.9438 0
1.075 1.075 0
2.553e+018 2.553e+018 0
Inf Inf 0

There are 3 eigenvalue(s) larger than 1 in modulus
for 3 forward-looking variable(s)

The rank condition is verified.


Number of variables: 4
Number of stochastic shocks: 1
Number of state variables: 3
Number of jumpers: 3
Number of static variables: 0


Variables e
e 0.000100

c k n z
Constant 2.773109 39.501820 0.570743 0
z(-1) 1.032572 7.717402 0.713808 0.900000
c(-1) -0.046072 -0.980014 0.004805 0
k(-1) 0.046537 0.989913 -0.004853 0
e 0.904237 3.404554 0.818469 1.000000

Here we have theoretical moments – mean, standard deviation and variance. The mean should be close to steady-state values. Dynare made a simulation of models for several time periods and then calculated these moments.


c 2.7731 0.0949 0.0090
k 39.5018 1.7822 3.1764
n 0.5707 0.0156 0.0002
z 0.0000 0.0229 0.0005

Here we have the matrix of correlation.


Variables c k n z
c 1.0000 0.9895 0.3088 0.7034
k 0.9895 1.0000 0.1678 0.5931
n 0.3088 0.1678 1.0000 0.8932
z 0.7034 0.5931 0.8932 1.0000

We also want to know if the variable depends on its own values from previous time periods.


Order 1 2 3 4 5
c 0.9942 0.9836 0.9691 0.9514 0.9310
k 0.9972 0.9892 0.9769 0.9609 0.9419
n 0.8510 0.7197 0.6041 0.5025 0.4134
z 0.9000 0.8100 0.7290 0.6561 0.5905

At the end, we have some technical information (again not interesting).

warning: print.m: epstool binary is not available.
Some output formats are not available.
warning: called from
__print_parse_opts__ at line 385 column 9
print at line 283 column 8
dyn_saveas at line 41 column 5
stoch_simul at line 256 column 21
model at line 140 column 6
dynare at line 180 column 1
Total computing time : 0h00m01s
Note: warning(s) encountered in MATLAB/Octave code

Impulse Response Functions

Our code also provides a graphical output. The curves on the plot are called impulse response function. You can them on the pictures below. The curves show us how the economy react on the stochastic shock. On the y-axis, you can see a deviation from steady-state (and steady-state value of stochastic shock is 0). The red line represents the steady state. The x-axis represents time. The shock has a value of standard deviation of the random variable. As you can see, the curve is at the point 0.01 on the y-axis on the right lower corner plot. The random variable is 0 for all time periods except the first one. But the value of shock doesn’t go immediately to zero because the shock value partly depends on its own value from the previous period.

How could we interpret this plot? The household would work more than in steady state between 0 and approx. 15 time period. After that, it will work less. Also, the household increases both consumption and investment (it is possible because production was increased by the shock).


But does the economy go back to the steady-state? And how far? It is hard to say. But we can easily ask Dynare to show us the response function for a longer period (like 100). We just need to update the last line of our code:


Now we run the code again. We can see, that the model goes back to its steady state.


It would be interesting to see how the amount of production changes or to see how the steady-state values depend on parameters value. We will focus on these issues in next article.

Trackbacks and Pingbacks

[…] 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. […]


[…] previous articles, we went through a simple DSGE model. We computed first order conditions and steady-state equations and we ran a simulation in Dynare. Maybe some of you were confused by one thing: there was no firm […]


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

You may use these HTML tags and attributes:

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

%d bloggers like this: