# Detailed documentation of BVAR results in DYNARE?

**URL:** <https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497>\
**Category:** BVAR\
**Created:** [7 July 2021 07:39 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497 "2021-07-07T07:39:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wenddy](https://forum.dynare.org/letter_avatar_proxy/v4/letter/w/dbc845/32.png) [@Wenddy](https://forum.dynare.org/u/Wenddy)\
**Post date:** [7 July 2021 07:39 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/1 "2021-07-07T07:39:34Z")

</div>

Hi, guys  
Is there any files on detailed documentation of BVAR results in DYNARE?

e.g. what are S, XXi, and PhiHat in oo\_.bvar.posterior?

---

<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:** [7 July 2021 09:42 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/2 "2021-07-07T09:42:29Z")

</div>

See

> [@Bvar\_a\_la\_sims query](https://forum.dynare.org/t/bvar-a-la-sims-query/2145/2):
>
> 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: [ny, nx, posterior, prior] = bvar\_toolbox(nlags); where “nlags” is the number of lags that you want for th…

---

<div class="post-metadata">

**Author:** ![Wenddy](https://forum.dynare.org/letter_avatar_proxy/v4/letter/w/dbc845/32.png) [@Wenddy](https://forum.dynare.org/u/Wenddy)\
**Post date:** [7 July 2021 10:29 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/3 "2021-07-07T10:29:08Z")

</div>

Thanks pfeifer

Then where are the estimated parameters stored?

---

<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:** [7 July 2021 10:51 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/4 "2021-07-07T10:51:55Z")

</div>

I am not sure I understand the question. The output contains the full information on the distribution of the parameters.

---

<div class="post-metadata">

**Author:** ![Wenddy](https://forum.dynare.org/letter_avatar_proxy/v4/letter/w/dbc845/32.png) [@Wenddy](https://forum.dynare.org/u/Wenddy)\
**Post date:** [7 July 2021 12:05 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/5 "2021-07-07T12:05:21Z")

</div>

[var\_spread\_results.mat](https://forum.dynare.org/uploads/short-url/3KZfehRbll3iMdaVDrM7j8fNLOl.mat) (116.0 KB)  
The attached files is estimated results of BVAR(1).

I would like to simulate a response to Y1’s shock, is the below code correct?

```auto
clear all; close all; clc

% True VAR parameters
load('var_spread_results.mat','oo_');
PhiHat=oo_.bvar.posterior{1,1}.PhiHat;
sd=0.1;

% Construct IRFs
Y1(:,1) = 1+sd*randn(1e3,1);
Y2(:,1) = 0.5*Y1(:,1);
Y3(:,1) = 0.5*Y1(:,1);
Y4(:,1) = 0.5*Y1(:,1);
Y5(:,1) = 0.5*Y1(:,1);
Y6(:,1) = -0.5*Y1(:,1);
Y7(:,1) = 0.5*Y1(:,1);

for horiz = 2 : 40
    Y1(:,horiz) = PhiHat(1,1)*Y1(:,horiz-1) + PhiHat(2,1)*Y2(:,horiz-1)+ PhiHat(3,1)*Y3(:,horiz-1) +...
        PhiHat(4,1)*Y4(:,horiz-1)+ PhiHat(5,1)*Y5(:,horiz-1) + PhiHat(6,1)*Y6(:,horiz-1)+ PhiHat(7,1)*Y7(:,horiz-1);
    Y2(:,horiz) = PhiHat(1,2)*Y1(:,horiz-1) + PhiHat(2,2)*Y2(:,horiz-1)+ PhiHat(3,2)*Y3(:,horiz-1) +...
        PhiHat(4,2)*Y4(:,horiz-1)+ PhiHat(5,2)*Y5(:,horiz-1) + PhiHat(6,2)*Y6(:,horiz-1)+ PhiHat(7,2)*Y7(:,horiz-1);
    Y3(:,horiz) = PhiHat(1,3)*Y1(:,horiz-1) + PhiHat(2,3)*Y2(:,horiz-1)+ PhiHat(3,3)*Y3(:,horiz-1) +...
        PhiHat(4,3)*Y4(:,horiz-1)+ PhiHat(5,3)*Y5(:,horiz-1) + PhiHat(6,3)*Y6(:,horiz-1)+ PhiHat(7,3)*Y7(:,horiz-1);
    Y4(:,horiz) = PhiHat(1,4)*Y1(:,horiz-1) + PhiHat(2,4)*Y2(:,horiz-1)+ PhiHat(3,4)*Y3(:,horiz-1) +...
        PhiHat(4,4)*Y4(:,horiz-1)+ PhiHat(5,4)*Y5(:,horiz-1) + PhiHat(6,4)*Y6(:,horiz-1)+ PhiHat(7,4)*Y7(:,horiz-1);
    Y5(:,horiz) = PhiHat(1,5)*Y1(:,horiz-1) + PhiHat(2,5)*Y2(:,horiz-1)+ PhiHat(3,5)*Y3(:,horiz-1) +...
        PhiHat(4,5)*Y4(:,horiz-1)+ PhiHat(5,5)*Y5(:,horiz-1) + PhiHat(6,5)*Y6(:,horiz-1)+ PhiHat(7,5)*Y7(:,horiz-1);
    Y6(:,horiz) = PhiHat(1,6)*Y1(:,horiz-1) + PhiHat(2,6)*Y2(:,horiz-1)+ PhiHat(3,6)*Y3(:,horiz-1) +...
        PhiHat(4,6)*Y4(:,horiz-1)+ PhiHat(5,6)*Y5(:,horiz-1) + PhiHat(6,6)*Y6(:,horiz-1)+ PhiHat(7,6)*Y7(:,horiz-1);
    Y7(:,horiz) = PhiHat(1,7)*Y1(:,horiz-1) + PhiHat(2,7)*Y2(:,horiz-1)+ PhiHat(3,7)*Y3(:,horiz-1) +...
        PhiHat(4,7)*Y4(:,horiz-1)+ PhiHat(5,7)*Y5(:,horiz-1) + PhiHat(6,7)*Y6(:,horiz-1)+ PhiHat(7,7)*Y7(:,horiz-1);
end

```

---

<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:** [7 July 2021 12:44 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/6 "2021-07-07T12:44:23Z")

</div>

Why are you trying to generate an IRF manually?

---

<div class="post-metadata">

**Author:** ![Wenddy](https://forum.dynare.org/letter_avatar_proxy/v4/letter/w/dbc845/32.png) [@Wenddy](https://forum.dynare.org/u/Wenddy)\
**Post date:** [7 July 2021 13:22 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/7 "2021-07-07T13:22:05Z")

</div>

I had written a simple IRF-matching code

---

<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:** [8 July 2021 07:45 UTC](https://forum.dynare.org/t/detailed-documentation-of-bvar-results-in-dynare/18497/8 "2021-07-08T07:45:48Z")

</div>

I don’t really understand. The BVAR usually gives you one IRF to which to match a model. Why then create the IRFs manually instead of having Dynare compute them for you?
