Detailed documentation of BVAR results in DYNARE?

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?

See

Thanks pfeifer

Then where are the estimated parameters stored?

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

var_spread_results.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?

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

Why are you trying to generate an IRF manually?

I had written a simple IRF-matching code

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?

1 Like