www.gusucode.com > econ 案例源码程序 matlab代码 > econ/MovingAverageModelExample.m
%% Moving Average Model % This example shows how to calculate and plot the impulse response function % for a moving average (MA) model. The MA(_q_) model is given by % % $${y_t} = \mu + \theta (L){\varepsilon _t},$$ % % where $\theta(L)$ is a _q_-degree % MA operator polynomial, $(1 + {\theta _1}L + \ldots + {\theta _q}{L^q}).$ % % The impulse response function for an MA model is the sequence of MA % coefficients, $1,{\theta _1}, \ldots ,{\theta _q}.$ % Copyright 2015 The MathWorks, Inc. %% Step 1. Specify the MA model. % Specify a zero-mean MA(3) model with coefficients $\theta_1 = 0.8$, % $\theta_2 = 0.5$, and $\theta_3 = -0.1.$ modelMA = arima('Constant',0,'MA',{0.8,0.5,-0.1}); %% Step 2. Plot the impulse response function. impulse(modelMA) %% % For an MA model, the impulse response function cuts off after _q_ periods. % For this example, the last nonzero coefficient is at lag _q_ = 3.