%% Specify Number of Periods in IRF
% Load the quarterly US GDP data set.

load Data_GDP

% For details on the data, enter Description at the command line.
% Compute the GDP growth rate.

y = price2ret(Data);

% Consider an ARMA(2,2) model for the GDP rate series. Create an arima model template for estimation.

Mdl = arima(2,0,2)

% NaN values in properties are placeholders for estimable model parameters.
% Fit the model to the entire series.

EstMdl = estimate(Mdl,y)

% The estimated AR(2) model of the GDP rate series is
% y_t=0.004 + 1.372y_{t-1} - 0.807y_{t-2} + \varepsilon_t - 1.143\varepsilon_{t-1} + 0.674\varepsilon_{t-2},
% where \varepsilon_t is a Gaussian series with mean 0 and variance 0.00008.
% Compute the IRF of the estimated model for 50 periods.

impulse(EstMdl,50)

% The dynamic response to the initial innovation shock dissipates after about 35 quarters.
% Copyright 2021 The MathWorks, Inc.