IMSL STAT/LIBRARY Chapter 8: Time Series Analysis and Forecasting · 723 Wt= q0 + f1Wt-1 + ¼ + fpWt-p + At - q1At-1 - ¼ - qqAt-q, t Î{0, ± 1, ±2, K}
where p = NPAR and q = NPMA. Since Wt depends only on the innovations At that have occurred up through time t, the p autoregressive parameters are related to the autocovariances of lags k = q + 1, …, q + p by the set of equations
s(q + 1) = f1s(q) + f2s(q - 1) + ¼ + fps(q - p + 1) s(q + 2) = f1s(q + 1) + f2s(q) + ¼ + fps(q - p + 2) .
. .
s(q + p) = f1s(q + p - 1) + f2s(q + p - 2) + ¼ + fps(q)
This general system of linear equations is called the extended Yule-Walker equations. For q = 0, the system is referred to as the Yule-Walker equations. The equivalent matrix version is given by
Sf = s where
( ,1 , )
( ) , 1, ,
( ) 1, ,
T p ij
i
q i j i j p
q i i p
f f f
s s s
=
å = + - =
= + =
K
K K The overall constant q0 is defined by
( )
0
1
0
1
ip i0
p p q m
m = f
ìï =
= íïî - å >
where
mis the mean of W
t.
In practice, the autocovariance function is estimated by the sample autocovariances
( )
ˆ
k sfor k = 1, …, K. The solution of the extended Yule-Walker equations using these sample moments yields the method of moments estimates of the autoregressive parameters. The overall constant may then be estimated given an estimate of
m. Note that the extended Yule-Walker equations may be analogously defined in terms of autocorrelations instead of autocovariances.
See Box and Jenkins (1976, pages 189–191) for some comments concerning the initial
estimation of autoregressive parameters using the Yule-Walker equations.
724 · Chapter 8: Time Series Analysis and Forecasting IMSL STAT/LIBRARY
Required Arguments
MAXLAG
— Maximum lag of the sample autocovariances of the time series W. (Input)
MAXLAGmust be greater than or equal to
NPAR+
NPMA.
ACV
— Vector of length
MAXLAG+ 1 containing the sample autocovariances of W. (Input) The k-th sample autocovariance of W is denoted by
ACV(k), k = 0, 1, …,
MAXLAG.
PAR— Vector of length
NPARcontaining the estimates of the autoregressive parameters.
(Input)
PMA
— Vector of length
NPMAcontaining the estimates of the moving average parameters.
(Output) Optional Arguments
IPRINT
— Printing option. (Input) Default
: IPRINT= 0.
IPRINT Action
0 No printing is performed.
1 Prints the estimates of the moving average parameters.
NPAR
— Number of autoregressive parameters. (Input)
NPARmust be greater than or equal to zero.
Default:
NPAR= size (
PAR,1).
RELERR
— Stopping criterion for use in the nonlinear equation solver. (Input)
If
RELERR= 0.0, then the default value
RELERR= 100.0
*AMACH(4) is used. See the documentation for routine
AMACH(in the Reference Material section of this manual).
Default:
RELERR= 0.0.
MAXIT
— The maximum number of iterations allowed in the nonlinear equation solver.
(Input)
If
MAXIT= 0, then the default value
MAXIT= 200 is used.
Default:
MAXIT= 0.
NPMA
— Number of moving average parameters. (Input)
NPMAmust be greater than or equal to one.
Default:
NPMA= size (
PMA,1).
FORTRAN 90 Interface
Generic:
CALL MAMME(MAXLAG, ACV, PAR, PMA [,…])Specific: The specific interface names are
S_MAMMEand
D_MAMME.
IMSL STAT/LIBRARY Chapter 8: Time Series Analysis and Forecasting · 725
FORTRAN 77 Interface
Single:
CALL MAMME (MAXLAG, ACV, IPRINT, NPAR, PAR, RELERR, MAXIT, NPMA, PMA)Double: The double precision name is
DMAMME. Example
Consider the Wölfer Sunspot Data (Box and Jenkins 1976, page 530) consisting of the number of sunspots observed each year from 1770 through 1869. Routine
MAMMEis invoked to compute the method of moments estimates for the moving average parameter of an ARMA(2,1) model given the sample autocovariances computed from routine
ACF (page 697) and given theestimated autoregressive parameters computed from routine
ARMME (page 720).USE GDATA_INT USE ACF_INT USE ARMME_INT USE MAMME_INT
INTEGER IMEAN, IPRINT, ISEOPT, LDX, MAXLAG, NDX, NOBS, &
NOPRIN, NPAR, NPMA
PARAMETER (IMEAN=1, IPRINT=1, ISEOPT=0, LDX=176, MAXLAG=4, &
NDX=2, NOBS=100, NOPRIN=0, NPAR=2, NPMA=1)
!
INTEGER MAXIT, NCOL, NROW
REAL AC(0:MAXLAG), ACV(0:MAXLAG), PAR(2), PMA(1), &
RDATA(LDX,NDX), RELERR, SEAC(1), W(100), WMEAN
!
EQUIVALENCE (W(1), RDATA(22,2))
! Wolfer Sunspot Data for
! years 1770 through 1869 CALL GDATA (2, RDATA, NROW, NCOL)
! Compute sample ACV CALL ACF (W, MAXLAG, AC, ACV=ACV)
! Compute estimates of autoregressive
! parameters for ARMA(2,1) model CALL ARMME (MAXLAG, ACV, NPMA, NPAR, PAR)
! Convergence parameters
! Compute estimate of moving average
! parameter for ARMA(2,1) model CALL MAMME (MAXLAG, ACV, PAR, PMA, IPRINT=IPRINT)
!
END
Output
Output PMA from MAMME/M2MME -0.1241
Comments
1. Workspace may be explicitly provided, if desired, by use of
M2MME/DM2MME. The
reference is:
726 · Chapter 8: Time Series Analysis and Forecasting IMSL STAT/LIBRARY CALL M2MME (MAXLAG, ACV, IPRINT, NPAR, PAR, RELERR, MAXIT, NPMA, PMA, PARWK, ACVMOD, TAUINI, TAU, FVEC, FJAC, R, QTF, WKNLN)
The additional arguments are as follows:
PARWK
— Work vector of length equal to
NPAR+ 1.
ACVMOD
— Work vector of length equal to
NPMA+ 1.
TAUINI
— Work vector of length equal to
NPMA+ 1.
TAU
— Work vector of length equal to
NPMA+ 1.
FVEC
— Work vector of length equal to
NPMA+ 1.
FJAC
— Work vector of length equal to (
NPMA+ 1)
2.
R
— Work vector of length equal to (
NPMA+ 1) * (
NPMA+ 2)/2.
QTF
— Work vector of length equal to
NPMA+ 1.
WKNLN
— Work vector of length equal to 5 * (
NPMA+ 1).
2. Informational error Type Code
4 1 The nonlinear equation solver did not converge to
RELERRwithin
MAXITiterations.
3. The sample autocovariance function may be computed using the routine
ACF (page 697).4. The autoregressive parameter estimates may be computed using the routine
ARMME (page 720).Description
Routine
MAMMEestimates the moving average parameters of an ARMA process based on a system of nonlinear equations given K =
MAXLAGautocovariances
s(k) for k = 1, …, K and
p = NPARautoregressive parameters
fifor i = 1, …, p.
Suppose the time series {W
t} is generated by an ARMA(p,q) model
f(B)W
t=
q0+
q(B)A
t,
t Î2 {0,
±1,
±2,
K} where p =
NPARand q =
NPMALet
' ( )
t t
W =f B W
then the autocovariances of the derived moving average process Wt = q(B)At are given by
IMSL STAT/LIBRARY Chapter 8: Time Series Analysis and Forecasting · 727
( )
0 0 0
( ) 0
( ) ip pj i j 1, 1
k p
k k i j p
s s = = f f s f
ìï =
¢ = íå åïî + - ³ º -
where s(k) denotes the autocovariance function of the original Wt process. The iterative procedure for determining the moving average parameters is based on the relation
2 2 2
1
2
1 1
(1 ) 0
( ) ( ) 1
q A
k k q k q A
k k
k
q q s
s q q q + q q s-
ì + + + =
¢ = íïïî - + + + ³
L L Let t = (t0, t1, …, tq)T and f = (f0, f1, …, fq)T where
0
0
/ 1, ,
A j
j
j
j q
t sq t ìï =
= í-ïî = K
and
0
( ) 0,1, ,
q j
j i i j
i
f - t t+ s j j q
=
=
å
- ¢ = KThen, the value of t at the (i + 1)-th iteration is determined by ti+1 = ti -(Ti)-1 fi The estimation procedure begins with the initial value
0 ( (0), 0, , 0)T
t = s¢ K
and terminates at iteration i when either ||f i|| is less than RELERR or i equals MAXIT. The moving average parameters are determined from the final estimate of t by setting qj = -tj/t0 for j = 1,
…, q. The random shock variance is determined according to
2 1
2 0
(0) ( ) 0
0
p
i i
A
i q q
s f s
s t
ì - å= =
= íïïî ³
In practice, both the autocovariances and the autoregressive parameters are estimated. The solution of the system of nonlinear equations using these sample moments yields the method of moments estimates of the moving average parameters and the random shock variance. Note that autocorrelations r(k) may be used instead of autocovariances s(k) to compute s¢(k) for k = 1,
…, K. See Box and Jenkins (1976, pages 203–204) for additional motivation concerning the initial estimation of moving average parameters using a Newton-Raphson algorithm.