# What are "theoretical moments" referring to?

**URL:** <https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735>\
**Category:** Stochastic simulations\
**Created:** [29 May 2015 22:54 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735 "2015-05-29T22:54:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![basil.random](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/48db29/32.png) [@basil.random](https://forum.dynare.org/u/basil.random)\
**Post date:** [29 May 2015 22:54 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/1 "2015-05-29T22:54:39Z")

</div>

Hi,

I apologize if this questions has been asked before or if it is trivial. I do not understand what the “THEORETICAL MOMENTS” produced by stoch\_simul are.

For reference, I am trying to understand Sims’ tutorial [here](http://www3.nd.edu/~esims1/using_dynare.pdf). I’ve attached the code.

Are the “theoretical moments” the moments from a simulation? If so, how do I access (e.g. plot) this simulation? (Is it the same simulation Sims references?) Are they the moments of the series under the impulse response?

Perhaps this is the essence of my question: If I run a simulation of the model (see the Sims tutorial), should the moments of the simulated series be approximately equal to the theoretical moments?

[size=85]For context, if it helps at all, my goal is:

- simulate the basic New Keynesian model under three different interest rate rules
- examine the variance of inflation/output gap in the simulated models under each interest rate rule  
[/size]

Thanks so much!

– BH  
[Sims.mod](https://forum.dynare.org/uploads/default/original/2X/0/02a2df5c85f9c971ac099d41da0d254fb7dd95df.mod) (2.38 KB)

---

<div class="post-metadata">

**Author:** ![basil.random](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/48db29/32.png) [@basil.random](https://forum.dynare.org/u/basil.random)\
**Post date:** [30 May 2015 20:39 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/2 "2015-05-30T20:39:25Z")

</div>

Update: for anyone else curious about this, I believe I understand the answer.

If you do “stoch\_simul” without doing a simulation (i.e., without specifying “periods=INTEGER”), then Dynare will use perturbation techniques to estimate the “theoretical moments” of your variables.

If you do “stoch\_simul(…,periods=INTEGER)” – i.e., you do have Dynare perform a simulation – then Dynare will print the “approximated moments”, which are the empirical moments of your simulation.

(As a side note, you can of course include ‘hpfilter = INTEGER’ to HP filter your model and its moments.)

[![](https://i1.kym-cdn.com/entries/icons/original/000/014/033/knowing.jpg) ](https://i1.kym-cdn.com/entries/icons/original/000/014/033/knowing.jpg)

[size=200]Edit: if anyone can confirm that the above is correct, that would be great.[/size]

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [31 May 2015 11:04 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/3 "2015-05-31T11:04:01Z")

</div>

At `order=1`, the solution to your model has a the form of a linear state-space model. This can be used to analytically compute the endogenous moments. See e.g. Hamilton (1994): Time Series Analysis. This is what Dynare does when you request theoretical moments (`periods=0`). In case of `order=2`, Dynare provides a second-order accurate approximation to the true second moments based on the linear terms of the second-order solution (see Kim, Kim, Schaumburg and Sims (2008)).

If you specify periods\>0, Dynare will instead simulate data series based on the perturbation solution to your model and compute the moments of these simulated series.

---

<div class="post-metadata">

**Author:** ![basil.random](https://forum.dynare.org/letter_avatar_proxy/v4/letter/b/48db29/32.png) [@basil.random](https://forum.dynare.org/u/basil.random)\
**Post date:** [31 May 2015 16:14 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/4 "2015-05-31T16:14:46Z")

</div>

Thank you so much Johannes! (And thank you for being so willing to answer questions on this forum.)

---

<div class="post-metadata">

**Author:** ![Alexander.dsge](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/b5ac83/32.png) [@Alexander.dsge](https://forum.dynare.org/u/Alexander.dsge)\
**Post date:** [13 February 2017 13:58 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/5 "2017-02-13T13:58:11Z")

</div>

Dear Johannes,

I have a question that is highly related to this thread, thus I have chosen to put it here.  
The question is what difference does it make for the theoretical moments whether one includes or “ignores” (comment out) the other shochs when looking at a particular shock in the model?

In my model, I got the following shocks:

“shocks;  
var eps\_a; stderr 1.00; // DK tech shock  
// var eps\_u; stderr 1; // DK cost push shock  
// var eps\_g; stderr (100/27); // DK fiscal shock  
// var eps\_a\_os; stderr 1; // Eura Area tech shock  
// var eps\_v; stderr 0.4; // Euro Area monetary policy shock  
// var eps\_u\_os; stderr 1; // Euro Area monetary policy shock  
end;”

I have tried to run my model having either all the shocks “ignored” in dynare (having “//” on all lines of the shocks but one) or activated (no “//” like below)

“shocks;  
var eps\_a; stderr 1.00; // DK tech shock  
var eps\_u; stderr 1; // DK cost push shock  
var eps\_g; stderr (100/27); // DK fiscal shock  
var eps\_a\_os; stderr 1; // Eura Area tech shock  
var eps\_v; stderr 0.4; // Euro Area monetary policy shock  
var eps\_u\_os; stderr 1; // Euro Area monetary policy shock  
end;”

These two methods yield different theoretical moments for my endogenous variables, how come? How should I interpret this?

Looking at the variance decomposition of the first version (with all shocks but one commented out), it seems the other shocks do matter for many of the variables. I don’t follow what exactly is going on. I hope you will have a look at this. Thank you very much.

Attached are my dynare code as well as a pdf having these results I have reported.  
[help\_dynare\_forum.pdf](https://forum.dynare.org/uploads/default/original/2X/9/91d3f79528a3fdc009caba93a68256542798bec3.pdf) (248 KB)

Thank you very much.

Kind regards,  
Alexander

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [13 February 2017 15:21 UTC](https://forum.dynare.org/t/what-are-theoretical-moments-referring-to/4735/6 "2017-02-13T15:21:25Z")

</div>

I am not sure I understand your question. Your DSGE model essentially is a VARMA process. Say for simplicity, is has a representation as a finite order VAR process. Of course it matters for the moments of this VAR which shocks are present. The same applies to the variance decomposition, which measure the relative contribution of a particular shock to the forecast error variance of the endogenous variables.
