フィルターのクリア

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

2 ビュー (過去 30 日間)
FRANCESCOMARIA
FRANCESCOMARIA 2023 年 5 月 29 日
回答済み: Animesh 2023 年 6 月 5 日
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 件のコメント
FRANCESCOMARIA
FRANCESCOMARIA 2023 年 5 月 29 日
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

サインインしてコメントする。

回答 (1 件)

Animesh
Animesh 2023 年 6 月 5 日
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:

カテゴリ

Help Center および File ExchangeVector Autoregression Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by