Effacer les filtres
Effacer les filtres

I have problem with [Response,Lower,Upper] = irf(Mdl,Nu​mObs=50,Co​nfidence=0​.9);

2 vues (au cours des 30 derniers jours)
FRANCESCOMARIA
FRANCESCOMARIA le 29 Mai 2023
The problem is that i want a number of observation of 50, but ifr(_) has default value of 20 Observation
I tried different solution without success
  1 commentaire
FRANCESCOMARIA
FRANCESCOMARIA le 29 Mai 2023
clear
clc
rmpath(genpath('/Users/francescosimeone/Desktop/applied macroeconomics/project/VAR-Toolbox-main/v3dot0/'))
returns = readmatrix('database_mpshocks_infoshocks.xlsx', 'Range', 'B:H', 'NumHeaderLines', 1);
Y= returns(:, [1, 3]);
Mdl = varm(2,3);
Mdl.SeriesNames = {'Transformed real GDP','Transformed real 3-mo T-bill rate'};
EstMdl = estimate(Mdl,Y);
[YIRF,h] = armairf(EstMdl.AR,{},'InnovCov',EstMdl.Covariance);
defGDPImp = ret2price(YIRF(:,2,1));
figure;
numobs = size(defGDPImp,1);
plot(0:numobs - 1,defGDPImp);
title('Impact of Shock to Interest Rate on Deflated GDP')
ylabel('Deflated GDP');
xlabel('Time');
rng(1); % For reproducibility
%[Response,Lower,Upper] = irf(EstMdl);
[Response, Lower, Upper] = irf(EstMdl, 'Confidence', 0.68);
irfshock2resp3 = Response(:,1,2);
IRFCIShock2Resp3 = [Lower(:,1,2) Upper(:,1,2)];
figure;
h1 = plot(0:19,irfshock2resp3);
hold on
h2 = plot(0:19,IRFCIShock2Resp3,"r--");
legend([h1 h2(1)],["IRF" "68% Confidence Interval"])
xlabel("Time Index");
ylabel("Response");
title("IRF of IB When Y Is Shocked");
grid on
hold off

Connectez-vous pour commenter.

Réponses (1)

Animesh
Animesh le 5 Juin 2023
To change the number of observations in the IRFs, you can pass an additional argument to the irf function indicating the number of steps you want to forecast. By default, irf computes 20 steps, but you can set it to 50 by doing the following:
[Response, Lower, Upper] = irf(EstMdl, 'NumPeriods', 50, 'Confidence', 0.68);
You may refer to the following documentation for more information:

Catégories

En savoir plus sur Vector Autoregression Models dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by