www.gusucode.com > econ 案例源码程序 matlab代码 > econ/PlotOrthogonalizedImpulseResponseFunctionOfUnivariateExample.m
%% Plot Orthogonalized Impulse Response Function of Univariate ARMA Model % Plot the entire impulse response function of the univariate ARMA(2,1) % model % % $$y_t = 0.3y_{t-1} - 0.1y_{t-2} + \varepsilon_t + 0.05\varepsilon_{t-1}.$$ % %% % Create vectors for the autoregressive and moving average coefficients as % you encounter them in the model expressed in difference-equation notation. AR0 = [0.3 -0.1]; MA0 = 0.05; %% % Plot the orthogonalized impulse response function of $y_t$. figure; armairf(AR0,MA0); %% % Because $y_t$ is univariate, you see one impulse response function in % the plot. The impulse response dies after four periods. %% % Alternatively, create an ARMA model that represents $y_t$. Specify % that the variance of the innovations is 1, and that there is no model % constant. Mdl = arima('AR',AR0,'MA',MA0,'Variance',1,'Constant',0); %% % |Mdl| is an |arima| model object. %% % Plot the impulse response function using |Mdl|. impulse(Mdl); %% % |impulse| uses a stem plot, whereas |armairf| uses a line plot. However, % the impulse response functions between the two implementations are % equivalent.