# Estimation and Stoch\_simul

**URL:** <https://forum.dynare.org/t/estimation-and-stoch-simul/6076>\
**Category:** Dynare help (legacy posts)\
**Created:** [13 March 2017 12:11 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076 "2017-03-13T12:11:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![KKLS](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@KKLS](https://forum.dynare.org/u/KKLS)\
**Post date:** [13 March 2017 12:11 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/1 "2017-03-13T12:11:14Z")

</div>

Hi Prof. and to all,

I have two questions regarding the HBayesian estimation (which I could not figured out by reading the dynare.pdf)  
I know after running the estimation(mode\_compute=4, …mh\_replic=3000, … ) command I can run the stoch\_simul(…) command.

1. What is the difference between plugging the option [moments\_varendo] inside the estimation command  
(which computes the theoretical moments of the posterior distribution) , and  
NOt plugging this option but running the stoch\_simul(…) command instead of it (which as I know computes theoretical moments  
using posterior means (as I know it) .

my second question is :

1. following question (1) is there a way I can run the stoch\_simul not with the posterior mean but rather with the posterior\_median.

these two I could not figure out from the dynare.pdf (though the second question might be very simple)

Thanks a lot for any suggestions I can get !

---

<div class="post-metadata">

**Author:** ![KKLS](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@KKLS](https://forum.dynare.org/u/KKLS)\
**Post date:** [17 March 2017 17:59 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/2 "2017-03-17T17:59:55Z")

</div>

Hi can someone help me with the questions in the previous post pls ?

Prof. Pfeifer your comment would be appreciated!

---

<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:** [17 March 2017 18:18 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/3 "2017-03-17T18:18:39Z")

</div>

1. Estimation will provide the posterior mean of the objects while stoch\_simul will provide the objects at the posterior mean. Due to Jensen’s Inequality, these are two conceptually very different things.
2. Add

`xparam1 = get_posterior_parameters('median');
M_ = set_all_parameters(xparam1,estim_params_,M_);
`  
between estimation and stoch\_simul.

---

<div class="post-metadata">

**Author:** ![KKLS](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@KKLS](https://forum.dynare.org/u/KKLS)\
**Post date:** [18 March 2017 18:20 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/4 "2017-03-18T18:20:17Z")

</div>

1. I got the second question. Thank you very much Professor. Very helpful.

2. I am not quite clear about the first issue Professor.

1.a) When we talk about the theoretical moments following an estimation  
which one is commonly used - the option [moments\_varendo] or [stoch\_simul] Professor ?

If the [stoch\_simul] is used commonly, then when is [moments\_varendo] used and vice versa ???

Thank you very much for your time in this learning process Professor.

---

<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:** [18 March 2017 18:54 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/5 "2017-03-18T18:54:19Z")

</div>

Please have a look at [[Variance Decomposition](https://forum.dynare.org/t/variance-decomposition/4596/1))

---

<div class="post-metadata">

**Author:** ![KKLS](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@KKLS](https://forum.dynare.org/u/KKLS)\
**Post date:** [20 March 2017 16:31 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/6 "2017-03-20T16:31:36Z")

</div>

Thanks Prof. Pfeifer!

It’s clear now what you meant !

As I obtained the moments with estimation(…,moments\_varendo,…) I checked the results. But what I get for the correlations for example is:

a cell arrray of the form ‘‘oo\_.PosteriorTheoreticalMoments.dsge.correlation.Mean.y.y’’

A quick observation is that:  
[1]. there are 5 values within that , and  
[2]. none of them is = 1 (as I would expect the correlation(y,y) = 1 no matter whether is average at th mean or mean of the average )

Regarding [1] Could it be due to the default option of [ar=5] ??  
I do not understand [2] though .

---

<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:** [20 March 2017 16:40 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/7 "2017-03-20T16:40:43Z")

</div>

From the manual on

```auto

```

[quote]Auto- and cross-correlation of endogenous variables. Fields are vectors with correlations  
from 1 up to order options\_.ar[/quote]

You would get the 1 you are looking for with the

```auto

```

in

```auto

```

---

<div class="post-metadata">

**Author:** ![KKLS](https://forum.dynare.org/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@KKLS](https://forum.dynare.org/u/KKLS)\
**Post date:** [20 March 2017 17:18 UTC](https://forum.dynare.org/t/estimation-and-stoch-simul/6076/8 "2017-03-20T17:18:48Z")

</div>

I see.  
That’s a separate option of ‘‘estimation’’ - command.

Many thanks Professor.
