# Variance Decomposition command

**URL:** <https://forum.dynare.org/t/variance-decomposition-command/12313>\
**Category:** BVAR\
**Created:** [25 August 2018 20:40 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313 "2018-08-25T20:40:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![35224129ty](https://forum.dynare.org/letter_avatar_proxy/v4/letter/3/bb73d2/32.png) [@35224129ty](https://forum.dynare.org/u/35224129ty)\
**Post date:** [25 August 2018 20:40 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/1 "2018-08-25T20:40:23Z")

</div>

Hi,

May I ask a question about the variance decomposition. After reading the manual and several posts, I am learning how to do it in dynare. Specifically, how to write the command in the programme.  
Here is the command I wrote,  
ms\_variance\_decomposition(file\_tag =mod\_file, output\_file\_tag =tag\_file, simulation\_file\_tag =sim\_file\_tag, horizon =12, no\_error\_bands, shock\_draws =10000, shocks\_per\_parameter =10 , thinning\_factor =1, free\_parameters = [0.5127,0.6799, 0.3041,1.0732,0.5017,0.7911,0.5137,0.7413,0.9988,0.9906,0.9179,0.9497], parameter\_uncertainty, regimes);  
However, I got an error,  
MS-SBVAR Variance Decomposition  
Error using set\_ms\_estimation\_file (line 39)  
ERROR: Could not find free parameter file: est\_free\_mod\_file.out

Error in ms\_variance\_decomposition (line 36)  
[options\_, oo\_] = set\_ms\_estimation\_file(options\_.ms.file\_tag, options\_, oo\_);

Error in sme\_estimation (line 521)  
[options\_, oo\_] = ms\_variance\_decomposition(M\_, options\_, oo\_);

Error in dynare (line 180)  
evalin(‘base’,fname) ;

It seems the problem is related to the ‘free parameter’ option. So could anyone help me to correct the mistakes I have in the command above.

Many thanks

[mydata.mat](https://forum.dynare.org/uploads/default/original/2X/3/3783c4b5dca6f6065c0a3d639ce358f63386667c.mat) (5.3 KB)

[sme\_estimation.mod](https://forum.dynare.org/uploads/default/original/2X/f/f14253523ed8e49ae37f05664675877b28de3f75.mod) (7.0 KB)

---

<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:** [27 August 2018 20:06 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/2 "2018-08-27T20:06:26Z")

</div>

`ms_variance_decomposition` is for Markov-switching BVARs, not DSGE models.

---

<div class="post-metadata">

**Author:** ![35224129ty](https://forum.dynare.org/letter_avatar_proxy/v4/letter/3/bb73d2/32.png) [@35224129ty](https://forum.dynare.org/u/35224129ty)\
**Post date:** [27 August 2018 20:19 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/3 "2018-08-27T20:19:49Z")

</div>

Thanks for replying in the late evening.

Does it mean that for DSGE model, we only need to do conditional forecast error variance decomposition?

Thanks

---

<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:** [27 August 2018 20:21 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/4 "2018-08-27T20:21:45Z")

</div>

What else do you need? The unconditional one should always be provided by Dynare when you request theoretical moments.

---

<div class="post-metadata">

**Author:** ![35224129ty](https://forum.dynare.org/letter_avatar_proxy/v4/letter/3/bb73d2/32.png) [@35224129ty](https://forum.dynare.org/u/35224129ty)\
**Post date:** [27 August 2018 20:24 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/5 "2018-08-27T20:24:03Z")

</div>

I see. The unconditional one is reported just before the conditional one, right?

---

<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:** [27 August 2018 20:35 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/6 "2018-08-27T20:35:26Z")

</div>

Yes, that is correct.

---

<div class="post-metadata">

**Author:** ![35224129ty](https://forum.dynare.org/letter_avatar_proxy/v4/letter/3/bb73d2/32.png) [@35224129ty](https://forum.dynare.org/u/35224129ty)\
**Post date:** [27 August 2018 20:36 UTC](https://forum.dynare.org/t/variance-decomposition-command/12313/7 "2018-08-27T20:36:05Z")

</div>

Thank you very much!
