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

2 visualizaciones (últimos 30 días)
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 comentario
FRANCESCOMARIA
FRANCESCOMARIA el 29 de Mayo de 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

Iniciar sesión para comentar.

Respuestas (1)

Animesh
Animesh el 5 de Jun. de 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:

Categorías

Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by