# Bvar\_a\_la\_sims query

**URL:** <https://forum.dynare.org/t/bvar-a-la-sims-query/2145>\
**Category:** Dynare help (legacy posts)\
**Created:** [12 September 2011 13:23 UTC](https://forum.dynare.org/t/bvar-a-la-sims-query/2145 "2011-09-12T13:23:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![donihue](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@donihue](https://forum.dynare.org/u/donihue)\
**Post date:** [12 September 2011 13:23 UTC](https://forum.dynare.org/t/bvar-a-la-sims-query/2145/1 "2011-09-12T13:23:41Z")

</div>

Hello,  
Could someone tell me where (if …) are stored the parameters in the matrix “phi” of the bottom of p.1 of the manual on “bvar\_a\_la\_sims” (Y = X"phi" + U)? I would like to compare them to those obtained using the implementations in EViews and the MSBVAR package of R, which in principle should produce the same results …  
Many thanks  
Donihue

---

<div class="post-metadata">

**Author:** ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)\
**Post date:** [14 September 2011 13:47 UTC](https://forum.dynare.org/t/bvar-a-la-sims-query/2145/2 "2011-09-14T13:47:24Z")

</div>

Hi,

BVAR is _Bayesian_ estimation, so the result of the estimation is not a point matrix for Phi, but a probability distribution over matrices (the so-called posterior distribution).

The parameters of this distribution are computed when one calls for example the “bvar\_density” function, but they are not stored.

Here is a solution: after a call to “bvar\_density”, run the following command:

```auto
[ny, nx, posterior, prior] = bvar_toolbox(nlags);
```

where “nlags” is the number of lags that you want for the BVAR.

Then the “posterior” variable will be a structure with the following fields:

- df: degrees of freedom of the inverse-Wishart distribution/\*:m]
- S: matrix parameter for the inverse-Wishart distribution/\*:m]
- XXi: first component of the VCV of the matrix-normal distribution (the other one being drawn from the inverse-Wishart)/\*:m]
- PhiHat: mean of the matrix-normal distribution/\*:m]

Also note that there is a bug in the BVAR code when only one lag is requested, see [dynare.org/DynareWiki/KnownBugs](http://www.dynare.org/DynareWiki/KnownBugs) . This bug has been fixed in the unstable snapshot and will be fixed in the next stable release.

Best,
