Chapter 12 - Houston H. Stokes Page

Revised Chapter 12 in Specifying and Diagnostically Testing Econometric Models (Edition 3)
© by Houston H. Stokes 26 January 2011. All rights reserved.
Chapter 12
Special Topics in Time Series Analysis...................................... 1
12.0 Introduction ......................................................... 1
12.1 The Frequency Decomposition of the VAR Model ......................... 3
12.2 The Kalman-Filter Approach to Time Series Analysis ................... 9
12.3 Examples ............................................................ 16
Table 12.1 Testing The Frankel Price Expectations Data ................. 22
12.4 Unit Roots .......................................................... 32
Table 12.2 Results of Spurious Regression Example ...................... 43
Figure 12.1 Plots of Two unit root series. ............................. 45
Figure 12.2 Residual plot, ACF and PACF of model y=f(x). ............... 46
Figure 12.3 Residual Plot, ACF plot and PACF plot of (1  B) yt  f ((1  B ) xt )
....................................................................... 48
Figure 12.4 Residual plot, ACF plot and PACF plot of yt  f ( xt , xt 1 , yt 1 ) .. 49
12.5 Testing for Unit Roots .............................................. 49
12.6 Modeling Conditional Heteroskedasticity ............................. 67
12.7 Conclusion .......................................................... 78
Special Topics in Time Series Analysis
12.0 Introduction
The varfreq command allows decomposition of the VAR model into the frequency domain
to provide additional insight into the dynamic structure implicit in the model, using techniques
developed by Geweke (1982a, 1982b, 1982c, 1984).1 In economics the concept of "short run" and
"long run" usually mean short lag and long lag. For example, in the area of monetary policy, the
income effect, which measures a positive correlation between changes in the monetary base and
interest rates, is thought to take up to 16 months. The shorter term liquidity effect, or negative
correlation between changes in the monetary variable and the interest rate, is thought to take only a
few months (Stokes and Neuburger 1979). Clearly, in these cases the concept of long and short run
can be appropriately thought of in terms of time lag. However, in other situations we might define
"short run" to mean high frequency and "long run" to mean low frequency. As an example, consider
the behavior of prices during the long deflation in the United States after the Civil War until nearly
the turn of the century. It might be reasonable to suppose that a rational person might find the long
run (low frequency) component of the price movements "expected price movements" while the short
1 The author of b34s was fortunate to obtain from Geweke (1982a) the mtsm program that implements the material
in Geweke (1982b, 1984). This code was converted to run under b34s. The mtsm program is unique in that it
provides a way to estimate the frequency decomposition of the VAR model to measure feedback. These features
have been implemented in the b34s command language. The mtsm program also provides other useful features that
are listed in Stokes (1996a), which documents the b34s native commands.
12-1
run (high frequency) movements "unexpected price movements." Both measures are present in a
VAR model such as equation (8.1-9). The varfreq command allows these effects to be measured.
The kfilter command provides the capability to estimate a state space model with use of an
identification strategy suggested by Aoki (1987).2 A state space model can be written in VARMA
form and vice versa. The Aoki approach uses the covariance matrices between the past data and
future realizations of time series to build the Hankel matrix of covariance matrices. Aoki (1987)
argues that the numerically determined rank of this Hankel matrix is the dimension of the state space
model. The kfilter command provides an automatic means by which a state space model can be
estimated. It will provide a baseline forecast by which ARIMA and VARMA model forecasts can be
tested.
The topic of unit roots in time series models impacts all time series model building
procedures. The B34S polysolv command is used to test models for unit roots. The dangers of unit
roots are illustrated with sample data and various tests are performed using the pgmcall procedure,
which provides an interface to the RATS software and the bispec sentence containing unit root and
ARCH test options. Finally, a very brief introduction of ARCH, GARCH and ARCH-M model
building using is shown. A more extensive discussion is in Stokes (200x, Chapter 7)
2 Code from Aoki (1987) code which was converted and implemented to run under B34S . Aoki has recently
revised his excellent book. He has been most generous in reading section 12.2 of this chapter and making a number
of suggestions. He is not responsible for any remaining errors.
2
Special Topics in Time Series Analysis
12-3
12.1 The Frequency Decomposition of the VAR Model
Assuming x and y are two time series of length T, Geweke (1982b) shows that the linear dependence
of xt and yt , Fx , y , is the sum of linear feedback from x to y, Fx  y , linear feedback from y to x,
Fy  x , and instantaneous linear feedback, Fx y . These measures will be illustrated first in the time
domain and, finally, in the frequency domain. The main concern is to be able to measure at what
frequencies the effects are strongest and/or exist.3 Assume that vector wt of length k contains k1
series xt and k2 series yt . Assume wt can be written in finite VMA form as equation (8.1-11). This
assumption assumes that the spectral-density matrix, S Z ( ) , exists at almost all frequencies,
  [ ,  ] and can be partitioned as
 S x ( ) S x y ( ) 
S Z ( )  

 S y x ( ) S y ( ) 
(12.1-1)
The vector t can also be written in VAR form as shown in equation (8.1-9), provided that R(B) in
equation (8.1-11) is invertible. If we assume that Qi j ( B)  0 for i  j , equation (8.1-9) can be written
as two AR models as

xt   E1i xt i  u1t
(12.1-2)
i 1

yt   G1 i yt  i  v1t
(12.1-3)
i 1
where
var(u1t )  1 and
var(v1t )  1 .
The
sequence
{E11 ,
, E1  }  Q11 ( B)
and
, G1  }  Q22 ( B) . The vectors u1t and v1 t are not autocorrelated but may be cross correlated.
{G1 1 ,
Relaxing the assumption that the off diagonal terms in Q ( B ) for orders greater than zero are zero,
xt and yt can be written


i 1
i 1
xt   E2 i xt i   F2 i yt i  u2 t
3 Geweke (1982b) is the major reference for the discussion of unconditional linear dependence between
(12.1-4)
xt and
yt . Geweke (1984) generalizes this to a model of conditional dependence. The discussion in this section has been
adapted from these seminal articles, which should be read for additional detail.
12-4
Chapter 12


i 1
i 1
yt   G2 i yt i   H 2 i xt i  v2 t
(12.1-5)
where var(u2 t )   2 and var(v2 t )   2 . The vectors u 2t and v2 t are the error terms of the VAR
model from equation (8.1-9) and are not autocorrelated or cross correlated, except possibly
contemporaneously. The variance-covariance matrix of the error vectors is
 2 C 
C '  
2

(12.1-6)
The P matrix from equation (8.1-24) is related to the above expression by
I
 C  21 

  PP'
1

C
'

I
2


(12.1-7)
Relaxing the assumption that the off-diagonal terms in Q(B) for any order are zero, xt and yt can be
written

xt   i 1 E3i xt i   F3i yt i  u3t

(12.1-8)
i 0

yt   i 1 G3i yt i   H 3i xt i  v3t

(12.1-9)
i 0
where var(u3t )  3 and var(v3t )  3 . The vectors u3t and v3t are the error terms of a linear transfer
function model of the form of equation (7.2-1) and are not autocorrelated or cross correlated.
Equations (12.1-2) and (12.1-3) write xt and yt as a linear projection on lagged x and lagged y,
respectively. Equation (12.1-4) writes xt as a linear projection on lagged x and lagged y, while
equation (12.1-5) writes yt as a linear projection on lagged y and lagged x. Equation (12.1-8) writes xt
as a linear projection on lagged x and current and lagged y, while equation (12.1-9) writes yt as a
linear projection on lagged y and current and lagged x. Equations (12.1-10) and (12.1-11) write xt and
yt as a linear projection of lagged x and all y values and lagged y and all x values, respectively. This is
shown below:

xt   i 1 E4i xt i   F4i yt i  u4 t

(12.1-10)
i 

yt   i 1 G4i yt i   H 4i xt i  v4 t ,

i 
(12.1-11)
Special Topics in Time Series Analysis
12-5
where var(u4t )   4 and var(v4t )   4 . Geweke (1982b) shows that this projection exists and all
coefficients are square summable. Equations (12.1-2) through (12.1-5) and (12.1-8) through (12.111) imply that
|  4 || 3 ||  2 || 1 |
(12.1-12)
and
|  4 || 3 ||  2 || 1 | .
(12.1-13)
Equations (12.1-12) and (12.1-13) motivate Geweke's definitions:
Fx
y
 ln(|  2 | / |  3 |)  ln(|  2 | / |  3 |
(12.1-14)
Fx y  ln(|  3 | / |  4 |)  ln(| 1 | / |  2 |
(12.1-15)
Fy x  ln(| 1 | / |  2 |)  ln(|  3 / |  4 |
(12.1-16)
Fx , y  ln(| 1 | / |  4 |)  ln(| 1 | / |  4 | ,
(12.1-17)
which are proved4 in theorem 1 of Geweke (1982b), given
Fx , y  Fy x  Fx y  Fx y .
(12.1-18)
Equations (12.1-14) through (12.1-18) can be expressed in the frequency domain. In theorem 2,
Geweke proves that if we define f x y (  ) ( f y x (  ) ) as the measure of linear feedback from x to y
(y to x), then
(1/ 2 )

(1/ 2 )



f yx ( )d   Fyx
(12.1-19)
f x y ( )d   Fx y .
(12.1-20)
4 The motivation for these definitions rests on the fact that the natural log of 1 is zero and the fact that, as Geweke
notes, these measures can be interpreted in terms of the proportional increase in the variance of the one-step-ahead
population error.
12-6
Chapter 12

If we define E j ( B)  I  i 1 E ji Bi and G j  I   G ji B for j  {1,

,4} , strict equalities hold for
i 1
equations (12.1-19) and (12.1-20) if the roots of │G3 (B)│ and │E3 (B)│ lie outside the unit circle.
Equations (12.1-19) and (12.1-20) show that measures of linear feedback from x to y (y to x) can be
measured in the frequency domain.
Consider the VAR systems
 E2 ( B ) F2 ( B )   xt  u2t 
 H ( B) G ( B)  y   v 
 3
3
  t   3t 
(12.1-21)
 E3 ( B ) F3 ( B )   xt  u3t 
 H ( B) G ( B)  y   v  ,
 2
  t   2t 
2
(12.1-22)
which can be written in VMA form as
*
*
 xt   E2 ( B ) F2 ( B )  u2 t 
 
y    *
*
 t   H 3 ( B ) G3 ( B )   v3t 
(12.1-23)
*
*
 xt   E3 ( B ) F3 ( B )  u3t 

 
y   *
*
 t   H 2 ( B ) G2 ( B )   v2 t 
(12.1-24)
Since xt and yt contain k1 and k2 variables each, then from the first k1 rows of equation (12.1-23) we
can obtain a decomposition of the spectral density of xt , S x (  ) ,
S x (  )  E2* (  )  2 E2* (  )'  F2* (  ) 2 F2* (  )' ,
(12.1-25)
where E2* (  ) and F2* (  ) are the Fourier transforms of the MA polynomials E2* ( B ) and F2* ( B )
and ' is the conjugate transposition of the complex matrix. Equation (12.1-25) shows that the
spectral density of x can be decomposed into the spectral information coming from the
innovations of the x series model plus the spectral information from the innovations from the y
series model. Thus, Geweke's measure of f y x (  ) can be defined as
f yx ( )  ln(| Sx ( ) | / E2* ( ) 2 E2* ( )' |) .
If y adds nothing to the explanation of x at frequency λ, then from equation (12.1-25)
(12.1-26)
Special Topics in Time Series Analysis
12-7
F2* ( ) 3 F2* ( ) '  0 ,
(12.1-27)
S x ( )  E2* ( )  2 E2* ( ) ' ,
(12.1-28)
and from equation (12.1-26) f y  x ( )  0 . Using a similar decomposition of the last k2 rows of
equation (12.1-24),
S y ( )  H2* ( )3H2* ( )' G2* ( )3G2* ( )' ,
(12.1-29)
which implies that
f x y  ln(| S y ( ) | / | G2* ( )2G2* ( )' |) .
(12.1-30)
To implement this estimation strategy, the lengths of the polynomials in equations (12.1-2)
through (12.1-5), (12.1-8) and (12.1-9) must be limited. While Geweke uses the Whittle (1963)
approach, which estimates the coefficients from the covariance function, Stokes (1985) suggests that
when determining the appropriate lag, a VAR model should be estimated by means of the methods
suggested in Chapter 8. Once the appropriate lag is determined, the faster Geweke procedure can be
used. If a longer lag is specified, more frequencies, λ, can be calculated. If the lag length p is even, it
0 - λ1│. If too few lags are specified, the estimated model really will not capture the
relationship between xt and yt. The Geweke procedure displays the frequency information implicit in
the VAR model that was estimated. Checks of the cross correlations determine if p is large enough.
Putting more lags in the VAR model is equally questionable, even though more λ frequencies could
be calculated and the difference │λ0 - λ1│ made smaller. In the varfreq command the user either
specifies the λ's directly or specifies the periods that are transformed into the λ's by the relationship
2π / FREQ = PERIOD.
Geweke (1984) proposed using a bootstrap to obtain confidence bounds on the frequency
feedback estimates. The essential idea is to draw samples of data having asymptotic distribution
equal to the original data and calculate the frequency measures. By inspection of the ranges of the
frequency measures, 25% and 75% bounds on the frequency measures can be calculated. Geweke
(1984) provides additional detail on this procedure.
The user selects the number of replications desired with the nrep parameter. Assume that
f 0 x y ( ) is the vector of feedback measures at different frequencies calculated for the original data.
Define
f i x y ( ) as the corresponding measure for the nrep sets of artificial data that were
generated with the same asymptotic covariance distribution as the original data. An adjustment
factor, a j , is calculated for each frequency  j , where
12-8
Chapter 12
NREP
a j  f 0 x y ( j ) /((  fi x y ( j )) / NREP) ).
(12.1-31)
j 1
The adjusted feedback for the jth frequency  j is a j f i x y ( j ) . The 25% and 75% adjusted values are
calculated as the raw values times a 2j . The importance of this procedure is that the user is able to
obtain bounds on the estimated feedback measures.
Geweke (1984) extends the above definitions of unconditional feedback for the case of
conditional feedback. Assume that vector wt contains subvectors xt , yt and zt containing k1, k2 and k3
series, respectively, and write the model as
 11 ( B) 12 ( B) 13 ( B)   xt  u1t 
  ( B )  ( B )  ( B )   y   u  .
22
23
 21
  t   2t 
  31 ( B)  32 ( B)  33 ( B)   zt  u3t 
(12.1-32)
Note that Fy  x|z   0 is the same as setting 12 ( B)  0 while Fx y|z   0 is the same as setting
 21 ( B)  0 . Another way to look at the problem is in terms of conditional variances. Define
var( xt | xt 1, yt 1 ) as the variance of a model predicting xt as a function of lagged x's and lagged z's,
var( xt | Wt 1 ) as the variance of a model predicting xt as a function of lagged x's, lagged y's and lagged
z's and var( wt | Wt 1 ) is the variance of a model predicting xt, yt, zt as a function of lagged x's, lagged
y's and lagged z's. Geweke (1984 page 909) proves
Fy x|z   Fyz x  Fz x
(12.1-33)
Fx yz  ln{(| var( xt | Wt 1 ) | | var( yt | Wt 1 | | var( zt | Wt 1 ) | / | var( wt / Wt 1 ) |}
(12.1-34)
Fx , y|z   Fy  x|z   Fx  y|z   Fxy|z 
(12.1-35)
Fx y|z   Fx yz  Fzxy  Fy  x|z   Fx y|z   Fx y||z  .
(12.1-36)
In section 12.3, the unconditional feedback measures will be illustrated with the gas furnace data
and price expectations data.
Special Topics in Time Series Analysis
12-9
12.2 The Kalman-Filter Approach to Time Series Analysis
The theory behind state space model building is very complex. Interested readers are referred
to Aoki (1987) or Anderson and Moore (1979) for further detail. Only the outline of the approach is
given in this section, which summarizes Aoki's (1987) pioneering efforts and uses different notation
from the prior section.5 Assume a model
Z t 1  AZ t  But
(12.2-1)
Yt  CZt  ut ,
(12.2-2)
where Z t is the state vector of dimension s, ut is the noise vector with mean zero and constant
covariance matrix Eut us'   s , t . Equation (12.2-1) is the state transition equation, while equation
(12.2-2) shows how the state vector is related to the data vector yt . The matrices A, B and C are the
system matrices that determine the dynamics of the system. To illustrate how the state space
representation relates to a VAR model for two series, xt and yt , of order 2, consider the model
xt  1.6 xt 1  .4 yt 1  .33xt 2  .66 yt 2  e1, t
(12.2-3)
yt  .2 xt 1  .5 yt 1  .11xt 2  .15 yt 2  e2, t ,
(12.2-4)
where e1,t and e2, t are the usual error terms. If we define xt  j |t and yt  j | t as the forecast of x and y for
period t+j, conditional on the information up to period t, then
xt 1|t  1.6 xt  .4 yt  .33xt 1  .66 yt 1
(12.2-5)
yt 1|t  .2 xt  .5 yt  .11xt 1  .15 yt 1
(12.2-6)
xt 2|t  1.6 xt 1|t  .4 yt 1|t  .33xt  .66 yt
(12.2-7)
yt 2|t  .2 xt 1|t  .5 yt 1|t  .11xt  .15 yt
(12.2-8)
since E (u1, t )  0 for i > t and j = 1,2. From equations (12.2-7) and (12.2-8) we note that xt 2|t and
5 Harvey (1981, Chap. 4) provides an introduction to the topic. While an excellent reference to state space model
estimation is contained in Anderson and Moore (1979), Sargent (1987) provides economic insights into the use of the
Kalman filter in economic problems.
12-10
Chapter 12
yt 2|t are written in terms of xt , yt , xt 1|t , and yt 1|t ; hence, the order of the state vector, Z t , in
equation (12.2-1) is 4 and
Z t  ( xt , yt , xt 1 |t , yt 1|t ) .
(12.2-9)
The state space form of equations (12.2-3) and (12.2-4) is
 xt 1  0
y
 
 t 1   0
 xt 2|t 1   .33

 
 yt 2|t 1   .11
0
0
 .66
 .15
0   xt  1 0 


0 1   yt   0
1  u1, t 1 




,
1.6 .4   xt 1|t  1.6 .4  u2, t 1 
 


.2 .5   yt 1|t   .2 .5 
1
(12.2-10)
which flows directly from substitution in equations (12.2-5) through (12.2-8) when we note that
xt 2|t 1  1.6 xt 1  .4 yt 1  .33xt  .66 yt
 1.6( xt 1 |t  u1, t 1 )  .4( yt 1|t  u2, t 1 )  .33xt  .66 yt
(12.2-11)
and
yt 2|t 1  .2 xt 1  .5 yt 1  .11xt  .15 yt
 .2( xt 1|t  u 1, t 1 )  .5( yt 1|t  u2, t 1 )  .11xt  .15 yt
(12.2-12)
The next example writes a VARMA model in state space form. Assume
xt  .45 xt 1  .33 yt 1  u1, t  .11u1, t 1  .36u2, t 1
(12.2-13)
yt  .44 xt 1  .6 yt 1  u2,t .
(12.2-14)
Equations (12.2-13) and (12.2-14) imply that
xt 1|t  .45 xt  .33 yt  .11u1, t  .36u2, t
(12.2-15)
yt 1|t  .44 xt  .6 yt
(12.2-16)
Special Topics in Time Series Analysis
12-11
xt 2|t  .45 xt 1|t  .33 yt 1|t
 .45 xt 1|t  .1452 xt  .198 yt
(12.2-17)
from which the state vector Z t  ( xt , yt , xt 1 |t ) '. The state space form of the model is,
 xt 1  0
0
1   xt  1
0
u1, t 1 

 

 

0  yt   0
1 
 yt 1   .44 .6


 u 
 xt 2|t 1  .1452 .198 .45  xt 1|t  .34  .03  2, t 1 




(12.2-18)
which follows directly from substitution in equations (12.2-15) through (12.2-17) if we note that
xt 2|t 1  .45xt 1  .33 yt 1  .11u1, t 1  .36u2, t 1
 .45( xt 1|t  u1, t 1 )  .33( yt 1|t  u2, t 1 )  .11u1, t 1  .36u2, t 1
(12.2-19)
 .45xt 1|t  .34u1, t 1  .1452 xt  .198 yt  .03u2, t 1.
Aoki (1987) outlines how to estimate the dimension s of the state vector Z t and an estimate of
A and B in equation (12.2-1).6 Define the observability matrix, O , of the system of equations (12.21) and (12.2-2) as
O  [C ' A ' C ' A '2 C ',
, A 'n1 C ', ]'
(12.2-20)
and the reachability matrix, or controllability matrix, C , as
C  [ B AB A2 B,
, An1B, ].
(12.2-21)
From O we can obtain the left hand side vector YT  OT x0  T where OT is a finite section of O . In
fact if OT has rank equal to the state vector, it is possible to solve for an estimate of the initial right
hand side vector vector x0  (OT' OT ) 1OT' (YT  T ) . If there is no noise, x0 can be directly recovered.
The Hankel matrix of impulse responses, H , is the product of the observability and reachability
matrices and is an infinite-dimensional matrix with the same submatrix arranged along the
counterdiagonal lines
H  OC .
6 This section is based on Aoki (1987) and uses his notation wherever possible.
(12.2-22)
12-12
Chapter 12
Aoki (1986, 59) shows that a Markov model is observable (A and C are an observable pair) if the
rank of O is n, where n is the dimension of the state vector Z t , while the model is reachable (A and
B are a reachable pair) if the rank of C is equal to the dimension of the state vector Z t . Aoki (1987,
61) shows that this condition will be met if | O ' O | 0 and | C ' C | 0 . Define the (i,j) submatrix of H
as
H|i  j|  Hk  CAk 1B .
(12.2-23)
Note
 H1 H 2 . . H K 
H H
. . H K 1 

H K  O K CK   2 3
.



 H K H K 1 . . H 2 K 1 
H k is a dynamic multiplier matrix of equation (12.2-2) and expresses future values of the series
yt ( yt 1 ) as a weighted average of the current and past shocks to the system ut where
 yt 1 
yt1   yt 2 


. 
ut 
ut_  ut 1 
 
. 
yt 1  Hut .
(12.2-24)
Equation (12.2-24) is the forecasting version of the VMA model given in equation (8.1-11). Another
way to look at the model is to write
ts
yt  CAt  s Z t  s   H i ut i ,
(12.2-25)
i 0
where H 0  I . Equation (12.2-25) reduces to

yt   H it i ,
(12.2-26)
i 0
as S approaches  , provided A is stable such that Ai approaches the null matrix as i approaches  .
Aoki (1987, 62) shows that
Special Topics in Time Series Analysis
E ( yt ut' i )  H i  ,
12-13
(12.2-27)
where Δ is the covariance matrix of t . Define the covariance of the state vector Z t
  E ( Z t Z t' ) .
(12.2-28)
Using
M  A  C '  B
(12.2-29)
 i  E ( yt 1 yt' )  CAk 1M for k  1
(12.2-30)
and
 0  C  C '  ,
(12.2-31)
where  i is the covariance matrix of the left hand side for lag i. Assuming stationarity, lim Ak 1  0
k 
which implies that lim  k  0 or the lag covariances die out. The Hankel matrix of covariance
k
matrices, H j,k can be expressed as
H j, k
k
 yt 1 
 1  2

y 
 
 k 1 
t 2 
2
3
' '
'


,
 OJ K  E
( y y ... y
)
.
 t t 1 t k 1 .





 yt  j ) 
  j  j 1  j k 1 
(12.2-32)
where
  ( M AM A2 M , ) .
(12.2-33)
 has the same structure as the reachability matrix C. An alternative to equations (12.2-30) and
(12.2-31) shows how the covariance matrix of the data  i is related to the Hankel matrix of the
impulse responses defined in equation (12.2-22)

 0   H k  H k'
k 0
(12.2-34)
12-14
Chapter 12

 i   H k i  H i' for i  0 .
(12.2-35)
k 0
It is easily seen that (12.2-34) is a special case of (12.2-35). Equation (12.2-35) can be written as
 i  CAk 1M  Eyt k yt'  Eyt 1 y1' for k  0,  1,  2,...
(12.2-36)
and
E ( yt  k et' )  H k  CAk 1B.
(12.2-37)
Define  as the covariance of the state vector. What is most interesting is that Aoki (1987, 63)
shows that from equations (12.2-1) and (12.2-28) we can write
  A  A'  B  B' .
(12.2-38)
Using equation (12.2-29), we substitute for BΔ, and from equation (12.2-31), we factor out Δ to
obtain the Riccati equation,
  A  A ' ( M  AC ')(  0  C C ') 1 ( M  AC ') ' ,
(12.2-39)
whose solution solves the Aoki approach to the estimation of the state space model.7 Equation (12.239) links together the relationship between the covariance matrix of the data,  0 , which is related to
the Hankel matrix (see equation [12.2-34]), the system matrices, A and C, and the covariance of the
state vector Π. Given A, C,  0 and  use (12.2-31) to get  and from (12.2-38) obtain B .
Since the rank of the infinite-dimensional Hankel matrix determines the dimension of the state vector
Z, the kfilter command outputs a number of measures to assist the user in determining this
dimension. These include the singular values of the Hankel matrix S (i ) , the sum of the eigenvalues
of the Hankel matrix, SUMEIG, the sum of the square root of the absolute values of the eigenvalues,
SUMSIN, and the incremental sums of S(i), ( SUMSI), and (| S (i ) |).5 (SUMEI). From these values
three measures of the "fall off" of the singular values are calculated. These include
THESS  (| S (i ) |).5 /(| S (i  1) |).5 , REMA  ( SUMSIN  SUMSI ) /( S (i  1)).5 and
DROP  ( S (i )).5 /( S (i )).5 . These values are illustrated in the example section and discussed further in
Aoki (1987).
The Aoki approach requires that the user experiment with various settings for the rank of the
Hankel matrix (set with parameter K) and an estimate of the dimension of the state vector (set with
7 Aoki (1987, Sec. 7.5) outlines how equation (12.2-38) is solved, using noniterative methods.
Special Topics in Time Series Analysis
12-15
parameter NSTAR). It has been the author's experience that the results are quite sensitive to these
settings. It is important to inspect the sum of squares both before and after estimation and to select
models that have the greatest improvement. The autocorrelation function (ACF) of the residuals and
other summary statistics are provided to test model adequacy. Some of these additional measures
include optional prints of H, H'H, A, C, Π, Δ, Δ-1, BΔ, B, and the prediction multiplier, which is
defined as A  BC (Aoki 1987, 107). The prediction multiplier is useful if we use equation (12.2-2)
to eliminate ut from equation (12.2-1), giving
Z t 1|t  AZ t |t 1  Byt  BCZ t |t 1  ( A  BC ) Z t |t 1  Byt .
(12.2-40)
Since E (ut 1 )  0 , using (12.2-40), equation (12.2-2) can be written as
yt 1|t  CZ t 1|t  C ( A  BC ) Z t |t 1  CByt
(12.2-41)
and iterated into the form
yt 1|t  CByt ,
,  C( A  BC )k Byt k  C( A  BC )k 1 Zt k |t k 1
(12.2-42)
for k  {1, 2, } , which converges to VAR form as k approaches  since ( A  BC )k 1 approaches
the null matrix. Aoki (1987, 108) shows how eigenvalue analysis of ( A  BC ) provides an estimate
of how many lags one can use in the forecasting equation. In addition to the eigenvalues of
2
2
( A  BC ) , diagnostic statistics include R and THETA. R j is defined as ( jreal
  jimag
).5 , while
THETAj = arctan(  jreal /  jimag ) , where  j is the jth eigenvalue of ( A  BC ) .
It should be stressed that the Aoki procedure (1987, 128) is sensitive to scaling of the data,
which affects the singular values, and to alternative values for K and NSTAR. It is imperative that the
user experiment with alternative models and inspect the percentage reduction in the sum of squares.
Given the parameters supplied, the Aoki approach estimates an unconstrained model in that various
terms in A and B are not constrained to zero. Its use should be an upper bound against which other
forecasting approaches, such as VARMA, are tested.8 For further detail on this approach, see Aoki
(1987).
8 Aoki's code was initially real*4. One of the first changes was to convert all code to real*8. Aoki's eigenvalue routine
was found to produce poor answers under some conditions. The appropriate eispack code was substituted. Aoki accepted
these changes. In order to test the effect of the change in the eigenvalue routines, the switch IOLDD is provided to allow
calls to the original code. This option is not recommended. Occasionally the procedure will run into computational
overflows if K and NSTAR are set too large. Reductions are in order. As a first approximation, it is best to set K to its
default of 6 and NSTAR to 1 and gradually build up the model.
12-16
Chapter 12
12.3 Examples
Using the Box-Jenkins (1976) gas furnace data, that was studied in Chapter 8, the following
commands were used to estimate the Geweke (1982b) measures for unconditional feedback .
b34sexec options ginclude(‘gas.b34’); b34srun;
b34sexec varfreq datap=4 years=(1900,1) Yeare=(1973,4)$
var time gasin gasout constant$
varf nlags=6 var=(gasin,gasout) feedx=(gasin) feedy=(gasout)
Dummy=cons nrep=100
Table=('gas model')
Freq=(1.0 .9 .85 .8 .7 .6 .5 .4 .3 .2 .1 0.0)$
b34seend$
b34sexec varfreq datap=4 years=(1900,1) Yeare=(1973,4)$
var time gasin gasout constant$
varf nlags=6 var=(gasin,gasout) feedx=(gasin) feedy=(gasout)
Dummy=cons nrep=1000
Table=('gas model')
Freq=(1.0 .9 .85 .8 .7 .6 .5 .4 .3 .2 .1 0.0)$
b34seend$
In the first problem NREP was set to 100. The edited output for running this example
follows.9
9 The mtsm program, which is called with the varfreq command, actually has local-data-building capability. Since this
capability is dominated by what is available in SAS or the B34S data procedure, these commands have not been
implemented in the B34S command language. These commands in the native command form are documented in Stokes
(1996a) and are accessible with use of the pgmcards$ sentence. The main contribution of the mtsm program is to
calculate conditional and unconditional measures of feedback. These options are controlled with the varf sentence. At
first glance the command structure of the varfreq command seems redundant. The var sentence is used to load data into
the mtsm program. If the varf sentence is supplied, the local var parameter on the varf sentence indicates which
variables are to be used in the feedback analysis. If feedx and feedy variables are supplied, unconditional feedback
analysis is performed. If, in addition, feedz is supplied, conditional feedback analysis is performed.
Special Topics in Time Series Analysis
Multivariate Time Series Modeling Option Selected
Set up to run for
Series #
1
2
3
4
296
Observations
B34S Variable #
1
2
3
4
Name
TIME
GASIN
GASOUT
CONSTANT
MTSM Option Selected
B34S
B34S
B34S
B34S
NOTE:
variable
variable
variable
variable
XXXX-
1
2
3
4
TIME
GASIN
GASOUT
CONSTANT
Loaded
Loaded
Loaded
Loaded
on
on
on
on
unit
unit
unit
unit
11
11
11
11
ALL DATA LOADED IN UNFORMATED FORM
MULTIPLE TIME SERIES MANIPULATOR Edition 8302
DATE 15/ 1/10
Copyright (c) 1983 by John Geweke. All rights reserved.
Program Modified Feb 1997 By Houston H. Stokes
Storage Available in Real*8 =60000000
Observations per year:
4
Maximum data range -First observation (GIVE YEAR AND PERIOD) :
1900 1
Last observation (GIVE YEAR AND PERIOD) :
1973 4
Number of columns:
8
******* REAL*8 WORDS AVAILABLE FOR WORKSPACE.
>
SCAN
UNFORMATED/FORMATED/FREE:
UNFORMAT
FILE UNIT # (ENTER 11 IF UNFORMATED FROM B34S):
11
Series Name
Range
Obs/Yr
Mean
Minimum
1 TIME
1900 1 1973 4 4
0.14850E+03 0.10000E+01
2 GASIN
1900 1 1973 4 4 -0.56834E-01 -0.27160E+01
3 GASOUT
1900 1 1973 4 4
0.53509E+02 0.45600E+02
4 CONSTANT
1900 1 1973 4 4
0.10000E+01 0.10000E+01
AT TIME
Maximum
0.29600E+03
0.28340E+01
0.60500E+02
0.10000E+01
TABLE gas model
6 lags
ESTIMATED MEASURES OF LINEAR Feedback
QUARTERLY DATA
1900: 1 - 1973: 4
296 observations
Dummy variables: CONSTANT
X vector: GASIN
Y vector: GASOUT
Estimate
0.005 ( 0.5%)
0.668 (48.7%)
0.014 ( 1.4%)
Adjusted
0.001
0.780
0.003
Estimate
( 0.1%)
(54.1%)
( 0.3%)
25.0%
0.000
0.689
0.000
75.0%
0.001
0.860
0.004
f(Y to X)
PERIOD
ESTIMATE
2.000
0.002 ( 0.2%)
2.222
0.002 ( 0.2%)
2.353
0.001 ( 0.1%)
2.500
0.001 ( 0.1%)
2.857
0.000 ( 0.0%)
3.333
0.000 ( 0.0%)
4.000
0.001 ( 0.1%)
5.000
0.003 ( 0.3%)
6.667
0.008 ( 0.8%)
10.000
0.015 ( 1.5%)
20.000
0.015 ( 1.4%)
Infinite
0.013 ( 1.3%)
ADJUSTED
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.001
0.004
0.005
0.005
ESTIMATE
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.1%)
( 0.4%)
( 0.5%)
( 0.5%)
25.0 %
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.001
0.001
0.001
75.0 %
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.002
0.006
0.006
0.007
f(X to Y)
PERIOD
ESTIMATE
2.000
0.009 ( 0.9%)
2.222
0.010 ( 1.0%)
2.353
0.012 ( 1.2%)
2.500
0.012 ( 1.2%)
2.857
0.010 ( 1.0%)
3.333
0.010 ( 1.0%)
4.000
0.027 ( 2.7%)
5.000
0.119 (11.2%)
6.667
0.696 (50.1%)
10.000
1.899 (85.0%)
20.000
3.174 (95.8%)
Infinite
1.805 (83.6%)
ADJUSTED
0.007
0.008
0.010
0.011
0.008
0.008
0.026
0.138
0.945
2.313
3.779
1.603
ESTIMATE
( 0.7%)
( 0.8%)
( 1.0%)
( 1.1%)
( 0.8%)
( 0.8%)
( 2.5%)
(12.9%)
(61.1%)
(90.1%)
(97.7%)
(79.9%)
25.0 %
0.001
0.002
0.003
0.003
0.002
0.002
0.011
0.080
0.637
1.824
2.677
0.995
75.0 %
0.012
0.012
0.014
0.015
0.011
0.011
0.034
0.179
1.172
2.790
4.401
1.798
F(Y to X)
F(X to Y)
F(X.Y)
8:21:18
100 replications
12-17
12-18
Chapter 12
The preceding output shows the gas furnace data loaded into the mtsm program which is a
part of B34S. A VAR model of order 6 was estimated, using the Whittle (1963) approach. The
coefficients here are not in agreement with those reported in Table 8.1, which employed the joint
estimation approach. The residual variance for the joint estimation for GASIN and GASOUT was
.0341 and .0557, respectively. For the Whittle approach, the corresponding values were .0342197
and .095217, respectively. This is not surprising since each row of the unconstrained VAR model can
be estimated with OLS, and the OLS estimators have the BLUE property or are best, linear, unbiased
and efficient. As Geweke (1982a, 1982b, 1982c, 1984) notes, the Whittle approach is fast and
guarantees invertibility. The order of the model was chosen to be 6 because that was what was
suggested by Tiao and Box (1981). With these few lags, the minimum difference between
2 / p . In this test problem more
frequencies should be .3333π since | 0  1 | 
frequencies were estimated. The results show little contemporaneous relationship since Fx y  1.4% ,
little feedback since Fy x  .5% and a substantial relationship from x to y since Fx y  48.7% .
Decomposing this by frequency shows most of the relationship at low frequency. For example, at
frequency .4π, 11.2%; at frequency .3π, 50.1%; at frequency .2π, 85%, and at frequency .1π, 95.8%.
The periods associated with these frequency measures are 5, 6.667, 10 and 20, respectively. Note that
we have been reporting the results on the original data.
In order to obtain 25% and 75% confidence intervals for these measures and the adjusted
results, 100 replications were calculated. These confidence bounds are the adjusted estimates of the
frequency feedback effects and are reported in TABLE GAS DATA. The results are consistent with
what was found with the original data; most of the effect of GASIN on GASOUT is at low frequency
and there is no feedback from GASOUT to GASIN which confirms what we know about this famous
dataset. Since there is only causality from GASIN to GASOUT, this model can be estimated with a
transfer function or a VAR model. The next run estimates the same model, using 1,000 replications.
The output for this run has been heavily edited to show just the final table. Close inspection of the
table shows that while the estimated values are the same, the adjusted estimates are not the same
because 900 more replications were run. The code runs quite fast. On an IBM 3090/300J, the first
problem ran in 2.9 seconds, while the second ran in 28.6973 seconds. Considering that 1,001 VAR
models were estimated and decomposed into the frequency domain and 1,000 sets of data were
generated, these times are understandable. The reader in encouraged to try this on a modern PC. On
Dell 3056 Mhz machine running Windows XP, the times were .4 and 4.093 seconds respectively
showing how far we have come in 12 years. Since the times are relatively short, it suggests that the
frequency decomposition of the VAR model with a substantial number of replications is practical.
The output prints after every 10% of the replications are done to give the user some idea of what
percentage of the problem has been solved in case the problem terminates, prior to finishing, by
running out of CPU time.
Special Topics in Time Series Analysis
12-19
TABLE gas model
6 lags
ESTIMATED MEASURES OF LINEAR Feedback
QUARTERLY DATA
1900: 1 - 1973: 4
296 observations
Dummy variables: CONSTANT
X vector: GASIN
Y vector: GASOUT
Estimate
0.005 ( 0.5%)
0.668 (48.7%)
0.014 ( 1.4%)
Adjusted
0.001
0.782
0.003
Estimate
( 0.1%)
(54.3%)
( 0.3%)
25.0%
0.000
0.706
0.000
75.0%
0.001
0.864
0.004
f(Y to X)
PERIOD
ESTIMATE
2.000
0.002 ( 0.2%)
2.222
0.002 ( 0.2%)
2.353
0.001 ( 0.1%)
2.500
0.001 ( 0.1%)
2.857
0.000 ( 0.0%)
3.333
0.000 ( 0.0%)
4.000
0.001 ( 0.1%)
5.000
0.003 ( 0.3%)
6.667
0.008 ( 0.8%)
10.000
0.015 ( 1.5%)
20.000
0.015 ( 1.4%)
Infinite
0.013 ( 1.3%)
ADJUSTED
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.001
0.004
0.005
0.005
ESTIMATE
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.0%)
( 0.1%)
( 0.4%)
( 0.5%)
( 0.5%)
25.0 %
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.001
0.002
0.001
75.0 %
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.000
0.002
0.005
0.007
0.007
f(X to Y)
PERIOD
ESTIMATE
2.000
0.009 ( 0.9%)
2.222
0.010 ( 1.0%)
2.353
0.012 ( 1.2%)
2.500
0.012 ( 1.2%)
2.857
0.010 ( 1.0%)
3.333
0.010 ( 1.0%)
4.000
0.027 ( 2.7%)
5.000
0.119 (11.2%)
6.667
0.696 (50.1%)
10.000
1.899 (85.0%)
20.000
3.174 (95.8%)
Infinite
1.805 (83.6%)
ADJUSTED
0.007
0.008
0.009
0.010
0.007
0.007
0.027
0.143
0.958
2.271
3.896
1.628
ESTIMATE
( 0.7%)
( 0.8%)
( 0.9%)
( 1.0%)
( 0.7%)
( 0.7%)
( 2.6%)
(13.3%)
(61.6%)
(89.7%)
(98.0%)
(80.4%)
25.0 %
0.001
0.002
0.002
0.003
0.002
0.002
0.012
0.089
0.686
1.761
2.911
1.124
75.0 %
0.010
0.011
0.012
0.013
0.009
0.010
0.036
0.184
1.186
2.667
4.506
1.900
F(Y to X)
F(X to Y)
F(X.Y)
1000 replications
While the gas furnace data indicated that there was little feedback in the model, the next
example, which is based on Stokes (1986b), indicates the problems of feedback. This example is
based on Frankel's (1982) long-term expected price series. The Geweke (1982b) procedure is used to
study the relationship between the Frankel (l982) expected price series and a representative actual
price series. Building on Lovell (l986), this approach is shown to be a generalized way to test the
implications of the Mills (1957) implicit expectations model and the Muth (l961) rational
expectations model.
In an ingenious article, Frankel (1982, 140) proposed extracting a new measure of inflation from
the interest rate term structure. During the period 1959/8 to 1979/4 he found that the market
underestimated inflation in the 1970s and that his measure of expected inflation "does a slightly
better job of predicting actual inflation, in terms of mean squared error, than do survey data." Stokes
(1986b), from which this example was adapted, provided a further test of the dynamic implications
of the proposed new inflation measure, using a test proposed by Geweke (1982b, 1984). The Geweke
procedure provides additional information on the dynamics of what is being measured in the
proposed inflation measure beyond that contained in the mean squared error procedure utilized by
Frankel, which relates the new expected inflation measure and the actual price series at only the same
time period. An underlying assumption of the proposed testing procedure is that the appropriate way
to measure the relationship between two series in the long and short run is in the frequency domain,
where short (long) run is high (low) frequency. The usual way to relate series is in terms of lag
12-20
Chapter 12
length, with long (short) run being a long (short) lag length. The economic reason for using the
frequency approach is that while the market place may be able to detect low- frequency cycles, highfrequency cycles, by their very nature, are harder to detect. The models proposed here must be related
to prior work on implicit expectations and rational expectations by Mills (1957) and Muth (1961),
which have been summarized by Lovell (1986).
If we assume that Ft is an expected (forecasted) inflation measure and Pt is the actual
inflation series, Lovell (1986, eq. [4]) argues that the Mills (1957) implicit expectations model could
be written in terms of an OLS model of the form
Ft   0  1Pt  u1, t ,
(12.3-1)
where it is assumed that α0 = 0, α1 =1, E(u1,t) = 0 and the predicted error (u1,t) is uncorrelated with the
actual realization Pt or E(u1,t ,Pt) =0. The strong form of the Mills' implicit expectations hypothesis
(strong implicit expectations) cannot be tested in practice since it would require that the error process
of equation (12.3-1) be uncorrelated with the entire information set available to the researcher. A
proposed weak form of the implicit expectations model (weak implicit expectations), which can be
tested in practice, would require that the error process of equation (12.3-1) be uncorrelated with past
forecasts, ( E (u1, t , Ft  j )  0 for j  {1, , q} , and past realizations, ( E (u1, t , Pt  j )  0 for j  0) . If
these added assumptions were violated, it would imply that Pt cannot be used as an unbiased proxy
for Ft in empirical work, which was suggested by Mills (1957).
Lovell (1986) argues that the Muth (1961) rational expectations model requires that the
forecast error of equation (12.3-2), u2,t , be distributed independently of the anticipated value, Ft.
This approach reverses the orthogonality condition of Mills (1957). According to Lovell (1986, eq.
[5A]), Muth's model in OLS terms is
Pt   0  1Ft  u2, t ,
(12.3-2)
where  0  0, 1  1, E (u2, t )  0 and the error is uncorrelated with the forecasted or anticipated
value, Ft , ( E (u2, t , Ft  0). The strong form of the rational expectations hypothesis (strong rational
expectations) is difficult to test in practice since it requires that the errors of equation (12.3-2) (u2, t )
be "uncorrelated with the entire set of information that is available to the forecaster at the time the
prediction is made" (Lovell 1986, 113). The weak form of the rational expectations hypothesis
(weak rational expectations), which can be tested in practice, requires that the error process, (u2, t ) ,
be uncorrelated with "historical information on prior realizations of the variable being forecast"
(Lovell 1986, 113), or ( E (u2, t , Pt  j )  0 for j  {1, , q} , and historical values of the forecasted
variable, ( E (u2, t , Ft  j )  0 for j  {1,
, q} .
Special Topics in Time Series Analysis
12-21
Lovell (1986) makes the important point that under the Muth (1961) hypothesis concerning
expectations, the variance of Pt is greater than the variance of Ft, while under the Mills (1957)
hypothesis, the reverse holds. Weak rational expectations requires that the prediction error be
uncorrelated with "historical information on prior realizations of the variable being forecast" (Lovell
1986, 113), ( E (u2, t , Pt  j )  0 for j  {1, , q} and historical values of the forecasted variable, Ft,
( E (u2, t , Ft  j )  0 for j  {1,
, q} . Lovell (1986) suggests using equation (12.3-3) to test the Muth
(1961) model since if b2 is significant, the weak rational expectations hypothesis will be violated.
Pt  b0  b1Ft  b2 Pt 1
(12.3-3)
It is important to note that equation (12.3-3) can only be used to reject the weak rational
expectations hypothesis since just because b2 is not significant does not in and of itself rule out that
for some other lag, Pt-k would be significantly related to the forecast error of equation (12.3-3). To do
a complete test of either of the weak implicit or the weak rational expectations hypothesis requires a
general model of the form of equations (12.1-8) and (12.1-9).
Equations (12.1-8) and (12.1-9) are generalizations of equations (12.3-1) and (12.3-2), where
in this example we substitute xt  Ft and yt  Pt .10 Significant terms in F3, t for lags {1, , q} would
reject the weak implicit expectations hypothesis and call into question the suggestion of Mills (1957)
that Pt can be used as a proxy for Ft in empirical work. In equation (12.1-9) a finding of significant
terms in H3i would reject the weak rational expectations hypothesis since it would imply that the
error term of a simpler model, such as (12.3-2), is not orthogonal to prior information (in this case
prior expectations values). These tests can be made in the frequency domain, using Geweke's
approach. The objective will be to test at what frequency the data are consistent with, or reject, the
weak forms of the implicit and rational expectations models. Frankel (1982) asserted he was
developing a long-run measure of inflation. By decomposing into the frequency domain, we can test
whether the relationship is long run (low frequency) or short run (high frequency).
Table 12.1 lists the commands needed to test the Frankel data. The variable DIFFPRCE is
the first difference of the Frankel (1982) expected price change series. The series DPCZU_1,
DPCZU_12 and DPCZU_60 are first differences of the annualized percent change in the urban CPI
calculated from a monthly change, a yearly change and a five-year change. It is not clear from theory
what actual price series to use and three models are attempted.
10 In equation (12.1-8) if we substitute
Ft for xt , Ft  F3i .
12-22
Chapter 12
Table 12.1 Testing The Frankel Price Expectations Data
/$
Runs chapter 12 sample output
b34sexec options ginclude('b34sdata.mac') member(frankel); b34srun;
b34sexec varfreq datap=12 years=(1959,9) yeare=(1979,4)$
var Diffprce dpczu_1$
varf var=(diffprce dpczu_1) nlags=12 feedx=(diffprce)
feedy=(dpczu_1) dummy=cons nrep=100 table=('ONE')
period=(120. 60. 40. 32. 16. 12. 10. 8. 7. 6. 5. 4. 3. 2. 0.)$
b34seend$
b34sexec varfreq datap=12 years=(1959,9) yeare=(1979,4)$
var Diffprce dpczu_12$
varf var=(diffprce dpczu_12) nlags=12 feedx=(diffprce)
feedy=(dpczu_12) dummy=cons nrep=100 table=('TWO')
period=(120. 60. 40. 32. 16. 12. 10. 8. 7. 6. 5. 4. 3. 2. 0.)$
b34seend$
b34sexec varfreq datap=12 years=(1959,9) yeare=(1979,4)$
var Diffprce dpczu_60 $
varf var=(diffprce dpczu_60) nlags=12 feedx=(diffprce)
feedy=(dpczu_60) dummy=cons nrep=100 table=('THREE')
period=(120. 60. 40. 32. 16. 12. 10. 8. 7. 6. 5. 4. 3. 2. 0.)$
b34seend$
Edited output from running the above problem follows.
TABLE ONE
12 lags
Estimated Measures of Linear Feedback
MONTHLY DATA
1959: 9 - 1979: 4
236 observations
Dummy variables: CONSTANT
X vector: DIFFPRCE
Y vector: DPCZU_1
Estimate
0.075 ( 7.3%)
0.059 ( 5.7%)
0.009 ( 0.9%)
Adjusted
0.049
0.033
0.006
Estimate
( 4.8%)
( 3.3%)
( 0.6%)
25.0%
0.036
0.026
0.001
75.0%
0.062
0.039
0.008
F(Y TO X)
PERIOD
ESTIMATE
120.000
0.018 ( 1.8%)
60.000
0.018 ( 1.8%)
40.000
0.019 ( 1.9%)
32.000
0.020 ( 2.0%)
16.000
0.026 ( 2.5%)
12.000
0.034 ( 3.3%)
10.000
0.052 ( 5.1%)
8.000
0.104 ( 9.9%)
7.000
0.151 (14.0%)
6.000
0.183 (16.7%)
5.000
0.052 ( 5.1%)
4.000
0.006 ( 0.6%)
3.000
0.393 (32.5%)
2.000
0.001 ( 0.1%)
Infinite
0.018 ( 1.8%)
ADJUSTED
0.008
0.009
0.009
0.009
0.010
0.013
0.027
0.078
0.127
0.156
0.023
0.001
0.409
0.000
0.008
ESTIMATE
( 0.8%)
( 0.9%)
( 0.9%)
( 0.9%)
( 1.0%)
( 1.3%)
( 2.7%)
( 7.5%)
(11.9%)
(14.4%)
( 2.3%)
( 0.1%)
(33.5%)
( 0.0%)
( 0.8%)
25.0 %
0.001
0.001
0.001
0.002
0.003
0.004
0.009
0.033
0.053
0.076
0.006
0.000
0.185
0.000
0.001
75.0 %
0.012
0.012
0.012
0.011
0.012
0.016
0.038
0.106
0.163
0.219
0.034
0.001
0.606
0.000
0.011
F(X TO Y)
PERIOD
ESTIMATE
120.000
0.076 ( 7.3%)
60.000
0.093 ( 8.8%)
40.000
0.112 (10.6%)
32.000
0.126 (11.8%)
16.000
0.154 (14.3%)
12.000
0.118 (11.1%)
10.000
0.067 ( 6.5%)
8.000
0.055 ( 5.4%)
7.000
0.087 ( 8.3%)
6.000
0.097 ( 9.2%)
5.000
0.021 ( 2.1%)
4.000
0.044 ( 4.3%)
3.000
0.013 ( 1.3%)
2.000
0.119 (11.2%)
Infinite
0.069 ( 6.7%)
ADJUSTED
0.045
0.065
0.088
0.104
0.129
0.085
0.038
0.031
0.064
0.072
0.007
0.024
0.002
0.073
0.038
ESTIMATE
( 4.4%)
( 6.3%)
( 8.4%)
( 9.9%)
(12.1%)
( 8.1%)
( 3.7%)
( 3.0%)
( 6.2%)
( 7.0%)
( 0.7%)
( 2.3%)
( 0.2%)
( 7.1%)
( 3.7%)
25.0 %
0.008
0.021
0.043
0.057
0.075
0.045
0.015
0.009
0.026
0.031
0.002
0.008
0.001
0.011
0.003
75.0 %
0.067
0.100
0.124
0.141
0.171
0.110
0.048
0.044
0.082
0.095
0.010
0.036
0.003
0.099
0.056
F(Y TO X)
F(X TO Y)
F(X.Y
100 replications
Special Topics in Time Series Analysis
TABLE TWO
12 lags
Estimated Measures of Linear Feedback
MONTHLY DATA
1959: 9 - 1979: 4
236 observations
Dummy variables: CONSTANT
X vector: DIFFPRCE
Y vector: DPCZU_12
Estimate
0.089 ( 8.5%)
0.074 ( 7.2%)
0.018 ( 1.8%)
Adjusted
0.062
0.047
0.015
Estimate
( 6.1%)
( 4.6%)
( 1.5%)
25.0%
0.048
0.038
0.007
75.0%
0.074
0.056
0.019
F(Y TO X)
PERIOD
ESTIMATE
120.000
0.105 (10.0%)
60.000
0.300 (25.9%)
40.000
0.858 (57.6%)
32.000
0.686 (49.7%)
16.000
0.091 ( 8.7%)
12.000
0.066 ( 6.4%)
10.000
0.077 ( 7.4%)
8.000
0.153 (14.2%)
7.000
0.022 ( 2.2%)
6.000
0.006 ( 0.6%)
5.000
0.009 ( 0.9%)
4.000
0.013 ( 1.3%)
3.000
0.049 ( 4.8%)
2.000
0.031 ( 3.0%)
Infinite
0.068 ( 6.6%)
ADJUSTED
0.087
0.296
0.942
0.754
0.084
0.055
0.058
0.101
0.007
0.001
0.000
0.005
0.031
0.017
0.052
ESTIMATE
( 8.4%)
(25.6%)
(61.0%)
(53.0%)
( 8.0%)
( 5.4%)
( 5.6%)
( 9.6%)
( 0.7%)
( 0.1%)
( 0.0%)
( 0.5%)
( 3.0%)
( 1.6%)
( 5.1%)
25.0 %
0.036
0.166
0.538
0.476
0.054
0.031
0.025
0.045
0.003
0.000
0.000
0.001
0.012
0.003
0.011
75.0 %
0.110
0.374
1.159
0.917
0.100
0.068
0.081
0.132
0.010
0.002
0.001
0.007
0.039
0.023
0.069
F(X TO Y)
PERIOD
ESTIMATE
120.000
0.015 ( 1.5%)
60.000
0.037 ( 3.6%)
40.000
0.065 ( 6.3%)
32.000
0.087 ( 8.3%)
16.000
0.148 (13.8%)
12.000
0.099 ( 9.5%)
10.000
0.032 ( 3.1%)
8.000
0.063 ( 6.1%)
7.000
0.163 (15.0%)
6.000
0.262 (23.0%)
5.000
0.136 (12.7%)
4.000
0.008 ( 0.8%)
3.000
0.096 ( 9.1%)
2.000
0.064 ( 6.2%)
Infinite
0.006 ( 0.6%)
ADJUSTED
0.005
0.021
0.049
0.072
0.128
0.071
0.012
0.034
0.127
0.226
0.119
0.001
0.056
0.038
0.001
ESTIMATE
( 0.5%)
( 2.1%)
( 4.8%)
( 6.9%)
(12.0%)
( 6.8%)
( 1.2%)
( 3.4%)
(11.9%)
(20.2%)
(11.3%)
( 0.1%)
( 5.4%)
( 3.7%)
( 0.1%)
25.0 %
0.001
0.009
0.023
0.033
0.056
0.022
0.003
0.015
0.076
0.146
0.047
0.000
0.020
0.006
0.000
75.0 %
0.006
0.027
0.063
0.096
0.174
0.102
0.015
0.047
0.178
0.297
0.175
0.002
0.080
0.055
0.001
F(Y TO X)
F(X TO Y)
F(X.Y
100 replications
12-23
12-24
Chapter 12
TABLE THREE
12 lags
Estimated Measures of Linear Feedback
MONTHLY DATA
1959: 9 - 1979: 4
236 observations
Dummy variables: CONSTANT
X vector: DIFFPRCE
Y vector: DPCZU_60
Estimate
0.062 ( 6.0%)
0.034 ( 3.3%)
0.023 ( 2.3%)
Adjusted
0.034
0.014
0.018
Estimate
( 3.3%)
( 1.4%)
( 1.8%)
25.0%
0.026
0.010
0.007
75.0%
0.041
0.018
0.025
F(Y TO X)
PERIOD
ESTIMATE
120.000
0.165 (15.2%)
60.000
0.128 (12.0%)
40.000
0.101 ( 9.6%)
32.000
0.088 ( 8.4%)
16.000
0.071 ( 6.8%)
12.000
0.092 ( 8.7%)
10.000
0.135 (12.7%)
8.000
0.215 (19.3%)
7.000
0.188 (17.1%)
6.000
0.128 (12.0%)
5.000
0.060 ( 5.8%)
4.000
0.014 ( 1.4%)
3.000
0.045 ( 4.4%)
2.000
0.001 ( 0.1%)
Infinite
0.187 (17.0%)
ADJUSTED
0.120
0.090
0.068
0.058
0.052
0.070
0.110
0.173
0.149
0.093
0.023
0.004
0.017
0.000
0.133
ESTIMATE
(11.3%)
( 8.6%)
( 6.5%)
( 5.7%)
( 5.1%)
( 6.8%)
(10.4%)
(15.8%)
(13.8%)
( 8.9%)
( 2.3%)
( 0.4%)
( 1.6%)
( 0.0%)
(12.5%)
25.0 %
0.026
0.026
0.026
0.026
0.022
0.024
0.047
0.080
0.074
0.045
0.006
0.001
0.005
0.000
0.024
75.0 %
0.171
0.130
0.088
0.079
0.063
0.090
0.157
0.239
0.216
0.119
0.034
0.005
0.025
0.000
0.198
F(X TO Y)
PERIOD
ESTIMATE
120.000
0.006 ( 0.6%)
60.000
0.017 ( 1.7%)
40.000
0.035 ( 3.4%)
32.000
0.051 ( 5.0%)
16.000
0.125 (11.7%)
12.000
0.126 (11.8%)
10.000
0.099 ( 9.5%)
8.000
0.043 ( 4.2%)
7.000
0.013 ( 1.3%)
6.000
0.002 ( 0.2%)
5.000
0.006 ( 0.6%)
4.000
0.008 ( 0.8%)
3.000
0.025 ( 2.5%)
2.000
0.050 ( 4.8%)
Infinite
0.002 ( 0.2%)
ADJUSTED
0.001
0.005
0.017
0.030
0.095
0.099
0.072
0.020
0.003
0.000
0.001
0.001
0.008
0.025
0.000
ESTIMATE
( 0.1%)
( 0.5%)
( 1.7%)
( 3.0%)
( 9.0%)
( 9.4%)
( 6.9%)
( 2.0%)
( 0.3%)
( 0.0%)
( 0.1%)
( 0.1%)
( 0.8%)
( 2.5%)
( 0.0%)
25.0 %
0.000
0.002
0.008
0.014
0.037
0.043
0.033
0.006
0.001
0.000
0.000
0.000
0.003
0.003
0.000
75.0 %
0.001
0.007
0.022
0.040
0.139
0.131
0.086
0.025
0.005
0.000
0.001
0.001
0.011
0.035
0.000
F(Y TO X)
F(X TO Y)
F(X.Y
100 replications
The Frankel (1982) expected price series, Ft, runs from 1959/7 to 1979/4 and consists of 237
observations. The selection of an actual price series to relate to this series is not unique. A reasonable
choice to use was the consumer price index-urban (CPI-U), which was obtained from the August
1982 version of the NBER/Citybase data tape for the period 1954/7 to 1979/4. Three transformations
of this series were used in the empirical work. If we assume that ZUt is the raw CPI-U series, then
DPCZU_1 = (1-B) * 12 * ((ZUt - ZUt-1)/ZUt-1) is a first difference of the annualized
percent change in ZUt. This transformation is comparable to a first difference of the Frankel (1982)
expected long-run inflation rate, DIFFPRCE = (1-B) * Ft .(Both series were differenced once
to achieve stationarity with full knowledge that low frequency information may be lost with such a
transformation.) An argument can be made that since the Frankel series is an expected long-run
inflation rate, the appropriate actual series to use would involve calculation of the percent change
over a longer period. To deal with this concern, two additional transformations of ZUt were tried. An
intermediate measure, DPCZU_12 =(1-B)((ZUt - ZUt-12)/ZUt-12), annualizes on the basis
of a year, while, DPCZU_60=(1-B)*(.2)*((ZUt-ZUt-60)/ZUt-60), a more long term measure
annualizes on the basis of a five-year horizon. The same data period, 1959/9 to 1979/4, was used to
facilitate comparisons among alternative transformations of the price series. As was discussed
earlier, the maximum order of the polynomial in Q(B) in equation (8.1-9) was selected from
inspection of autocorrelations of the VAR model estimated by OLS.
Special Topics in Time Series Analysis
12-25
The results from estimating the three models will be discussed in turn.11 In the output labeled
TABLE ONE, the results for the annualized percent change in the CPI-U (DPCZU_1) indicates
strong (33.5%) high-frequency (period=3) feedback from the differenced inflation series to the
differenced expected inflation series. This indicates that at this frequency the predicted error of
equation (12.3-1) is not uncorrelated with the entire set of information that was available and, thus,
that at this frequency the weak form of the implicit expectations hypothesis does not hold. In terms
of our prior notation, we have significant terms in F3i in equation (12.1-8). The only other feedback
found of any note is at somewhat lower frequencies in which for periods = 8, 7, and 6, the percent
explained was 7.5%, 11.9%, and 14.4%, respectively, for the estimates corrected for small-sample
bias. There is less evidence of lags of the expected price series mapping to the actual price series; the
only evidence of any relationship was found at lower frequencies. For example, at periods = 60, 40,
32, 16, and 12, the percentages explained are only 6.3%, 8.4%, 9.9%, 12.1%, and 8.1%, respectively.
Overall, there was more of a relationship from Pt to Ft (F(Y to X) = 4.8%) than from Ft to Pt
(F(X to Y) = 3.3%). We can summarize by noting that the feedback from the actual price series
to the expected series was at a high frequency and much stronger than the much lower low frequency
mapping from the expected price series to the actual price series. These results are more consistent
with the weak form of the rational expectations model than the weak form of the implicit
expectations model and are at least consistent with Frankel's (1982) paper in which he indicated that
his expected price measure was a long-run (low frequency in our terms) measure.
The table labeled TABLE TWO uses the yearly inflation measure and presents a somewhat
different frequency finding. The overall measures F(Y to X) and F(X to Y) are larger than in
the first case (6.1% vs. 4.8% and 4.6% vs. 3.3%, respectively). In contrast with the prior case, we
see large low-frequency feedback, which would indicate rejection of the weak form of the implicit
expectations hypothesis at low frequencies. For example, at periods equal to 60, 40, and 32, the
percent explained is 25.6%, 61.0%, and 53.0%, respectively. Going the other way (F(X to Y)),
there is little evidence of a relationship, except for relatively low values at periods equal to 16, 7, and
6 in which the percentages are 12.0%, 11.9%, and 20.2%, respectively. It is worth noting that the
effect found at 16 for F(X to Y) is relatively similar across the two tables. However it is apparent
that the low-frequency findings appear to be sensitive to the construction of the actual price series.
The finding that the relationship from Pt to Ft dominates the relationship from Ft to Pt is similar to
that in the prior case. The findings in both tables are consistent with the Muth (1961) weak rational
expectations hypothesis. Unlike the first table in which the weak implicit expectations hypothesis
was rejected at high frequencies, here the rejection is at low frequencies.
The final table labeled TABLE THREE utilizes the longest run measure for Pt (DPCZU_60). The
findings here are more similar to those found in the first table than in the second. The strongest
feedback was found at a very low frequency (at period = 120, the percent is 11.3%), at several
intermediate frequencies (at periods= 12, 10, 8, and 7, the percentages were 6.8%, 10.4%, 15.8%,
11 Because the adjusted estimates are the result of the bootstrap, if the varfreq command is given repeatedly, the
estimates will differ since the random-number generator used to generate the artificial data does not generate the
same random-number sequence.
12-26
Chapter 12
and 13.8%, respectively) and at one very high frequency (at Inf [  ] the percentage is 12.5%). Going
the other way (i. e., F(X to Y)), there is little evidence of a relationship except for small effects at
periods 16, 12, and 10 in which the percentages are 9.0%, 9.4%, and 6.9%, respectively. The
summary measures F(X to Y) and F(Y to X) are less than in either of the prior tables but
follow the same pattern (i. e., F(X to Y) < F(Y to X)). As in the prior two tables, the results
in the final table are consistent with the weak form of the Muth (1961) rational expectations
hypothesis and relatively less consistent with the weak form of the Mills (1957) implicit expectations
hypothesis.
It is stressed that the intention of this example is to investigate the dynamic relationship
between the proposed Frankel (1982) expected price series and three actual price series, not to test
the Muth (1961) or Mills (1957) expectations hypothesis. To effectively perform the latter tests
requires a different econometric setup and jointly estimating and testing the Frankel (1982) series
with appropriate cross equations restrictions. The more modest goal was to take the published
Frankel series as a given, relate this series to three proposed price series and discuss the economic
meaning of the dynamic relationships found. In contrast with the gas furnace data example, in this
case there was feedback going both directions. This model would not be appropriate for a transfer
function model.
The following commands were used to test the kfilter command on the Box-Jenkins (1976)
gas furnace data that were used in the prior example and which we have used throughout this book as
a test case
B34sexec kfilter $
Seriesn var=gasin$
Seriesn var=gasout$
Estimate k=8 nstar=5 forecast$
B34seend$
B34sexec kfilter $
Seriesn var=gasin$
Seriesn var=gasout$
Estimate k=5 nstar=5 forecast$
B34seend$
Edited output from running this test problem follows.
Special Topics in Time Series Analysis
12-27
STATE SPACE PROGRAM AOKI1. WRITTEN BY MASANAO AOKI.
MODIFIED FOR B34S BY HOUSTON H. STOKES JANUARY 1988.
Note: I/O improvements 15 February 2009
MODEL ESTIMATED.
Y(T)
X(T+1)
=
=
C * X(T) +
A * X(T) +
E(T)
B * E(T)
E(E(T)*transpose(E(T)) = DELTA
E(X(T)*transpose(X(T)) = PI
FOR THIS PROBLEM
K (NUMBER OF LAGS ON HANKEL MATRIX) =
NSTAR (DIMENSION OF STATE VECTOR) =
MXITER (MAXIMUM NUMBER OF ITERATIONS) =
EPS (STEP SIZE) =
P (NUMBER OF SERIES) =
IOLDD (= 0 IF WANT EISPACK) =
DIFFERENCING OPERATOR -
5
5
500
0.50000000E-01
2
0
NEW(T)= OLD(T) - OLD(T-DIF)
0 0
LOG OPERATOR -
IF LOG NE 1, NEW = LOG(OLD)
0 0
AOKI1 PROGRAM REQUIRES
15457 REAL*4 WORDS OF SPACE.
SERIES #
1
2
SERIES
SERIES
30000000
WAS AVAILABLE
MEAN
-0.56834459E-01
53.509122
1 SLOPE= -0.38228485E-02 INTERCEPT=
2 SLOPE= 0.15004026E-01 INTERCEPT=
0.51085854
51.281024
Means of Series used
-0.568345E-01
53.5091
Sums of Squares
340.450
850540.
SUM (X(T) - XBAR)**2
339.494
SERIES
SERIES
3024.81
1 SLOPE= -0.76147219E-03 INTERCEPT= 0.11307862
2 SLOPE= 0.29886479E-02 INTERCEPT= -0.44381421
Variances
1.146937901650383 -1.658526509998173
-1.658526509998173 10.21893706628927
1 LAG
1.0924
-2.0487
-1.3470
9.9201
SINGULAR VALUES
35.350
3.3761
0.81214
0.12489
0.17416E-01
0.71937E-02
0.56033E-02
0.77173E-03
0.63382E-03
0.24768E-
03
1.0D+00/DSQRT(N)=
5.812381937190964E-02
100 * SUMEI / SUMEIG
1
2
3
4
5
6
7
8
9
10
100 * SUMSI / SUMSIN
99.043049
99.946456
99.998733
99.999969
99.999993
99.999997
100.00000
100.00000
100.00000
100.00000
SUM EIGENVALUES (SUMEIG)
=
SUM SQRT(ABS(EIGENVAL)) (SUMSIN) =
89.053962
97.559127
99.605095
99.919722
99.963596
99.981719
99.995835
99.997779
99.999376
100.00000
1261.664680963640
39.69453570883305
THISS
1.0000000
0.95505744E-01
0.22974465E-01
0.35329991E-02
0.49267049E-03
0.20350151E-03
0.15851236E-03
0.21831300E-04
0.17930051E-04
0.70066071E-05
REMA
0.12291466
0.27408916E-01
0.44344514E-02
0.90145232E-03
0.40878183E-03
0.20528032E-03
0.46767958E-04
0.24936658E-04
0.70066071E-05
0.0000000
DROP
1.0000000
10.470574
4.1570389
6.5028221
7.1711199
2.4209672
1.2838211
7.2607844
1.2175816
2.5590205
12-28
Chapter 12
SUMSI(I)
SUMEI(I)
THISS(I)
REMA
DROP
SINGULAR
= SUM(S(I))
= SUM(SQRT(ABS(S(I))))
= SQRT(ABS(S(I)) /SQRT(ABS(S(I-1)))
= (SUMSIN - SUMSI) / SQRT(S(I-1))
= SQRT(S(I)) / SQRT(S(I-1))
VALUES OF H = SQRT(EIGENVALUES OF Ht*H)
Eigenvalues of A:
0.71636152
, 0.38383714
0.71636152
, -0.38383714
1.1173485
,
0.0000000
0.90154896
,
0.0000000
0.17420200
,
0.0000000
)
)
)
)
)
R
R
R
R
R
=
=
=
=
=
0.81271445
0.81271445
1.1173485
0.90154896
0.17420200
THETA
THETA
THETA
THETA
THETA
=
=
=
=
=
0.49188732
-0.49188732
0.0000000
0.0000000
0.0000000
m matrix.
1
2
3
4
5
1
-1.03146
-1.20119
-0.376156
-0.157824
-0.433495E-01
2
3.08280
-0.131591
-0.365824
0.827198E-01
0.449870E-01
c matrix.
1
2
Pi
1
-0.480715
3.21457
2
-0.433580
-1.15310
Matrix - Deviation=
3
-0.202575
0.360184
4
-0.651687E-02
-0.102177
5
0.392315E-01
-0.307765E-01
49.45449774232699
DELTA MATRIX
1
2
1
0.478867E-01
0.477670E-01
2
0.477670E-01
0.219846
Pi
Matrix - Deviation=
Pi
Matrix
1
2
3
4
5
1
1.09089
0.305755
1.06865
3.87609
-1.67409
47.26590730760364
2
0.305755
1.09542
2.86573
7.47725
-3.02982
3
1.06865
2.86573
-4.34357
-19.8777
9.85908
4
3.87609
7.47725
-19.8777
-73.4652
34.0877
5
-1.67409
-3.02982
9.85908
34.0877
-14.4345
DELTA INVERSE
1
2
1
26.6608
-5.79272
2
-5.79272
5.80725
B * DELTA MATRIX
1
2
3
4
5
1
0.671610E-01
0.181278E-01
-0.584021
-1.49135
0.402706
2
0.269193
0.250975
-1.27778
-3.77496
1.57305
B MATRIX
1
2
3
4
5
1
0.231211
-0.970527
-8.16866
-17.8934
1.62422
2
1.17422
1.35246
-4.03732
-13.2832
6.80235
PREDICT. MULTIPLIER
1
2
3
4
5
1
-2.77625
-4.85691
9.09024
34.0639
-21.0866
2
1.62155
1.84842
-8.46968
-23.1130
8.52224
EIGENVALUES OF PRED:
( -0.51729830
, 0.65263239
( -0.51729830
, -0.65263239
( 0.34279799
,
0.0000000
( 0.13203925
, 0.70835522
3
-0.378855
-0.228090
0.446285
0.806614
-2.09470
)
)
)
)
R
R
R
R
=
=
=
=
4
0.120835
0.208565E-01
-0.222411
-0.403558
0.369010
0.83278243
0.83278243
0.34279799
0.72055637
THETA
THETA
THETA
THETA
5
0.447471E-01
0.139161
0.328551
-0.142921
0.457375
=
=
=
=
2.2410293
-2.2410293
0.0000000
1.3865087
Special Topics in Time Series Analysis
( 0.13203925
N =
296
, -0.70835522
)
R =
0.72055637
THETA =
12-29
-1.3865087
Sums of squares before
1
339.491
2
3024.72
Sums after
1
14.0160
2
37.2148
Percentage Reduction
1
95.8715
2
98.7696
Sum After Update
1
14.0160
2
37.2148
Percentage Reduction
1
95.8715
2
98.7696
PREDICTED VALUES (OUT OF SAMPLE)
297
-0.2795
56.71
298
-0.2593
56.47
299
-0.5999E-01
56.36
300
0.2522
56.60
301
0.6267
56.99
302
1.022
57.29
303
1.411
57.39
304
1.781
57.26
305
2.134
56.93
306
2.484
56.49
307
2.845
56.02
308
3.235
55.58
309
3.669
55.22
310
4.159
54.95
311
4.711
54.76
312
5.333
54.64
313
6.028
54.56
314
6.802
54.49
315
7.660
54.42
316
8.612
54.34
317
9.669
54.25
318
10.84
54.15
319
12.15
54.05
RESIDUALS FOR SERIES
1
MEAN =
-0.38839899E-03
VARIANCE =
0.47511635E-01
AUTOCORRELATIONS
1-12
13-24
25-36
37-48
-0.223
0.044
-0.006
-0.046
-0.132
0.122
0.003
0.072
0.299
-0.130
0.079
-0.054
RESIDUALS FOR SERIES
2
-0.308
0.015
-0.044
-0.065
MEAN =
0.103
0.062
-0.047
0.025
0.131
-0.068
0.023
-0.056
0.24545942E-02
-0.188
-0.048
-0.039
0.049
VARIANCE =
0.125
0.011
0.056
0.064
-0.072
0.044
0.055
-0.072
-0.061
0.065
-0.042
0.019
0.168
-0.003
0.074
-0.002
-0.161
-0.008
0.006
-0.007
-0.059
0.037
0.008
0.022
0.138
-0.032
-0.030
0.049
-0.032
0.024
0.025
-0.116
0.12614595
AUTOCORRELATIONS
1-12
13-24
25-36
37-48
-0.280
-0.005
0.033
-0.027
-0.187
0.033
-0.073
-0.004
0.196
-0.098
0.103
0.017
Autocovariances of Error Terms
lag
1
0.47350E-01 -0.26774E-02
-0.26774E-02 0.12543
lag
2
-0.10551E-01 0.22220E-01
-0.22874E-01 -0.35105E-01
lag
3
-0.62421E-02 -0.28022E-01
0.24463E-01 -0.23224E-01
lag
4
0.14186E-01
-0.33786E-01
lag
5
0.17990E-02
0.24280E-01
-0.260
0.054
0.002
-0.004
0.091
-0.001
-0.112
0.046
0.161
0.019
0.073
-0.085
-0.158
-0.022
-0.020
-0.003
0.057
-0.061
-0.079
0.123
-0.037
0.032
0.099
-0.087
12-30
Chapter 12
-0.14594E-01 0.11186E-01
0.81811E-02 -0.32337E-01
lag
6
0.48770E-02 -0.14553E-01
0.21518E-01 0.11175E-01
lag
7
0.62137E-02
-0.26543E-01
0.77244E-02
0.19783E-01
lag
8
-0.88742E-02 0.12694E-02
0.69698E-02 -0.19362E-01
lag
9
0.59351E-02 -0.12752E-01
0.66906E-02 0.67233E-02
lag
10
-0.34119E-02 0.12724E-01
-0.95228E-02 -0.51862E-02
lag
11
-0.28918E-02 -0.16244E-02
0.11125E-01 -0.72582E-02
lag
12
0.79538E-02 -0.23217E-02
-0.33620E-02 0.17369E-01
lag
13
-0.76545E-02 0.57065E-02
-0.57092E-02 -0.42876E-02
lag
14
0.20865E-02 -0.32057E-02
0.47239E-02 -0.77125E-03
lag
15
0.58072E-02 -0.14743E-02
-0.69330E-02 0.38540E-02
lag
16
-0.61381E-02 0.29748E-02
0.86650E-02 -0.12015E-01
lag
17
0.69776E-03 -0.39930E-02
0.11480E-02 0.70352E-02
lag
18
0.29307E-02 -0.75419E-03
-0.52673E-02 -0.10045E-03
lag
19
-0.32306E-02
0.72716E-02
0.37502E-02
0.22872E-02
lag
20
-0.22608E-02 0.13420E-02
-0.85793E-02 -0.27595E-02
lag
21
0.50275E-03 -0.38668E-02
-0.26853E-02 -0.76932E-02
lag
22
0.20735E-02
0.55670E-02
0.22938E-02
0.36447E-02
lag
23
0.30648E-02
-0.47802E-02
0.64547E-03
0.48200E-02
lag
24
-0.12880E-03 -0.20375E-02
0.27267E-03 -0.37529E-02
B34S KALMAN FILTER OPTION ENDING
The percentage reduction in the sum of squares for GASIN and GASOUT was 94.87% and 88.36%,
respectively, for the first model, which set K=8 and NSTAR=5 which is not shown. Another test
problem, whose output is not shown, set K=20 and NSTAR=20 and was way too large. If the
interested reader runs this model, it will fail. A simple model in which K=5 and NSTAR=5 results
in a 95.87% and 98.77% reduction, respectively, in the sum of squares which appears to be superior
to the K=8, NSTAR=5 model. The Aoki code seems to be sensitive to rounding errors. If users
experiment with the options command real16on, which can also be set with the Display Manager,
Special Topics in Time Series Analysis
12-31
the solution will change. This finding suggests caution when using this command. The value 5 was
chosen for the state vector because the singular values of the Hankel matrix fell off after 5. For
example the first five singular values were 42.932, 4.3061, 1.5686, .47783, and .12362. The sixth
value fell to .046122 . By reducing the size of the Hankel matrix from eight to five, the performance
of the GASOUT model improved.12 The Hankel matrix H was not printed since the option IHANKL
was not supplied.
12 These results should be compared with the sixth-order VAR model estimated in Chapter 8 using the setup in Table
8.3. Here the percent reduction in the sum of squares for GASIN and GASOUT was 97.03% and 99.46%, respectively.
12-32
Chapter 12
12.4 Unit Roots
Testing for unit roots is an important task for time series model builders. While a covariance
stationary time series exhibits mean reversion, has a finite variance that is time-invariant and a
theoretical correlogram that dies out as lag length increases, a nonstationary series violates these
three assumptions.
Assume yt  1 yt 1  ut
(12.4-1)
(12.4-1) is stationary if | 1 |  1 . If | 1 |  1 , the process is explosive and if | 1 |  1 , we have a
unit root.
Assume an infinite MA process where 0  1
yt    0ut  1ut 1  2ut 2 
(12.4-2)

The process will be covariance stationary if

i 0
2
i
converges. If this condition is not met, neither the
variance nor the covariance is defined. Since E ( yt )   then
 0  E[ yt  E ( yt )]2
 E[ 0ut  1ut 1   2ut 2 
 E[(ut ) 2  (1ut 1 ) 2 
= u
]2
]  E (cross product terms)
(12.4-3)

2
 ( )
i 0
2
i
since the expected value of all cross-product terms is zero and E[ut2 ]  E[ut21 ]
 j  E[ yt  E ( yt )][ yt  j  E ( yt  j )]
 E[(ut  1ut 1   2ut 2 
)(ut  j  1ut  j 1   2ut  j 2 
 E[ j ut2 j  1 j 1ut2 j 1 
]  E (cross product terms)
  u 2 ( j  1 j 1 

=  u2 ii  j
i 0
)
)]
(12.4-4)
Special Topics in Time Series Analysis
If i  1 , then  j is not defined for j  0,
12-33
,.
yt    ut  ut 1  ut 2 
(12.4-5)
and the process is a random walk which does not have a defined variance or autocovariance.
Equation (12.4-5) can result from equation (12.4-1) if we assume that y0  0 .
Hamilton (1994, 33) shows that the model
yt  1 yt 1  2 yt 2 
  p yt  p  ut
(12.4-6)
is stationary if the roots of
(1  1z  2 z 2 
 p z p )  0
(12.4-7)
lie outside the unit circle. The B34S polysolv command can be used to test an AR model such as
(12.4-6) which is the same as (7.1-10). The polysolv command can also test a mixed (ARMA)
model (7.1-9), or MA model (7.1-11) since both these variants can be easily put in the form of (12.46) by the use of (7.1-12) and (7.1-13). A few examples are given next. The code listed below tests
the models
(1  .4 B  .6 B 2  .7 B 3 ) yt  ut
(12.4-8)
and
(1  .4 B  .6 B 2  .7 B 3 ) yt  ut .
(12.4-9)
The first model will be found to be stationary, while the second model is nonstationary. This is not
apparent from inspection of the model. In addition to formally testing the model by calculating the
roots of the appropriate form of (12.4-7), sample series are generated for 40 observations. These can
be optionally listed and/or plotted to see what is happening
/$ Test (1+.4B+.6B**2+.7B**3)x(t) = u(t)
b34sexec polysolv$
polydivide top(1, .4, .6, .7) bot(1.0) nterms(15)$ b34srun$
/$ Test (1-.4B-.6B**2-.7B**3)x(t) = u(t)
b34sexec polysolv$
polydivide top(1,-.4,-.6,-.7) bot(1.0) nterms(15)$ b34srun$
b34sexec data noob=40 maxlag=3$
build noise ar1 ar2$
gen noise=rn()$
gen ar1=lp(3,1,noise) ar(-.4,-.6,-.7) ma(1.0) values(0. 0. 0.)$
gen ar2=lp(3,1,noise) ar( .4, .6, .7) ma(1.0) values(0. 0. 0.)$
b34srun$
12-34
Edited output is listed next.
Chapter 12
Special Topics in Time Series Analysis
B34S Version 7.11c
(D:M:Y)
09/01/96 (H:M:S) 15:10:08
12-35
STAT. PROC. STEP
PAGE
1
PAGE
2
PAGE
3
Polynomial Division
Order of Numerator
Order of Denominator
# of terms in answer
Numerator
3
0
15
Coefficients
Lag
0
1
2
3
Coef.
1.0000000
0.40000000
0.60000000
0.70000000
Denominator Coefficients
Lag
0
Coef.
1.0000000
IRF
Lag
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Coef.
1.0000000
0.40000000
0.60000000
0.70000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
Coefficients
#
1
2
3
Real Root
-1.2813147
0.21208594
0.21208594
B34S Version 7.11c
Complex Root
0.00000000
1.0343818
-1.0343818
(D:M:Y)
Sum
1.0000000
1.4000000
2.0000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
2.7000000
Sqrt(real**2 + imag**2)
1.2813147
1.0559007
1.0559007
09/01/96 (H:M:S) 15:10:08
STAT. PROC. STEP
Polynomial Division
Order of Numerator
Order of Denominator
# of terms in answer
Numerator
3
0
15
Coefficients
Lag
0
1
2
3
Coef.
1.0000000
-0.40000000
-0.60000000
-0.70000000
Denominator Coefficients
Lag
0
Coef.
1.0000000
IRF
Lag
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Coef.
1.0000000
-0.40000000
-0.60000000
-0.70000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
Coefficients
#
1
2
3
Real Root
0.77645918
-0.81680102
-0.81680102
B34S Version 7.11c
Variable
NOISE
AR1
AR2
CONSTANT
(D:M:Y)
Mean
1 -0.43220285E-01
2 -0.13779822E-01
3
2469.6411
4
1.0000000
Data file contains
Complex Root
0.00000000
1.0829081
-1.0829081
Sqrt(real**2 + imag**2)
0.77645918
1.3564121
1.3564121
09/01/96 (H:M:S) 15:10:08
Standard Deviation
1.0198357
1.8672405
4787.4466
0.00000000
37. observations on
Sum
1.0000000
0.60000000
0.00000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
-0.70000000
DATA STEP
Variance
1.0400648
3.4865871
22919645.
0.00000000
Maximum
2.2317419
3.1651969
20427.467
1.0000000
4 variables. Current missing value code is
Minimum
-2.1448941
-4.0842507
2.1871299
1.0000000
0.1000000000000000E+32
12-36
Chapter 12
Equation (12.4-8) had ( ri 2  ii2 ).5  1.0 for all i roots (1.2813, 1.0559, 1.0559), while equation (12.49) had one root less than 1 (.77645, 1.3564, 1.3564), indicating the underlying model is not
stationary. Consider the mixed model  ( B) yt   ( B)et . If this model is to be transformed to the long
AR form [ ( B) /  ( B)] yt  et or the long MA from yt  [ ( B) /  ( B)]et , then the roots of
[ ( B ) /  ( B )] in the first case and [ ( B ) /  ( B )] in the second case must be greater than one. The
data step generates test series AR1 (stationary with  = -.0137798 and s 2 = 3.486587) and AR2
(not stationary  = 2469.64 and s 2 = 22919645.) as an illustration. These can be plotted. The
polysolv command can be used to generate the MA form of (12.4-8) and (12.4-9). The code that
follows
b34sexec polysolv$
polydivide top(1.0) bot(1, .4, .6, .7) nterms(35)$
b34seend$
b34sexec polysolv$
polydivide top(1.0) bot(1,-.4,-.6,-.7) nterms(35)$
b34seend$
when run, shows that for (12.4-8) the MA terms die out while for (12.4-9) the terms explode due to
the fact that the series is not invertible. All the roots of the MA form of (12.4-8) show
( ri 2  ii2 ).5  1.0 while for the MA form of (12.4-9) ( ri 2  ii2 ).5  1.0 for all terms.
Polynomial Division
Order of Numerator
Order of Denominator
# of terms in answer
Numerator
0
3
35
Coefficients
Lag
0
Coef.
1.0000000
Denominator Coefficients
Lag
0
1
2
3
Coef.
1.0000000
0.40000000
0.60000000
0.70000000
IRF
Lag
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Coef.
1.0000000
-0.40000000
-0.44000000
-0.28400000
0.65760000
0.21536000
-0.28190400
-0.47677440
0.20910016
0.39975738
0.48379034E-01
-0.40557615
-0.14662712
0.26813122
0.26462709
-0.16409058
-0.28083187
0.25548133E-01
0.27314328
0.71996121E-01
-0.21056811
-0.15017072
0.13601187
0.18309536
-0.49725760E-01
-0.18517522
-0.24261209E-01
0.15561765
0.81932321E-01
-0.10916067
-0.11442748
Coefficients
Sum
1.0000000
0.60000000
0.16000000
-0.12400000
0.53360000
0.74896000
0.46705600
-0.97184000E-02
0.19938176
0.59913914
0.64751817
0.24194202
0.95314896E-01
0.36344611
0.62807320
0.46398262
0.18315075
0.20869888
0.48184216
0.55383828
0.34327017
0.19309945
0.32911132
0.51220668
0.46248092
0.27730570
0.25304449
0.40866214
0.49059446
0.38143379
0.26700631
Special Topics in Time Series Analysis
31
32
33
34
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Real Root
1.0471638
1.0471638
-0.15182008
-0.15182008
-1.0789516
-1.0789516
1.0626995
-1.0088991
-1.0088991
0.69674259
0.69674259
0.92563552
0.92563552
-0.50095261
-0.50095261
-0.79674137
-0.79674137
0.38674304
0.38674304
1.0010202
1.0010202
0.54984769
0.54984769
-1.1191267
-0.65768509
-0.65768509
-0.91462152
-0.91462152
0.30849874E-01
0.30849874E-01
0.82321916
0.82321916
-0.33076099
-0.33076099
0.53914770E-01
0.12350305
-0.16508467E-02
-0.11118183
Complex Root
-0.17919858
0.17919858
1.0463054
-1.0463054
0.21730669
-0.21730669
0.00000000
0.40174075
-0.40174075
0.79578166
-0.79578166
0.51713958
-0.51713958
0.93581527
-0.93581527
0.71391907
-0.71391907
0.98270110
-0.98270110
0.35325202
-0.35325202
0.90236667
-0.90236667
0.00000000
0.83763703
-0.83763703
0.56763162
-0.56763162
1.0558249
-1.0558249
0.66610127
-0.66610127
1.0059695
-1.0059695
0.32092108
0.44442413
0.44277328
0.33159145
Sqrt(real**2 + imag**2)
1.0623861
1.0623861
1.0572626
1.0572626
1.1006175
1.1006175
1.0626995
1.0859434
1.0859434
1.0576950
1.0576950
1.0602992
1.0602992
1.0614630
1.0614630
1.0698024
1.0698024
1.0560642
1.0560642
1.0615218
1.0615218
1.0566920
1.0566920
1.1191267
1.0649814
1.0649814
1.0764470
1.0764470
1.0562755
1.0562755
1.0589526
1.0589526
1.0589511
1.0589511
Polynomial Division
Order of Numerator
Order of Denominator
# of terms in answer
Numerator
0
3
35
Coefficients
Lag
0
Coef.
1.0000000
Denominator Coefficients
Lag
0
1
2
3
Coef.
1.0000000
-0.40000000
-0.60000000
-0.70000000
IRF
Lag
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Coef.
1.0000000
0.40000000
0.76000000
1.2440000
1.2336000
1.7718400
2.3196960
2.8545024
3.7739066
4.8460513
6.2009161
8.0297318
10.324678
13.288352
17.130960
22.052670
28.401490
36.583870
47.111311
60.675889
78.145851
100.64179
129.61735
166.93411
214.99331
276.88993
356.60584
459.27161
591.49510
761.78509
981.10122
1263.5581
1627.3335
2095.8391
2699.2265
Coefficients
#
1
Real Root
-0.79930235
Complex Root
0.71988181E-01
Sum
1.0000000
1.4000000
2.1600000
3.4040000
4.6376000
6.4094400
8.7291360
11.583638
15.357545
20.203596
26.404512
34.434244
44.758922
58.047274
75.178234
97.230904
125.63239
162.21626
209.32757
270.00346
348.14931
448.79111
578.40846
745.34257
960.33587
1237.2258
1593.8316
2053.1033
2644.5984
3406.3834
4387.4847
5651.0428
7278.3763
9374.2155
12073.442
Sqrt(real**2 + imag**2)
0.80253757
12-37
12-38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Chapter 12
-0.79930235
0.67191964
0.67191964
0.59364464
0.59364464
-0.77426887
-0.77426887
-0.15967729
-0.15967729
0.38407647
0.38407647
0.12365871
0.12365871
-0.72444718
-0.72444718
0.76462356
0.76462356
-0.55230525
-0.55230525
0.72944859
0.72944859
-0.65021762
-0.65021762
0.25855938
0.25855938
-0.17010086E-01
-0.17010086E-01
-0.43349113
-0.43349113
0.49680320
0.49680320
-0.30024399
-0.30024399
-0.71988181E-01
0.39247567
-0.39247567
0.50517215
-0.50517215
0.21406874
-0.21406874
0.78178080
-0.78178080
-0.68293082
0.68293082
0.77986512
-0.77986512
0.35043414
-0.35043414
-0.13611460
0.13611460
0.58883414
-0.58883414
0.26823444
-0.26823444
0.47702243
-0.47702243
0.74255811
-0.74255811
0.79333077
-0.79333077
0.67952324
-0.67952324
0.60297372
-0.60297372
0.74415142
-0.74415142
0.80253757
0.77814726
0.77814726
0.77949526
0.77949526
0.80331670
0.80331670
0.79792109
0.79792109
0.78352360
0.78352360
0.78960819
0.78960819
0.80475326
0.80475326
0.77664430
0.77664430
0.80732071
0.80732071
0.77720329
0.77720329
0.80643248
0.80643248
0.78628589
0.78628589
0.79351311
0.79351311
0.80601885
0.80601885
0.78127507
0.78127507
0.80243865
0.80243865
We will now discuss nonstationary time series and tests for nonstationarity. Such tests are
needed before proceeding to model series. We first outline some important classes of models. The
mean of a model of the form of (12.4-2) is independent of t, provided that the roots of the MA model
are outside the unit circle. In other words the stability of an MA model of the form yt   ( B)et can
be tested by determining whether the roots of  ( B ) or (1/  ( B )) lie outside the unit circle since by
inspection of (1/  ( B )) we have put the model in the form of (12.4-6). The model
yt     t   ( B)et
(12.4-10)
is a deterministic time trend and is characterized as trend stationary, while
(1  B) yt     ( B)et
(12.4-11)
is a unit root process provided that  (1)  0 where  (1) is the polynomial
 ( z )  1  1 z1   2 z 2 
(12.4-12)
evaluated at z  1 . This restriction rules out the original series yt being stationary. For a further
discussion see Hamilton (1994, 436). A special case of (12.4-11) is a random process with a drift δ
yt  yt 1    et .
(12.4-13)
A series is said to be integrated of order k or yt ~ I (k ) if the series needs to be differenced k times
to achieve stationarity. A VAR model of the form of (8.1-9) can be estimated with a non- stationary,
Special Topics in Time Series Analysis
12-39
or unit root, series in the vector Z t if the residual vectors are stationary. Following Engle - Granger
(1987) such a model would be characterized as cointegrated. To forecast a trend stationary process
such as (12.4-10) the deterministic component    t is added to the forecast of the stationary
component. To forecast a unit root process such as (12.4-11) first forecast (1  B) yt and then
reconstruct the level yt as the sum of the changes in the variable. The forecast of a random walk
with a drift such as (12.4-13) s periods ahead is
yˆ s t |t  s  yt .
(12.4-14)
An ARIMA(0,1,1) model implies a drift. Here
yt  yt 1  et   et 1.
(12.4-15)
The forecast s periods ahead would be
yˆ t  s |t  s  yt   et ,
(12.4-16)
where et is the one-period-ahead forecast error defined as
et  yt  yˆ t |t 1.
(12.4-17)
Assuming that   0 and s  1 Hamilton (1994, 440) shows how equation (12.4-16) can be
transformed to adaptive expectations, assuming that |  |  1 since in this case
(1  B)1  lim j  (1   B   2 B2   3B3 
 jB j )
(12.4-18)
since yˆ t 1|t can be written as
yˆ t 1|t  (1   ) yt   yˆ t |t 1
(12.4-19)
yˆt 1|t  [(1   ) yt ]  ( )[(1   ) yt 1 ]  ( )2 [(1   ) yt 2 ] 
(12.4-20)

yˆ t 1|t  (1   ) (   ) j yt  j .
(12.4-21)
j 0
Friedman (1957) used an equation such as (12.4-21) to forecast permanent income. Muth (1961)
noted that (12.4-21) would be a rational expectations forecast only if the underlying process was
ARIMA(0,1,1) and the smoothing weight was the negative of the MA coefficient.
12-40
Chapter 12
Often it is difficult to distinguish a unit root in practice. Hamilton (1994) notes that it will be
hard to distinguish between (12.4-13), where   0 , and (12.4-1), where | 1 |  1 . The s-period
ahead forecast of the first model is
yˆ s t |t  yt
(12.4-22)
wirth MSE
E ( yt s  yˆt s |t )2  s 2 ,
(12.4-23)
while for the second the corresponding values are
yˆ st |t  12 yt
E ( yt s  yˆt s |t )2  (1  12  14 
(12.4-24)
 12( s1) ) 2 .
(12.4-25)
For values of 1 close to unity (12.4-22) will look like (12.4-24) and (12.4-23) will look like (12.425). Comparable results follow for MA models. Models with breaks in the data can also fool the unit
root tests.
Hamilton (1994, Sect. 18.3) outlines the "spurious regression" problem, which was first
discussed by Granger and Newbold (1974). The problem relates to estimating a model of I(1)
variables when lags of the dependent variable and independent variables are not on the right-handside. Assume the model estimated was
yt    1 xt  et ,
(12.4-26)
where yt and xt were I(1). Phillips (1986) proved that an OLS t and F test diverges as T   ,
making it likely to obtain spurious results. To illustrate this problem assume yt and xt are totally
unrelated and follow random walks. Assume
yt  yt 1  e1t
(12.4-27)
and
xt  xt 1  e2 t .
(12.4-28)
Special Topics in Time Series Analysis
12-41
Estimate (12.4-26) and observe whether the t score for 1 is significant. The spurious regression
problem arises because the assumptions of OLS are violated. Assume y0  x0  0 in (12.4-27) and
(12.4-28). From (12.4-26) we have
et  yt  1 xt
(12.4-29)
or
t
t
i 1
i 1
et   e1t  1  e2 t
(12.4-30)
(12.4-30) implies that the variance of et increases without bound as t increases and has a permanent
component. Looking at (12.4-26), if 1  0 , then
yt    et .
(12.4-31)
Given yt is I(1) it follows that et has a unit root which is a violation of the OLS assumptions. There
are three ways to avoid the problem of spurious results. These are to estimate (12.4-26) in firstdifference form as
(1  B) yt     2 (1  B) xt  et .
(12.4-32)
to estimate (12.4-26) with GLS such as (2.3-11) or to put lags in (12.4-26) and estimate
yt    3 xt   4 xt 1  5 xt 2  6 yt 1  7 yt 2  et
(12.4-33)
The B34S program listed below illustrates these approaches for test cases of 10, 1,000, 10,000 and
100,000 observations.
12-42
Chapter 12
/$ Setup to call the older IMSL Random Number Routines
b34sexec options recver(ggubs) rnver(ggnml); b34srun;
%b34smacro spurious$
/$ Three proposed Spurious Reg. solutions are tested:
/$
GLS estimation. Note what values of p are found
/$
Regression on differenced data
/$
Regression using lags of y and x
/$ Call as %B34SMCALL SPURIOUS(NOOB= NNNN)$
b34sexec data noob=%b34seval(&NOOB+2) maxlag=2 $
build y x noise1 noise2 dify difx lag1y lag2y lag1x lag2x$
gen noise1=rn()$
gen noise2=rn()$
gen y=lp(1,1,noise1) ar(1.0) ma(1.0) values(0. )$
gen x=lp(1,1,noise2) ar(1.0) ma(1.0) values(0. )$
gen dify = y - lag(y)$ gen difx = x - lag(x)$
gen lag1y= lag1(y)$
gen lag2y= lag2(y)$
gen lag1x= lag1(x)$
gen lag2x= lag2(x)$
b34srun$
/$ b34sexec list iend=20$ b34seend$
b34sexec matrix;
call get(x,y);
call graph(x,y :heading 'Unit Root Series'
:nocontact :pgborder);
b34srun;
b34sexec regression maxgls=1 residuala$
model y=x$ b34srun$
b34sexec regression$
model dify = difx$ b34srun$
b34sexec regression$
model y = x lag1x lag2x lag1y lag2y$ b34srun$
%b34smend$
/$ Call the Macro
%b34smcall
%b34smcall
%b34smcall
%b34smcall
spurious(noob=10)$
spurious(noob=1000)$
spurious(noob=10000)$
spurious(noob=100000)$
For observations of 10, 1,000, 10,000 and 100,000, Equation (12.4-26) has significant t
scores for 1 of 2.250, -34.29, 38.20 and 98.10, respectively, even though there is no relationship
between xt and yt . GLS models for (12.4-26) are run for cases of 1,000, 10,000 and 100,000
observations, the significance of 1 goes away. The GLS  ranges from .9930 for the 1,000
observations case to .9998 for the 100,000 observations case. The first difference form of the model
(12.4-29) also removed the spurious significance on xt as does adding two period lags on xt and yt .
While differencing has proved effective in avoiding the spurious regression problem in this
case, Hamilton (1994) argues that if yt and xt are I(1) and are cointegrated, differencing is not
appropriate and the lag approach is preferred. This suggests that a VAR model, such as (8.1-9),
might be estimated without differencing. If this is done, the raw series and the error vector should be
tested for unit roots. If unit roots are found for the raw series but not for the error series, the series in
Special Topics in Time Series Analysis
12-43
the vector Z t in (8.1-9) would be cointegrated. If cross correlations are used to identify the
maximum order of the lag in the VAR model, the raw series have to be differenced. A better
identification strategy would be to estimate greater and greater lags of the VAR and select the
appropriate lag, using (8.2-1) and cross correlations and autocorrelations of the residuals. For further
discussion of cointegration see Engle and Granger (1987). The appropriate tests for unit roots will
now be discussed.
Table 12.2 Results of Spurious Regression Example
──────────────────────────────────────────────
N

10
Equation (12.4-26)
1,000
10,000
100,000
6.91220*
(5.047)
30.70769*
(58.34)
49.7001*
(210.4)
101.819*
(322.8)
.9500374*
(2.250)
-1.19415*
(-34.29)
.284640*
(38.20)
.211886*
(98.10)
R2
.31112
.5404
.1273
.0878

na
1
na
1

R2

2
Equation (12.4-26) Using GLS
45.8379*
45.1275*
(9.764)
(9.457)
138.1746*
(7.661)
na
-.02543
(-.790)
.9930
-.01462
(-1.457)
.9979
-.002387
(-.7516)
.9998
na
-.00033
.00011
-.43E-5
Equation (12.4-29) First Difference
-.08682
.058938
.003839
.001809
(-.196)
(1.821)
(.383) (.5709)
-.130283
(-.2821)
-.01246
(-.388)
-.015670
(-1.561)
-.00240
(-.757)
R2
-.1139
-.0009
.00014
-.438E-5

Equation (12.4-30)
3.90638
.07752
(1.720)
(1.052)
.141855*
(4.514)
.020525*
(2.496)
.26388
(.3803)
-.01043)
(-.3239)
-.01573
(-1.568)
-.002448
(-.771)
-.07116
(-.108)
-.02874
(-.6311)
.024342
(1.731)
.002861
(.6371)
.469100
(.9188)
.043528
(1.354)
-.00701
(-.6984)
-.00037
(-.1161)
.667769
(1.321)
.970872*
(30.64)
.991528*
(99.13)
.995863*
(314.9)
-.20630
(-.4487)
.029322
(.92312)
.006090
(.6093)
.003948
(1.248)
.43368
.99796
.99716
.9997
3
4
5
6
7
R2
12-44
Chapter 12
________________________________________________________
t scores listed under coefficients. R2 = adjusted R square. Coefficients
with t scores above │2│ marked with *. na = GLS satisfied b34s
default GLS tolerance. The below listed code will provide a graphic indication of the unit
root problem that causes the spurious regression:
b34sexec matrix;
call load(bj_iden);
call echooff;
subroutine sr(n,nacf,iplot);
/;
/; n
=> # of obs for spurious regression
/; nacf
=> # acf
/; iplot => ne 0 means high res plot
/;
y=cusum(rn(array(n:)));
x=cusum(rn(array(n:)));
call graph(y x :heading 'Plot of The Unit Root Series X Y'
:file 'ur_series.wmf');
call olsq(y x :print);
call outstring(13,3,'Spurious Regression for n = ');
call outinteger(40,3,n);
call outstring(13,4,'Coefficient for x');
call outdouble(40,4,%coef(1));
call outstring(13,5,'t for x');
call outdouble(40,5,%t(1));
call stop(pause);
call bj_iden(%res,nacf,
'ACF of residual of y=f(x) Model',1,'sr_1.wmf');
dif_y=dif(y);
dif_x=dif(x);
call olsq(dif_y dif_x :print);
call bj_iden(%res,nacf,
'ACF of residual of dif_y=f(dif_x) Model',1,'sr_2.wmf');
call olsq(y y{1} x x{1} :print);
call bj_iden(%res,nacf,
'ACF of residual of y=f(x lag(y) lag(x)) Model',1,'sr_3.wmf');
return;
end;
top continue;
i1=1;
call menu(i1 :menutype menutwo
:text 'stop'
:text 'go'
:prompt 'Continue with Spurious Regression example>'
);
if(i1.eq.1)go to quit;
n=30;
call menu(n :menutype inputint
Special Topics in Time Series Analysis
12-45
:prompt '# of cases =>'
);
nacf=min1(n/4,1000);
call menu(nacf :menutype inputint
:prompt '# of ACF =>'
);
nacf=min1(n/4,1000);
iplot=1;
call sr(n,nacf,iplot);
go to top;
quit continue;
b34srun;
Setting n=1000 and nacf=250 the two unit root series generated are:
Plot of The Unit Root Series X Y
70
60
50
40
30
Y
20
Y
10
0
-10
-20
X
-30
100
200
300
400
Figure 12.1 Plots of Two unit root series.
500
Obs
600
700
800
900
1000
X
12-46
Chapter 12
Which appear to be significantly related (t=-6.01).
Ordinary Least Squares Estimation
Dependent variable
Centered R**2
Adjusted R**2
Residual Sum of Squares
Residual Variance
Standard Error
Total Sum of Squares
Log Likelihood
Mean of the Dependent Variable
Std. Error of Dependent Variable
Sum Absolute Residuals
F( 1,
998)
F Significance
1/Condition XPX
Maximum Absolute Residual
Number of Observations
Variable
X
CONSTANT
Lag
0
0
Coefficient
-0.46477529
27.645206
Y
3.500573942410368E-02
3.403881130729416E-02
190936.0264324012
191.3186637599211
13.83179900663399
197862.3440915110
-4044.907749103251
35.30086940843483
14.07339349609777
10528.92953685986
36.20304220711766
0.9999999975066035
3.295458399506138E-04
38.65436035448965
1000
SE
0.77245022E-01
1.3454444
t
-6.0168964
20.547267
The residual plot and acf of this model produces:
ACF of residual of y=f(x) Model
30
20
X
10
0
-10
-20
-30
100
200
300
400
500
Obs
600
700
ACF of Above Series
1
.8
.8
.6
.6
.4
.4
.2
.2
0
0
-.2
-.2
-.4
-.4
-.6
-.6
-.8
-.8
20
40
60
80 100 120 140 160 180 200 220 240
Lag
900
1000
PACF of Above Series
1
-1
800
-1
20
40
Figure 12.2 Residual plot, ACF and PACF of model y=f(x).
60
80 100 120 140 160 180 200 220 240
Lag
Special Topics in Time Series Analysis
However when first differences and lags are introduced the results are:
Ordinary Least Squares Estimation
Dependent variable
Centered R**2
Adjusted R**2
Residual Sum of Squares
Residual Variance
Standard Error
Total Sum of Squares
Log Likelihood
Mean of the Dependent Variable
Std. Error of Dependent Variable
Sum Absolute Residuals
F( 1,
997)
F Significance
1/Condition XPX
Maximum Absolute Residual
Number of Observations
Variable
DIF_X
CONSTANT
Lag
0
0
Coefficient
0.14839378E-01
0.21071094E-01
DIF_Y
2.121239770502825E-04
-7.906722877671195E-04
1031.554906920082
1.034658883570795
1.017181834074319
1031.773770875777
-1433.537452088067
2.063654747662914E-02
1.016779943637434
816.8019796755107
0.2115324762292647
0.3543308136821022
0.9410280278635975
3.388283497590947
999
SE
0.32264666E-01
0.32196075E-01
t
0.45992660
0.65446158
and
Ordinary Least Squares Estimation
Dependent variable
Centered R**2
Adjusted R**2
Residual Sum of Squares
Residual Variance
Standard Error
Total Sum of Squares
Log Likelihood
Mean of the Dependent Variable
Std. Error of Dependent Variable
Sum Absolute Residuals
F( 3,
995)
F Significance
1/Condition XPX
Maximum Absolute Residual
Number of Observations
Variable
Y
X
X
CONSTANT
Lag
1
0
1
0
Coefficient
0.99629925
0.24381403E-01
-0.71428338E-02
0.43575403
with residual plots of:
Y
0.9948284089044124
0.9948128161674408
1017.540137761381
1.022653404785307
1.011263271747425
196755.7215862520
-1426.704693039557
35.33415198999778
14.04101212981140
813.6626663510121
63800.75612863960
1.000000000000000
3.435047817863626E-05
3.418865094317383
999
SE
0.23166461E-02
0.32222926E-01
0.32194164E-01
0.11773420
t
430.06104
0.75664771
-0.22186735
3.7011677
12-47
12-48
Chapter 12
ACF of residual of dif_y=f(dif_x) Model
3
2
X
1
0
-1
-2
-3
100
200
300
400
500
Obs
600
700
ACF of Above Series
1
.8
.8
.6
.6
.4
.4
.2
.2
0
0
-.2
-.2
-.4
-.4
-.6
-.6
-.8
-.8
20
40
60
80 100 120 140 160 180 200 220 240
Lag
900
PACF of Above Series
1
-1
800
-1
20
40
60
80 100 120 140 160 180 200 220 240
Lag
Figure 12.3 Residual Plot, ACF plot and PACF plot of (1  B) yt  f ((1  B) xt )
Special Topics in Time Series Analysis
12-49
ACF of residual of y=f(x lag(y) lag(x)) Model
3
2
X
1
0
-1
-2
-3
100
200
300
400
500
Obs
600
700
ACF of Above Series
1
.8
.8
.6
.6
.4
.4
.2
.2
0
0
-.2
-.2
-.4
-.4
-.6
-.6
-.8
-.8
20
40
60
80 100 120 140 160 180 200 220 240
Lag
900
PACF of Above Series
1
-1
800
-1
20
40
60
80 100 120 140 160 180 200 220 240
Lag
Figure 12.4 Residual plot, ACF plot and PACF plot of yt  f ( xt , xt 1, yt 1 )
12.5 Testing for Unit Roots
Hamilton (1994, chap. 17) outlines the theory behind the methods to test for unit roots. There
were initially two major approaches, Dickey and Fuller (1979) and Phillips and Perron (1988). Each
method has a number of variants.13 These include testing for stationarity when the series is not
autocorrelated beyond lag 1 and in the case when the process is autocorrelated beyond lag 1. One
point to consider in interpreting these test statistics is that both the Dickey Fuller and the Phillips
Perron tests have as the null a non stationary series. In order to reject the null (reject the hypothesis
that the series is nonstationary), the test statistic must be less than the critical value. A quick example
will illustrate what is involved. The below listed code will estimate a stationary series R and a non
stationary series UROOT and test for a unit root using the simplest Dickey Fuller Test (case 1) which
is discussed in more detail below.
13 Another widely used test for unit roots suggested by Elliott-Rothenberg-Stock (1996) was implemented as a
subroutine df_gls and will be discussed later.
12-50
Chapter 12
b34sexec matrix;
r=rn(array(1000:));
uroot=cusum(r);
call print('Dickey Fuller Tests on r');
call df(r
,d :print);
call print('Dickey Fuller Tests on uroot':);
call df(uroot ,d :print);
b34srun;
The results of running this code are:
B34S(r) Matrix Command. d/m/y 13/ 9/09. h:m:s
=>
R=RN(ARRAY(1000:))$
=>
UROOT=CUSUM(R)$
=>
CALL PRINT('Dickey Fuller Tests on r')$
6:43: 3.
Dickey Fuller Tests on r
=>
CALL DF(R
,D :PRINT)$
Dickey-Fuller Test
Critical Values: 1%
=>
(I) lag
-2.568
0 t
5%
-30.68
-1.940
prob
10%
0.0000
-1.616
prob
10%
0.1000
-1.616
CALL PRINT('Dickey Fuller Tests on uroot':)$
Dickey Fuller Tests on uroot
=>
CALL DF(UROOT ,D :PRINT)$
Dickey-Fuller Test
Critical Values: 1%
(I) lag
-2.568
0 t -0.2139
5%
-1.940
The DF test statistic for case 1 is -30.68 for the stationary series R and -.2139 for the nonstationary
series UROOT. Since -30.68 is less than the 1% critical value of -2.568 we can reject nonstationarity
at the 1% level and thus conclude we have a stationary series. For UROOT, the statistic -.2139 is not
less than the 1%, 5% or 10% critical values and thus we cannot reject the unit root.
Assume yt is the series to be tested for a unit root and that it does not contain any serial
correlation beyond lag 1. Case 1 for the Dickey-Fuller test assumes that the equation to be tested is
yt   yt 1  et .
(12.5-1)
To test whether a series contains a unit root (12.4-27) involves either calculating T ( ˆ  1) and using
case 1 in Table B.5 (Hamilton, 1994), or calculating ( ˆ  1) / ˆ ˆ and using case 1 in Table B.6 where
Special Topics in Time Series Analysis
12-51
T is the effective sample size after estimating (12.5-1).
Case 2 tests for a unit root in the presence of a constant and involves first estimating
yt     yt 1  et .
(12.5-2)
The test of whether yt in (12.5-2) contains a unit root is similar to case 1, except that case 2 of Table
B.5 and B.6 is used, depending on whether T ( ˆ  1) or ( ˆ  1) / ˆ ˆ is tested. Case 4 adds a trend to
(12.5-2) and estimates
yt     t   yt 1  et .
(12.5-3)
and operates in a similar fashion, except that case 4 in Table B.5 and B.6 is used. The augmented
Dickey-Fuller test adds lags of the difference of yt to equations (12.5-1) - (12.5-3) and tests for a
unit root assuming that there is autocorrelation greater than 1 remaining in the series. For lags up to k
(12.5-3) becomes
k
yt     t   yt 1   i (1  B ) B k 1 yt 1  et .
(12.5-4)
i 1
While the t test ( ˆ  1) / ˆ ˆ is tested in the usual fashion, using case 4 of Table B.6, the test in
k
RATS386 4.10c for ρ is T ( ˆ  1) /(1   i ) in place of T ( ˆ  1) which is shown in Hamilton
i 1
(1994, 502).
The Phillips-Perron (1988) method is substantially more difficult to calculate, although it
uses the same basic equations (12.5-1) to (12.5-3). For added detail, see Hamilton (1994, 510-512,
585). Assuming (12.5-2) was estimated and the lag = q, calculate
T
s 2  (T  2) 1  eˆi2
(12.5-5)
i 1
T
cˆ j  T 1  eˆi eˆi  j
(12.5-6)
i 1 j
q
ˆ 2  c0  2[1  ( j /( q  1))]cˆ j .
j 1
(12.5-7)
12-52
Chapter 12
The Phillips-Perron Z  test statistic is
Z   T ( ˆ  1)  .5(T ˆ ˆ / s)2 (ˆ 2  cˆ0 ),
(12.5-8)
while the Phillips-Perron Z t test statistic is
Zt  [(cˆ0 / ˆ 2 ).5 ( ˆ  1) / ˆ pˆ ]  [.5(Tˆ ˆ / s)(ˆ 2  cˆ0 ) / ˆ].
(12.5-9)
Note that the lag here is used in (12.5-7) to get an estimate of  2 . If the lag is not specified, RATS
assumes it to be 4 which can cause problems. The RATS command for this calculation is:
@PPUNIT(TTEST) series => @PPUNIT(TTEST,LAGS=4) series.
These tests are illustrated next, using the gas furnace GASOUT series. The RATS386
program version 4.10c procedures DFUNIT and PPUNIT are used, which are called under B34S
using the pgmcall procedure.14 In addition regression and data building steps are used to validate the
calculations. The bispec sentence contains procedures that mimic these commands.15 The command
14 The B34S procedure pgmcall provides the ability to call sas, speakeasy, rats, matlab and limdep
etc. under B34S. In this mode of operation the called program runs without user intervention and processes the data file
and command file built by the pgmcall command. Output is optionally copied back into the B34S output file and as far
as the user is concerned the called program is in fact a B34S procedure. The SAS macro cb34sm provides the ability
for SAS to call B34S.
15 The RATS rrunit procedure version dated November 1989 contains a minor "bug" in calculating ˆ ˆ that shows up
in small samples. A portion of the RATS code is shown next to illustrate the problem. The line marked * MOVE NEXT
LINE should be placed after * NEW SPOT. The "bug" in the RATS procedure arose due to the fact that the line
COMPUTE %SEESQ=%SEESQ*%NDF/%NOBS
redefined %SEESQ to calculate SU before ˆ ˆ was calculated. Note that RATS has four paths to calculate the Z p and
Z t statistics in place of (12.5-8) and (12.5-9) . If the indicated changes are made and dxx is calculated as
COMPUTE DXX = (%NOBS-1)*VARIANCE
instead of as
COMPUTE DXX = 1./%DET(%XX),
then both approaches are the same. In B34S the switch
B34SEXEC OPTIONS DEBUG(RATSPP)$ B34SEEND$
will give corrected versions of the RATS program output.
Special Topics in Time Series Analysis
12-53
df estimates (12.5-1) producing the Dickey-Fuller t test by default and Dickey-Fuller  test if the
option ZUNITROOT is supplied. Note that RATS with the call
@DFUNIT(TTEST,LAG=0)
is actually testing (12.5-2). The B34S commands adf(1,2) and adft(1,2) will produce lags 0, 1, and 2
augmented Dickey-Fuller tests (12.5-2) and augmented Dickey-Fuller with trend tests (12.5-3). The
corresponding commands for the Phillips-Perron test are pp, app( ) and appt( ). Since the bispec
sentence is callable from the rr, bjiden, bjest, btiden, btest, mars and pispline commands, it is
possible to test the residuals of these models. An example of how these tests might be used from
RATS is given next.
b34sexec options include('c:\b34slm\gas.b34')$ b34srun$
/$ user places RATS commands between
/$
PGMCARDS$
/$
note: user RATS commands here
/$
B34SRETURN$
/$
B34SEXEC OPTIONS OPEN('RATS.DAT') UNIT(28) DISP=UNKNOWN$ B34SRUN$
B34SEXEC OPTIONS OPEN('RATS.IN') UNIT(29) DISP=UNKNOWN$ B34SRUN$
B34SEXEC OPTIONS CLEAN(28)$ B34SRUN$
B34SEXEC OPTIONS CLEAN(29)$ B34SRUN$
B34SEXEC PGMCALL$
RATS PASSASTS
PCOMMENTS('* ',
'* Data passed from B34S(r) system to RATS',
linreg(entries=5+trend,noprint) series startl+1 endl resids
# series{1} constant strend
compute regnobs=%nobs
mcov(damp=1.0,lags=lags) startl+1 endl resids
# constant
* NEW SPOT
compute %seesq=%seesq*%ndf/%nobs
compute su=sqrt(%seesq)
compute st=sqrt(%cmom(1,1)/%nobs)
* MOVE NEXT LINE
compute tstat=(%beta(1)-1)/sqrt(%seesq*%xx(1,1))
if trend
compute dxx=1./%det(%xx)
else {
stats(noprint) series startl endl 1
compute dxx=(%nobs-1)*%variance
}
compute vardiff=(st**2 su**2)
if .not.trend
if .not.ttest
compute teststat=regnobs*(%beta(1)-1) .5*vardiff*regnobs**2/dxx
else
compute teststat=tstat*su/st-.5*vardiff*regnobs/(st*sqrt(dxx))
else
if .not.ttest
compute teststat=regnobs*(%beta(1) 1) vardiff*float(regnobs)**6/(24*dxx)
else
compute teststat=tstat*su/st vardiff*float(regnobs)**3/(4*st*sqrt(3*dxx))
display 'Phillips Perron Test with ' lags 'Lags = ' ###.##### teststat
12-54
Chapter 12
'* ') $
PGMCARDS$
*
SOURCE(NOECHO) c:\R\DFUNIT.SRC
SOURCE(NOECHO) c:\R\PPUNIT.SRC
SET SERIES = GASOUT
@DFUNIT(TTEST,LAG=0) series
@DFUNIT(TTEST,LAG=1) series
@DFUNIT(TTEST,LAG=2) series
@PPUNIT(TTEST,LAG=0) series
@PPUNIT(TTEST,LAG=1) series
@PPUNIT(TTEST,LAG=2) series
* tests with trend
@DFUNIT(TTEST,LAG=0,TREND) series
@DFUNIT(TTEST,LAG=1,TREND) series
@DFUNIT(TTEST,LAG=2,TREND) series
@PPUNIT(TTEST,LAG=0,TREND) series
@PPUNIT(TTEST,LAG=1,TREND) series
@PPUNIT(TTEST,LAG=2,TREND) series
* validate test using LINREG
* Test Case 2
LINREG(VCV) GASOUT
# constant gasout{1}
DISPLAY %SEESQ
COMPUTE NOTTEST=(%BETA(2)-1)*%NOBS
COMPUTE TTEST=(%BETA(2)-1)/SQRT(%SEESQ*%XX(2,2))
DISPLAY 'NOTTEST' NOTTEST
DISPLAY 'TTEST' TTEST
* Test Case 2 Augmented Dickey Fuller Test with lag 1
set difgas = gasout - gasout{1}
LINREG(VCV) GASOUT
# constant gasout{1} difgas{1}
summarize
# difgas{1}
DISPLAY %SEESQ
DISPLAY %SUMLC
COMPUTE NOTTEST=(%BETA(2)-1)*%NOBS*(1/(1-%SUMLC))
COMPUTE TTEST=(%BETA(2)-1)/SQRT(%SEESQ*%XX(2,2))
DISPLAY 'NOTTEST' NOTTEST
DISPLAY 'TTEST' TTEST
@DFUNIT(NOTTEST,LAG=0) series
@DFUNIT(NOTTEST,LAG=1) series
@DFUNIT(NOTTEST,LAG=2) series
@PPUNIT(NOTTEST,LAG=0) series
@PPUNIT(NOTTEST,LAG=1) series
@PPUNIT(NOTTEST,LAG=2) series
* tests with trend
@DFUNIT(NOTTEST,LAG=0,TREND) series
@DFUNIT(NOTTEST,LAG=1,TREND) series
@DFUNIT(NOTTEST,LAG=2,TREND) series
@PPUNIT(NOTTEST,LAG=0,TREND) series
Special Topics in Time Series Analysis
@PPUNIT(NOTTEST,LAG=1,TREND) series
@PPUNIT(NOTTEST,LAG=2,TREND) series
B34SRETURN$
B34SRUN $
B34SEXEC OPTIONS CLOSE(28)$ B34SRUN$
B34SEXEC OPTIONS CLOSE(29)$ B34SRUN$
B34SEXEC OPTIONS SYSTEM('RATS386 RATS.IN,RATS.OUT')$ B34SRUN$
B34SEXEC OPTIONS NPAGEOUT
WRITEOUT('Output from RATS',' ',' ')
COPYFOUT('RATS.OUT')
SYSTEM('ERASE RATS.IN','ERASE RATS.OUT','ERASE RATS.DAT') $
B34SRUN$
Edited output from running this program follows.
Output from RATS
RATS386 4.10c. Run on Sep 3 1994
(c) 1992-4 Thomas A. Doan. All rights reserved
*
* Data passed from B34S(r) system to RATS
*
CALENDAR(IRREGULAR)
ALLOCATE
296
OPEN DATA RATS.DAT
DATA(FORMAT=FREE,ORG=OBS,
$
MISSING= -0.2684354560000000E+09
) / $
TIME
$
GASIN
$
GASOUT
$
CONSTANT
SET TREND = T
TABLE
Series
TIME
GASIN
GASOUT
TREND
Obs
296
296
296
296
Mean
148.50000000
-0.05683446
53.50912162
148.50000000
Std Error
85.59205571
1.07276550
3.20212079
85.59205571
*
SOURCE(NOECHO) c:\R\DFUNIT.SRC
SOURCE(NOECHO) c:\R\PPUNIT.SRC
SET SERIES = GASOUT
@DFUNIT(TTEST,LAG=0) series
Dickey-Fuller Test with 0 Lags =
@DFUNIT(TTEST,LAG=1) series
Dickey-Fuller Test with 1 Lags =
@DFUNIT(TTEST,LAG=2) series
Dickey-Fuller Test with 2 Lags =
@PPUNIT(TTEST,LAG=0)
Phillips-Perron Test
@PPUNIT(TTEST,LAG=1)
Phillips-Perron Test
@PPUNIT(TTEST,LAG=2)
Phillips-Perron Test
series
with 0 Lags =
series
with 1 Lags =
series
with 2 Lags =
-1.86396
-7.13472
-3.87194
-1.87031
-2.60816
-3.04878
* tests with trend
@DFUNIT(TTEST,LAG=0,TREND)
Dickey-Fuller Test with 0
@DFUNIT(TTEST,LAG=1,TREND)
Dickey-Fuller Test with 1
@DFUNIT(TTEST,LAG=2,TREND)
Dickey-Fuller Test with 2
series
Lags =
series
Lags =
series
Lags =
@PPUNIT(TTEST,LAG=0,TREND)
Phillips-Perron Test with
@PPUNIT(TTEST,LAG=1,TREND)
Phillips-Perron Test with
@PPUNIT(TTEST,LAG=2,TREND)
Phillips-Perron Test with
series
0 Lags =
series
1 Lags =
series
2 Lags =
* validate test using LINREG
* Test Case 2
LINREG(VCV) GASOUT
# constant gasout{1}
-2.25713
-7.92621
-4.45474
-2.26869
-3.00840
-3.46301
Minimum
1.00000000
-2.71600000
45.60000000
1.00000000
Maximum
296.00000000
2.83400000
60.50000000
296.00000000
12-55
12-56
Chapter 12
Dependent Variable GASOUT - Estimation by Least Squares
Usable Observations
295
Degrees of Freedom
293
Centered R**2
0.946218
R Bar **2
0.946034
Uncentered R**2
0.999808
T x R**2
294.943
Mean of Dependent Variable
53.508135593
Std Error of Dependent Variable 3.207516934
Standard Error of Estimate
0.745123633
Sum of Squared Residuals
162.67630413
Regression F(1,293)
5154.8930
Significance Level of F
0.00000000
Durbin-Watson Statistic
0.336366
Q(36-0)
468.675151
Significance Level of Q
0.00000000
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. Constant
1.3645615288 0.7275526383
1.87555 0.06171136
2. GASOUT{1}
0.9746956506 0.0135756052
71.79758 0.00000000
Covariance\Correlation Matrix of Coefficients
Constant
GASOUT{1}
Constant
0.52933284146 -0.9982206459
GASOUT{1} -0.00985939278 0.00018429706
DISPLAY %SEESQ
0.55521
COMPUTE NOTTEST=(%BETA(2)-1)*%NOBS
COMPUTE TTEST=(%BETA(2)-1)/SQRT(%SEESQ*%XX(2,2))
DISPLAY 'NOTTEST' NOTTEST
NOTTEST
-7.46478
DISPLAY 'TTEST' TTEST
TTEST
-1.86396
* Test Case 4 lag 1
set difgas = gasout - gasout{1}
LINREG(VCV) GASOUT
# constant gasout{1} difgas{1}
Dependent Variable GASOUT - Estimation by Least Squares
Usable Observations
294
Degrees of Freedom
291
Centered R**2
0.985574
R Bar **2
0.985475
Uncentered R**2
0.999948
T x R**2
293.985
Mean of Dependent Variable
53.507823129
Std Error of Dependent Variable 3.212981352
Standard Error of Estimate
0.387231947
Sum of Squared Residuals
43.635036922
Regression F(2,291)
9940.3307
Significance Level of F
0.00000000
Durbin-Watson Statistic
1.207204
Q(36-0)
156.196740
Significance Level of Q
0.00000000
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. Constant
2.7161997453 0.3811351836
7.12660 0.00000000
2. GASOUT{1}
0.9492517220 0.0071128597
133.45571 0.00000000
3. DIFGAS{1}
0.8574618621 0.0304377680
28.17098 0.00000000
Covariance\Correlation Matrix of Coefficients
Constant
GASOUT{1}
DIFGAS{1}
Constant
0.14526402821 -0.9982424862
0.1259242800
GASOUT{1} -0.00270619654 0.00005059277 -0.1270829999
DIFGAS{1} 0.00146083552 -0.00002751342 0.00092645772
summarize
# difgas{1}
Summary of Linear Combination of Coefficients
DIFGAS
Lag(s) 1
Value
0.857461862142
t-Statistic
Standard Error 0.030437768023
Signif Level
DISPLAY %SEESQ
0.14995
DISPLAY %SUMLC
0.85746
COMPUTE NOTTEST=(%BETA(2)-1)*%NOBS*(1/(1-%SUMLC))
COMPUTE TTEST=(%BETA(2)-1)/SQRT(%SEESQ*%XX(2,2))
DISPLAY 'NOTTEST' NOTTEST
NOTTEST
-104.67370
DISPLAY 'TTEST' TTEST
TTEST
-7.13472
@DFUNIT(NOTTEST,LAG=0) series
Dickey-Fuller Test with 0 Lags =
@DFUNIT(NOTTEST,LAG=1) series
Dickey-Fuller Test with 1 Lags =
@DFUNIT(NOTTEST,LAG=2) series
Dickey-Fuller Test with 2 Lags =
@PPUNIT(NOTTEST,LAG=0) series
Phillips-Perron Test with 0 Lags =
@PPUNIT(NOTTEST,LAG=1) series
-7.46478
-104.67370
-33.23005
-7.46478
28.17098
0.00000000
Special Topics in Time Series Analysis
Phillips-Perron Test with 1 Lags =
@PPUNIT(NOTTEST,LAG=2) series
Phillips-Perron Test with 2 Lags =
12-57
-14.08795
-19.07745
* tests with trend
@DFUNIT(NOTTEST,LAG=0,TREND) series
Dickey-Fuller Test with 0 Lags =
-9.83629
@DFUNIT(NOTTEST,LAG=1,TREND) series
Dickey-Fuller Test with 1 Lags =
-126.59131
@DFUNIT(NOTTEST,LAG=2,TREND) series
Dickey-Fuller Test with 2 Lags =
-42.98146
@PPUNIT(NOTTEST,LAG=0,TREND)
Phillips-Perron Test with 0
@PPUNIT(NOTTEST,LAG=1,TREND)
Phillips-Perron Test with 1
@PPUNIT(NOTTEST,LAG=2,TREND)
Phillips-Perron Test with 2
series
Lags =
series
Lags =
series
Lags =
-9.83629
-17.65251
-23.53928
The 1% (5%) critical value from Table B.6 for case 2 is -3.46 (-2.88). The Dickey-Fuller value of
-1.86396 is greater than -3.46 indicating that we cannot reject non-stationarity. Since the GASOUT
series contains autocorrelation, a more appropriate test would be the augmented Dickey-Fuller test.
For lags of 1 and 2 the values found were -7.1347 and -3.8719, respectively, which are below the
critical values at the 1% and 5% levels. Corresponding values for the Phillips-Perron Z t test for lags
0, 1 and 2 are -1.860, -2.6034 and -3.0447, respectively, indicating we cannot reject non-stationarity
in the series at lags 0 and 1 at the 1%. For tests containing the trend, the critical values are -3.99 and
-3.43 for 1% and 5%, respectively. The Dickey-Fuller values for lags 0, 1 and 2 were -2.257, -7.926
and -4.455, respectively, indicating we could not reject non-stationarity for lag 0, which was found
before. For the Phillips-Perron test with a trend, the appropriate values of -2.2687, -3.008 and -3.463
indicate we cannot reject non-stationarity for lags 0 and 1. Dickey-Fuller and Phillips-Perron tests for
ρ are also given and are reported. These follow the same pattern that was found for the t tests. The
reader is invited to verify the calculations. The B43S code listed below will perform the same
calculations.
b34sexec options ginclude('gas.b34')$ b34seend$
/$
/$ needs only to input series name
%b34slet series = gasout
$
B34sexec bjiden type = arimai nac=12$
Var=%b34seval(&series)$
Seriesn var=%b34seval(&series) name='user series'$
Rauto %b34seval(&series)$
Bispec df adf(1,2,3,4) adft(1,2,3,4) pp app(1,2,3,4) appt(1,2,3,4)
lm(1,2,3,4)$
B34srun$
B34sexec bjiden type = arimai nac=12$
Var=%b34seval(&series)$
Seriesn var=%b34seval(&series) name='user series'$
Rauto %b34seval(&series)$
Bispec df adf(1,2,3,4) adft(1,2,3,4) pp app(1,2,3,4) appt(1,2,3,4)
Zunitroot$
B34srun$
Edited output from running this job follows.
VAR=GASOUT
user series
12-58
Engle
Engle
Engle
Engle
(1982)
(1982)
(1982)
(1982)
Chapter 12
LM
LM
LM
LM
test.
test.
test.
test.
Dickey-Fuller Unit
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Lag
Lag
Lag
Lag
Root
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Phillips-Perron Unit
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
1
2
3
4
Test
(II)
(II)
(II)
(II)
(II)
with
with
with
with
with
Root
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Lamda
Lamda
Lamda
Lamda
(I)
278.95026
289.76009
289.66761
288.82767
Sig.
Sig.
Sig.
Sig.
1.00000000
1.00000000
1.00000000
1.00000000
(IV)
(IV)
(IV)
(IV)
(IV)
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
0
0
1
2
3
4
0
1
2
3
4
t
t
t
t
t
t
t
t
t
t
t
test
test
test
test
test
test
test
test
test
test
test
0.13786198
-1.8639574
-7.1347222
-3.8719395
-2.9470565
-3.1824965
-2.2571278
-7.9262064
-4.4547371
-3.5040425
-3.7459442
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
of
of
of
of
of
of
of
of
of
of
of
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
0.1000
0.1000
0.1000
0.1000
0.0250
0.0100
0.1000
0.1000
0.1000
0.0250
0.0100
Test (I)
(II)
(II)
(II)
(II)
(II)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
0
0
1
2
3
4
0
1
2
3
4
t
t
t
t
t
t
t
t
t
t
t
test
test
test
test
test
test
test
test
test
test
test
0.13786198
-1.8639574
-2.6034684
-3.0447292
-3.2935330
-3.4057413
-2.2571278
-3.0021243
-3.4590678
-3.7190414
-3.8364477
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
of
of
of
of
of
of
of
of
of
of
of
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
0.1000
0.1000
0.0500
0.0250
0.0100
0.0100
0.1000
0.1000
0.0250
0.0100
0.0100
Trend
Trend
Trend
Trend
Trend
Note that the t test results for the Dickey-Fuller t test are exactly the same as those found by RATS.
For the Phillips-Perron t test there are slight differences due to the formulas used and the RATS
subroutine problem that shows up in small samples. Z test results are given next.
Dickey-Fuller Unit
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Aug. Dickey-Fuller
Root
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
Phillips-Perron Unit
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Aug. Phillips-Perron
Test
(II)
(II)
(II)
(II)
(II)
with
with
with
with
with
Root
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test
(I)
(IV)
(IV)
(IV)
(IV)
(IV)
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
0
0
1
2
3
4
0
1
2
3
4
z
z
z
z
z
z
z
z
z
z
z
test
test
test
test
test
test
test
test
test
test
test
0.33062087E-01
-7.4647831
-104.67370
-33.230054
-20.053517
-24.691128
-9.8362868
-126.59131
-42.981459
-27.081511
-33.616447
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
of
of
of
of
of
of
of
of
of
of
of
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
0.1000
0.1000
0.1000
0.1000
0.0100
0.0100
0.1000
0.1000
0.1000
0.0100
0.0100
Test (I)
(II)
(II)
(II)
(II)
(II)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
w. Trend (IV)
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
0
0
1
2
3
4
0
1
2
3
4
z
z
z
z
z
z
z
z
z
z
z
test
test
test
test
test
test
test
test
test
test
test
0.33062087E-01
-7.4647831
-14.087941
-19.077421
-22.233346
-23.737527
-9.8362868
-17.679187
-23.586025
-27.319089
-29.093531
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
Prob
of
of
of
of
of
of
of
of
of
of
of
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
I(1)
0.1000
0.0250
0.0100
0.0100
0.0100
0.1000
0.1000
0.0250
0.0100
0.0100
Trend
Trend
Trend
Trend
Trend
Again, the Dickey Fuller Z test numbers agree exactly with those found by RATS while there are
small differences for the Phillips-Perron results. To test for n roots, pass (1  B )( n 1) xt to the DickeyFuller test. In regression models, if the left-hand-side and one or more of the right-hand-side
variables have unit roots, it is important to routinely test the residuals for unit roots. For more detail
on unit root testing, see Hamilton (1994).
There are a number of other unit root tests that might be considered. For a good reference
see and Stock (1994). Stock-Watson (2003,2007) are a good references for both the DF_GLS
test, which was developed by Elliott, Rothenberg and Stock (1996) and a number of other issues
regarding unit root tests. Stokes (200x) chapter 6 contains more detail. Here the test will be
sketched. The DF_GLS test first involves "detrending" the series to be tested yt . There are two
Special Topics in Time Series Analysis
12-59
variants, one assumes a trend, while the other does not. Consider the trend test first. Define
 *  1  13.5 / T where T = the number of data points. Define
V1  y1 ,
Vt  yt   * yt 1 ,
X 11  1, X 1t  1   * ,
t  2,..., T ,
t  2,..., T ,
(12.5-10)
X 21  1, X 2 t  t   * (t  1), t  2,..., T
and estimate Vt   0 X 1t  1 X 2t to form the detrended series ytd  yt  (ˆ0  ˆ1t ) which is tested
using a model estimated without a constant. If the no trend version of the test is desired, define
 *  1  7 / T and estimate Vt   0 X 1t which forms ytd  yt  ˆ0 . Elliott, Rothenberg-Stock
provide critical values.
Intercept Only
Intercept and Time
10%
-1.62
-2.57
5%
-1.95
-2.89
1%
-2.58
-3.48
The below listed program implements this test:
subroutine DF_GLS(x,lag1,notrend,trend,notrendx,trendx,iprint);
/$
/$ Implements Elliott-Rothenberg-Stock (1996) Unit root test
/$ documented in "Efficient Tests for an Autoregressive Root"
/$ Econometrica 64(4): 813-836. See also "Introduction to
/$ Econometrics," By James Stock and Mark Watson, Addison
/$ Wesley New York 2003 page 549-550
/$
/$ **********************************************************
/$
/$ x
= series to test
/$ lag1
= Lag for DF part of test. Must be GE 1
/$ notrend = > no trend test statistic
/$ trend
= > trend test statistic
/$ notrendx = x smoothed without a trend
/$ trendx
= x smoothed with a trend
/$ iprint
= 2 to print steps and test, = 1 print test only
/$
a1=1.0-(13.5/dfloat(norows(x)));
a2=1.0-( 7.0/dfloat(norows(x)));
v1=x;
i=integers(2,norows(x));
v1(i) =afam(x(i))- a1*x(i-1);
v2(i) =afam(x(i)) -a2*x(i-1);
x11=array(norows(x):)+1.;
x12=x11;
x11(i)=x11(i)-a1;
x12(i)=x12(i)-a2;
i=integers(1,norows(x));
x21=dfloat(i)-(a1*dfloat(i-1));
if(iprint.ne.2)call olsq(v1 x11 x21 :noint);
if(iprint.eq.2)call olsq(v1 x11 x21 :noint :print);
trendx= x- (%coef(1)+%coef(2)*dfloat(i));
if(iprint.ne.2)call olsq(v2 x12 :noint);
if(iprint.eq.2)call olsq(v2 x12 :noint :print);
12-60
Chapter 12
notrendx= x-%coef(1);
/$
dx1=dif(trendx)
;
dx2=dif(notrendx) ;
lx1=goodrow(lag( trendx,1));
lx2=goodrow(lag(notrendx,1));
if(iprint.ne.2)call olsq(dx1 lx1 dx1{1 to lag1} :noint);
if(iprint.eq.2)call olsq(dx1 lx1 dx1{1 to lag1} :noint :print);
trend=%t(1);
if(iprint.ne.2)call olsq(dx2 lx2 dx2{1 to lag1} :noint);
if(iprint.eq.2)call olsq(dx2 lx2 dx2{1 to lag1} :noint :print);
notrend=%t(1);
if(iprint.ne.0)then;
call print('ADF_GLS test: Assumes notrend',notrend:);
call print('ADF_GLS test: Assumes trend ',trend:);
endif;
return;
end;
and can be tested with:
b34sexec options ginclude('gas.b34'); b34srun;
b34sexec matrix;
call load(df_gls);
call loaddata;
call echooff;
nlags=8;
lags=integers(nlags);
trendt =array(nlags:);
notrendt=array(nlags:);
iprint=0;
do i=1,nlags;
call DF_GLS(gasout,i,notrend,trend,notrendx,trendx,iprint);
trendt(i) =trend;
notrendt(i)=notrend;
enddo;
call tabulate(lags,trendt,notrendt);
b34srun;
to produce
Obs
1
2
3
4
5
6
7
8
LAGS
1
2
3
4
5
6
7
8
TRENDT
-1.814
-2.277
-2.670
-2.445
-2.295
-2.275
-2.520
-2.424
NOTRENDT
-0.3869
-0.8573E-01
0.2860E-01
0.3620E-01
0.6432E-01
0.8637E-01
0.1225
0.1294
All TRENDT values are less than the 5% critical value of -2.89 indicating rejection of the hypothesis
of a unit root at the 5% level. Since the NOTREND values are all above the 5% and 1% critical
Special Topics in Time Series Analysis
12-61
values of -1.95 and -2.58 respectively, then is not possible to reject the assumption of a unit root at
either the 5% or 1% level.
In contrast to the above tests, the KPSS test developed by Kwiatkowski-Phillips-SchmidtShin (1992) has as its null stationarity. It will be discussed briefly here and an example from Greene
t
(2008, 755) will be shown. Assume Z t   zi where zi is a stationary series with mean zero and
i 1
unit variance. By construction Z t has a unit root (I(1)). The KPSS test involves testing
yt     t   Z t   t
(12.5-11)
If ˆ  0 and ˆ  1 against the null ˆ  1 , yt is a stationary series. The test proceeds by defining the
tth residual as
et  yt  a  bt
(12.5-12)
and the sequence of partial sums as
t
Et   ei , t  1,
,T
(12.5-13)
i 1
and forming the KPSS statistic as
T
E
KPSS 
t 1
2
t
T 2ˆ 2
(12.5-14)
where
T
ˆ 2 
e
2
t
t 1
T
L
j 

 2  1 
 rj
L 1
j 1 
(12.5-15)
T
rj 
ee
s  j 1
s s j
T
The below listed program implements the test:
subroutine kpss(series,test1,test2,lagg,iprint);
(12.5-16)
12-62
Chapter 12
/;
/; Kwitkowski D, P. Phillips, P. Schmidt and Y. Shin
/; "Testing the Null Hypothesis of Stationarity Against the Alternative
/; of a Unit Root." Journal of Econometrics 54, 1992. pp. 159-178
/;
/; Series - Series to test
/; test1
- Test without trend
/; test2
- Test with trend
/; lagg
- Lag. if lagg = 0 no adjustment to sigma squared is made
/; iprint - 1 => print
/;
2 => print stat and give OLS equations also
/;
/; For added detail see Greene (2008) page 755 for logic of calculation
/;
/; Routine built 24 November 2008 -Tested against Rats Version 7 and
/; results in Greene (2008) page 755
/; -------------------------------------------------------------------/;
n=norows(series);
t=dfloat(integers(n));
%res
= series - mean(series);
psum=cusum(%res);
%rss
= sumsq(%res);
resvar = %rss/dfloat(n);
if(lagg.eq.0)test1=divide(sumsq(psum),(dfloat(n)*dfloat(n)*resvar));
if(lagg.gt.0)then;
tt=matrix(n,1:vfam(%res));
part2=afam(mcov(tt,0.0,0,0.0,0));
do i=1,lagg;
t1= afam(mcov(tt,0.0,i,0.0,0)) - afam(mcov(tt,0.0,i-1,0.0,0));
t2=(1.0 - (dfloat(i)/dfloat(lagg+1)));
part2=part2+ (t1*t2);
enddo;
test1=divide(sumsq(psum),(dfloat(n)*part2));
endif;
if(iprint.ne.2)call olsq(series t
if(iprint.eq.2)call olsq(series t
psum=cusum(%res);
%rss
=sumsq(%res);
resvar = %rss/dfloat(n);
:qr);
:qr :print);
if(lagg.eq.0)test2=divide(sumsq(psum),(dfloat(n)*dfloat(n)*resvar));
if(lagg.gt.0)then;
tt=matrix(n,1:vfam(%res));
part2=afam(mcov(tt,0.0,0,0.0,0));
do i=1,lagg;
t1= afam(mcov(tt,0.0,i,0.0,0))-afam(mcov(tt,0.0,i-1,0.0,0));
t2=(1.0 - (dfloat(i)/dfloat(lagg+1)));
part2=part2+ (t1*t2);
enddo;
test2=divide(sumsq(psum),(dfloat(n)*part2));
endif;
if(iprint.ne.0)then;
Special Topics in Time Series Analysis
call print(' ':);
call print('KPSS Stationarity Test
call print('Test Statistic
call print('Critical Values .10
call print('
.347
call print(' ':);
call print('KPSS Stationarity Test
call print('Test Statistic
call print('Critical Values .10
call print('
.119
endif;
without trend for lag
.050
.463
with
.050
.146
.025
.573
.010
.739
trend for lag
.025
.176
.010
.216
12-63
',lagg:);
',test1:);
':);
':);
',lagg:);
',test2:);
':);
':);
return;
end;
and can be tested with
/; setup. to look at Hamilton data;
b34sexec options ginclude('greene.mac') member(nf5_1);
b34srun;
b34sexec matrix;
call loaddata;
call echooff;
call load(cov :staging);
y=dlog(realgdp);
infl=goodrow(infl);
call print('Elliot-Rotherberg-Stock Tests on log(realgdp)':);
call load(df_gls);
call load(kpss);
dosim=1;
iprint=1;
do i=1,4;
call print('Elliot-Rothenberg-Stock test Lag ',i:);
call DF_GLS(y,i,notrend,trend,notrendx,trendx,iprint);
call print(' ':);
enddo;
lagg=integers(0,10);
notrendt=array(11:);
trendt =array(11:);
do i=0,10;
j=i+1;
call kpss(y,test1,test2,i,1);
notrendt(j)=test1;
trendt(j) =test2;
enddo;
call tabulate(lagg,notrendt,trendt);
/; Simulation Study
if(dosim.ne.0)then;
n=1000;
lagg1=20;
call print(' ':);
call print('--------------------------------------------------------':);
call print('Tests with stationary (sseries) & unit root data (uroot)':);
call print('# of observations in series was ',n:);
call print('# of lags used was 1 to
',lagg:);
call print(' ':);
sseries=rn(array(n:));
uroot=cusum(sseries);
12-64
Chapter 12
call print('--------------------------------------------------------':);
call print('Stationary Series Being Tested':);
call print(' ':);
call print('--------------------------------------------------------':);
lagg=integers(0,lagg1);
notrendt=array(lagg1+1:);
trendt =array(lagg1+1:);
do i=0,lagg1;
j=i+1;
call kpss(sseries,test1,test2,i,0);
notrendt(j)=test1;
trendt(j) =test2;
enddo;
call tabulate(lagg,notrendt,trendt);
call
call
call
call
print('--------------------------------------------------------':);
print('Unit Root Series Being Tested',:);
print(' ':);
print('--------------------------------------------------------':);
lagg=integers(0,lagg1);
notrendt=array(lagg1+1:);
trendt =array(lagg1+1:);
do i=0,lagg1;
j=i+1;
call kpss(uroot,test1,test2,i,0);
notrendt(j)=test1;
trendt(j) =test2;
enddo;
call tabulate(lagg,notrendt,trendt);
b34srun;
Both the Elliot-Rotherberg-Stock test and the KPSS test are shown for the dataset studied by Greene.
While Green reported only lag = 10, here all lags are shown. The results indicate that log(realgdp)
has a unit root. Two added datasets of 1000 observations are generated and tested. The series
sseries is stationary while the series uroot is non-stationary. The KPSS clearly detects these
differences as is shows in the edited output listed below:
Elliot-Rotherberg-Stock Tests on log(realgdp)
Elliot-Rothenberg-Stock test Lag
1
Lag for Dickey-Fuller Second Stage
1
ADF_GLS test: Assuming notrend
6.242166253962512
Critical values are 10% -1.62, 5% -1.95, 1% -2.58
ADF_GLS test: Assuming trend
-1.532475086550608
Critical values are 10% -2.57, 5% -2.89, 1% -3.48
Test value < critical value => reject unit root
Elliot-Rothenberg-Stock test Lag
2
Lag for Dickey-Fuller Second Stage
2
ADF_GLS test: Assuming notrend
5.556060908565906
Critical values are 10% -1.62, 5% -1.95, 1% -2.58
ADF_GLS test: Assuming trend
-1.352199257705574
Critical values are 10% -2.57, 5% -2.89, 1% -3.48
Test value < critical value => reject unit root
Elliot-Rothenberg-Stock test Lag
3
Special Topics in Time Series Analysis
Lag for Dickey-Fuller Second Stage
3
ADF_GLS test: Assuming notrend
5.450758425754588
Critical values are 10% -1.62, 5% -1.95, 1% -2.58
ADF_GLS test: Assuming trend
-1.060650818944474
Critical values are 10% -2.57, 5% -2.89, 1% -3.48
Test value < critical value => reject unit root
Elliot-Rothenberg-Stock test Lag
4
Lag for Dickey-Fuller Second Stage
4
ADF_GLS test: Assuming notrend
5.416394572496471
Critical values are 10% -1.62, 5% -1.95, 1% -2.58
ADF_GLS test: Assuming trend
-0.8423854004117033
Critical values are 10% -2.57, 5% -2.89, 1% -3.48
Test value < critical value => reject unit root
KPSS Stationarity Test without trend for lag
Test Statistic
Critical Values .10
.050 .025 .010
.347 .463 .573 .739
0
20.25249269778769
KPSS Stationarity Test with
Test Statistic
Critical Values .10
.050
.119 .146
0
2.747630769140867
trend for lag
.025
.176
.010
.216
KPSS Stationarity Test without trend for lag
Test Statistic
Critical Values .10
.050 .025 .010
.347 .463 .573 .739
1
10.20966904243808
KPSS Stationarity Test with
Test Statistic
Critical Values .10
.050
.119 .146
1
1.406594332307177
trend for lag
.025
.176
.010
.216
KPSS Stationarity Test without trend for lag
Test Statistic
Critical Values .10
.050 .025 .010
.347 .463 .573 .739
9
2.136775519413702
KPSS Stationarity Test with
Test Statistic
Critical Values .10
.050
.119 .146
9
0.3359947343742196
trend for lag
.025
.176
.010
.216
**************************************************************************
KPSS Stationarity Test without trend for lag
Test Statistic
Critical Values .10
.050 .025 .010
.347 .463 .573 .739
10
1.953058718755067
KPSS Stationarity Test with
Test Statistic
Critical Values .10
.050
.119 .146
10
0.3115785750491043
Obs
LAGG
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
NOTRENDT
20.25
10.21
6.850
5.168
4.158
3.484
3.003
2.642
2.361
trend for lag
.025
.176
.010
.216
TRENDT
2.748
1.407
0.9591
0.7359
0.6025
0.5138
0.4505
0.4029
0.3658
12-65
12-66
Chapter 12
10
11
9
10
2.137
1.953
0.3360
0.3116
-------------------------------------------------------Tests with stationary (sseries) & unit root data (uroot)
# of observations in series was
1000
# of lags used was 1 to
0
-------------------------------------------------------Stationary Series Being Tested
-------------------------------------------------------Obs
LAGG
NOTRENDT
TRENDT
1
0
0.7673
0.1224
2
1
0.7444
0.1195
3
2
0.7298
0.1178
4
3
0.7129
0.1157
5
4
0.6986
0.1140
6
5
0.6884
0.1129
7
6
0.6830
0.1127
8
7
0.6764
0.1122
9
8
0.6713
0.1119
10
9
0.6623
0.1110
11
10
0.6524
0.1099
12
11
0.6434
0.1089
13
12
0.6340
0.1078
14
13
0.6252
0.1068
15
14
0.6161
0.1058
16
15
0.6063
0.1045
17
16
0.5969
0.1033
18
17
0.5878
0.1022
19
18
0.5807
0.1014
20
19
0.5750
0.1008
21
20
0.5694
0.1003
--------------------------------------------------------------------------------------------------------------Obs
LAGG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
NOTRENDT
14.49
7.266
4.855
3.649
2.925
2.443
2.098
1.839
1.638
1.478
1.346
1.237
1.144
1.065
0.9958
0.9357
0.8827
0.8356
0.7934
0.7556
0.7213
TRENDT
14.39
7.213
4.819
3.622
2.903
2.424
2.082
1.825
1.626
1.466
1.336
1.227
1.135
1.056
0.9878
0.9281
0.8754
0.8286
0.7868
0.7492
0.7152
Enders (1995, Chap. 6) provides further information on unit root testing in the context of
cointegration and error-correction models. A brief introduction to the Engle (1982) ARCH test and
estimation of an ARCH/GARCH Model will be discussed in the next section. While section 11.6
provides substantially more detail, the goal here is to show how such models relate to OLS, ARIMA
and transfer function models that focus on only the first moment.
Special Topics in Time Series Analysis
12-67
12.6 Modeling Conditional Heteroskedasticity
A transfer function model of yt  f ( xt ) with ARCH(1) and MA(1) maximizes
.5(log(vt )  ( et ) 2 / vt )
(12.6-1)
where
k
m
i 0
j 1
et  yt     i Bi xt   j B j yt  et 1
(12.6-2)
vt  a0  a1 (et 1 ) 2 ,
(12.6-3)
while the ARCH-M(1) and MA(1) model maximizes (12.6-1), given
k
m
i 0
j 1
et  yt     i Bi xt   j B j yt   (vt ).5  et 1
(12.6-4)
vt  a0  a1 (et 1 ) 2 .
(12.6-5)
Note the additional term  ( vt ).5 in (12.6-4).
The GARCH(p,q) MA(1) maximizes (12.6-1) where
k
m
i 0
j 1
et  yt     i Bi xt   j B j yt  et 1
q
p
j 1
i 1
vt  a0   d j (et  j )2   gi vt i .
(12.6-6)
(12.6-7)
The residual sum of squares of ARCH and the GARCH class models will be greater than or equal to
what would be obtained from estimating (12.6-4) directly because of the cost implied by the ARCH
or GARCH constraint.16 The advantage of these specifications is that they permit explicit modeling
of persistence in the error variance process. Such persistence would be observed by significance on
a1 in (12.6-5) or d j and / or gi in the more general formulation (12.6-7). The ARCH-M specification
(12.6-4) does contain the possibility of a lower residual sum of squares due to the term  ( vt ).5 .
16 See section 11.6 for more detail on the technical aspects of estimating GARCH models.
12-68
Chapter 12
Engle (1982) proposed a simple OLS-based Lagrange multiplier test for ARCH effects. His
proposal involved fitting the model
(eˆt )2    1 (eˆt 1 ) 2 
  k (eˆt k ) 2   t
(12.6-8)
on the squared residuals of an equation and testing whether T R 2 , which is distributed as  2 (k ) , is
significant. R2 is calculated by (2.1-15) and T is the number of observations in (12.6-8). The
essential idea is that if there are ARCH effects, the squared residuals will be a function of lags of the
squared residual and the R2 will be large. The command lm(k) implements this test in the bispec
sentence. If the Engle LM test indicates ARCH effects, it is often desirable to calculate the ACF and
PACF of the squared residuals to determine where the ARCH effects are occurring (Enders 1995,
148). The commands acfvarsq(n) and pacfvarsq(m), where n
m, can optionally be added to
the bispec sentence to make these calculations for n and m squared residuals, respectively. The
bispec sentence is callable from the rr, bjiden, bjest, btiden, btest, reg, mars and pispline
commands, making it is possible to test for ARCH effects in a variety of models. In the prior section
the command lm(1,2,3,4) was called from the bjiden sentence and was thus applied to the GASOUT
series where "ARCH" effects were found on the series. This is not the correct way to proceed to test
for ARCH. If ARCH is suspected, a better way to test might be to either directly estimate an ARCH
model, or use the lm command on the bispec sentence to test the residuals of a model involving
GASOUT. Univariate AR(6) models were fit to GASIN and GASOUT and the command LM(1,2,3,4)
was applied to the residuals giving
Engle
Engle
Engle
Engle
(1982)
(1982)
(1982)
(1982)
LM
LM
LM
LM
test.
test.
test.
test.
Lag
Lag
Lag
Lag
1
2
3
4
Lamda
Lamda
Lamda
Lamda
57.857328
70.356855
72.009198
72.723130
Sig.
Sig.
Sig.
Sig.
1.00000000
1.00000000
1.00000000
1.00000000
Lag
Lag
Lag
Lag
1
2
3
4
Lamda
Lamda
Lamda
Lamda
6.7469896
19.949720
22.939252
22.897687
Sig.
Sig.
Sig.
Sig.
0.99060917
0.99995273
0.99995762
0.99986595
for GASIN and
Engle
Engle
Engle
Engle
(1982)
(1982)
(1982)
(1982)
LM
LM
LM
LM
test.
test.
test.
test.
for GASOUT suggesting ARCH effects for both series.17 Further evidence for this finding is obtained
17 The program listed below illustrates a setup to generate a correctly specified model and test for ARCH effects.
Testing is done using the Engle Lagrange Multiplier test and using an ACF of the squared residuals. To save space only
the LM test results are shown.
%b34slet noob=50000$
b34sexec data noob=%b34seval(&NOOB)
build y x noise $
gen noise=rn()$
gen x=rn()$
gen y=10.0 + x + noise$
b34srun$
b34sexec rr$
$
Special Topics in Time Series Analysis
12-69
if we estimate a simple ARCH-M with MA term model on the GASOUT data using the commands:
/$
b34sexec options ginclude('gas.b34')$ b34srun$
/$
b34sexec bjest$
model gasout$
modeln p=(1,2,) $
b34seend$
B34SEXEC
B34SEXEC
B34SEXEC
B34SEXEC
OPTIONS
OPTIONS
OPTIONS
OPTIONS
OPEN('RATS.DAT') UNIT(28) DISP=UNKNOWN$ B34SRUN$
OPEN('RATS.IN') UNIT(29) DISP=UNKNOWN$ B34SRUN$
CLEAN(28)$ B34SRUN$
CLEAN(29)$ B34SRUN$
B34SEXEC PGMCALL$
RATS PASSASTS
PCOMMENTS('* ',
'* Data passed from B34S(r) system to RATS',
'* ') $
PGMCARDS$
model y=x$
bispec lm(1,2,3,4,5,6,7,8,9) acfvarsq(9)$
b34srun$
Edited output shows no effect of ARCH as expected. This test problem will run in about 43.02 seconds on a P5-90
Gateway, using Lahey F77EM32. Using Lahey LF90, which produces optimized code, the time falls to 31.37 seconds.
Variable
Y
X
NOISE
CONSTANT
Mean
1
2
3
4
Standard Deviation
10.007099
0.29176394E-02
0.41815471E-02
1.0000000
Data file contains
Variance
1.4107179
0.99590367
1.0010447
0.00000000
1.9901249
0.99182412
1.0020904
0.00000000
50000. observations on
2000000 double precision slots in space,
402514 are being used.
All tests will be performed using original data order.
OLS results for complete data set (
Dependent variable
Adjusted R**2 =
Standard Error of Estimate
Sum of Squared Residuals
Model Sum of Squares
Total Sum of Squares
F( 1,
49998)
F Significance
1/Condition of XPX
Number of Observations
Variable
X
CONSTANT
Engle
Engle
Engle
Engle
Engle
Engle
Engle
Engle
Engle
X- 2
X- 4
(1982)
(1982)
(1982)
(1982)
(1982)
(1982)
(1982)
(1982)
(1982)
LM
LM
LM
LM
LM
LM
LM
LM
LM
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
Lag
obs )
Y
0.49646033
1.0010529
50103.338
49400.917
99504.255
49297.056
0.99895644
0.99006664
50000
Coefficient
0.99808956
10.004187
test.
test.
test.
test.
test.
test.
test.
test.
test.
50000
1
2
3
4
5
6
7
8
9
Lamda
Lamda
Lamda
Lamda
Lamda
Lamda
Lamda
Lamda
Lamda
16.369161
4.4963150
4.3901954
1.0000000
4 variables. Current missing value code is
Recursive Residual Option. Version 1 July 1994
Of
Maximum
X- 1
Std. Error
0.44953035E-02
0.44768637E-02
0.59337006E-01
3.3440673
3.3449530
3.8485651
4.7117540
5.0102043
5.0828352
7.6713754
7.7221369
Sig.
Sig.
Sig.
Sig.
Sig.
Sig.
Sig.
Sig.
Sig.
t
222.02940
2234.6419
0.19245309
0.81213516
0.65856457
0.57311177
0.54793894
0.45749456
0.35014474
0.53378808
0.43762723
Minimum
4.0809226
-3.9183197
-4.1740627
1.0000000
0.1000000000000000E+32
12-70
Chapter 12
*
SET SERIESN = GASOUT
COMPUTE ITER = 100,ISITER=100
*
* ARCH-M with MU
*
SMPL(SERIES=SERIESN)
SET RAM = 0.0
SET VV = 1.0
NONLIN B0 B1 B2 B8 MU1 A0 A1
FRML ARCHVAR = A0+A1*RAM{1}**2
FRML REGRESID = SERIESN-B0-B1*SERIESN{1}-B2*SERIESN{2} $
-B8*SQRT(ARCHVAR(T))
$
+ MU1 * RAM{1}
FRML ARCHLOGL = (VV(T)=ARCHVAR(T)),(RAM(T)=REGRESID(T)), $
-.5*(LOG(VV)+RAM**2/VV)
LINREG SERIESN
# CONSTANT SERIESN{1} SERIESN{2}
COMPUTE B0=%BETA(1),B1=%BETA(2),B2=%BETA(3),A0=%SEESQ,A1=.05
COMPUTE B8=0,mu1=.01
NLPAR(SUBITERATIONS=ISITER)
MAXIMIZE(METHOD=BHHH,RECURSIVE,ITERATIONS=ITER) ARCHLOGL 3 *
SMPL(SERIES=RAM)
STATISTICS RAM
SET RSSAM = RAM(T)*RAM(T)
STATISTICS RSSAM
SMPL(SERIES=RSSAM)
COMPUTE SUMSQU = %SUM(RSSAM)
DISPLAY 'SUM OF SQUARES OF U (RAM) FOR ARCH-M' SUMSQU
*
B34SRETURN$
B34SRUN$
B34SEXEC OPTIONS CLOSE(28)$ B34SRUN$
B34SEXEC OPTIONS CLOSE(29)$ B34SRUN$
b34sexec options
/$
dodos('start /w /r
rats386 rats.in rats.out ')
dodos('start /w /r
rats32s rats.in /run')
dounix('rats
rats.in rats.out')$ b34srun$
B34SEXEC OPTIONS NPAGEOUT
WRITEOUT('OUTPUT FROM RATS',' ',' ')
COPYFOUT('RATS.OUT')
SYSTEM('ERASE RATS.IN','ERASE RATS.OUT','ERASE RATS.DAT') $
B34SRUN$
Edited output from this job is listed next.
Special Topics in Time Series Analysis
OUTPUT FROM RATS
RATS386 4.21. Run on Jul 20 1996
(c) 1992-5 Thomas A. Doan. All rights reserved
*
* Data passed from B34S(r) system to RATS
*
CALENDAR(IRREGULAR)
ALLOCATE
296
OPEN DATA RATS.DAT
DATA(FORMAT=FREE,ORG=OBS,
$
MISSING=
0.1000000000000000E+32
) / $
TIME
$
GASIN
$
GASOUT
$
CONSTANT
SET TREND = T
TABLE
Series
TIME
GASIN
GASOUT
TREND
Obs
296
296
296
296
Mean
148.50000000
-0.05683446
53.50912162
148.50000000
Std Error
85.59205571
1.07276550
3.20212079
85.59205571
Minimum
1.00000000
-2.71600000
45.60000000
1.00000000
Maximum
296.00000000
2.83400000
60.50000000
296.00000000
*
SET SERIESN = GASOUT
COMPUTE ITER = 100,ISITER=100
*
* ARCH-M WITH MA
*
SMPL(SERIES=SERIESN)
SET RAM = 0.0
SET VV = 1.0
NONLIN B0 B1 B2 B8 MU1 A0 A1
FRML ARCHVAR = A0+A1*RAM{1}**2
FRML REGRESID = SERIESN-B0-B1*SERIESN{1}-B2*SERIESN{2} $
-B8*SQRT(ARCHVAR(T)) $
+ MU1*RAM{1}
* Note: To add more series on the right place added lines before
*
+ MU1 * RAM{1} line
FRML ARCHLOGL = (VV(T)=ARCHVAR(T)),(RAM(T)=REGRESID(T)), $
-.5*(LOG(VV)+RAM**2/VV)
LINREG SERIESN
# CONSTANT SERIESN{1} SERIESN{2}
Dependent Variable SERIESN - Estimation by Least Squares
Usable Observations
294
Degrees of Freedom
291
Total Observations
296
Skipped/Missing
2
Centered R**2
0.985574
R Bar **2
0.985475
Uncentered R**2
0.999948
T x R**2
293.985
Mean of Dependent Variable
53.507823129
Std Error of Dependent Variable 3.212981352
Standard Error of Estimate
0.387231947
Sum of Squared Residuals
Regression F(2,291)
Significance Level of F
Durbin-Watson Statistic
Q(36-0)
Significance Level of Q
43.635036922
9940.3307
0.00000000
1.207204
156.196740
0.00000000
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. Constant
2.716199745 0.381135184
7.12660 0.00000000
2. SERIESN{1}
1.806713584 0.030364843
59.50018 0.00000000
3. SERIESN{2}
-0.857461862 0.030437768
-28.17098 0.00000000
COMPUTE B0=%BETA(1), B1=%BETA(2), B2=%BETA(3), A0=%SEESQ,A1=.05
COMPUTE B8=0.0,MU1=.01
NLPAR(SUBITERATIONS=ISITER)
MAXIMIZE(METHOD=BHHH,RECURSIVE,ITERATIONS=ITER) ARCHLOGL 3 *
Estimation by BHHH
Iterations Taken
44
Usable Observations
294
Function Value
Degrees of Freedom
161.12324703
287
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. B0
2.068235882 0.553867102
3.73417 0.00018833
2. B1
1.768613434 0.037408966
47.27780 0.00000000
3. B2
-0.815045520 0.038209646
-21.33088 0.00000000
4. B8
1.236604223 0.520708969
2.37485 0.01755622
5. MU1
-0.321248854 0.080074571
-4.01187 0.00006024
6. A0
0.095692306 0.006289522
15.21456 0.00000000
7. A1
0.284772316 0.105933349
2.68822 0.00718337
SMPL(SERIES=RAM)
STATISTICS RAM
Statistics on Series RAM
Observations
294
(296 Total - 2 Skipped/Missing)
Sample Mean
-0.0183588458
Variance
0.138734
12-71
72
Chapter 12
Standard Error
t-Statistic
Skewness
Kurtosis
0.3724703160
-0.84514
0.22971
3.54199
SE of Sample
Signif Level
Signif Level
Signif Level
Mean
0.021723
(Mean=0) 0.39872366
(Sk=0)
0.10965209
(Ku=0)
0.00000000
SET RSSAM = RAM(T)*RAM(T)
STATISTICS RSSAM
Statistics on Series RSSAM
Observations
294
(296 Total - 2 Skipped/Missing)
Sample Mean
0.13859929873
Variance
0.104086
Standard Error 0.32262344474
SE of Sample Mean
0.018816
t-Statistic
7.36612
Signif Level (Mean=0) 0.00000000
Skewness
5.61849
Signif Level (Sk=0)
0.00000000
Kurtosis
40.06132
Signif Level (Ku=0)
0.00000000
SMPL(SERIES=RSSAM)
COMPUTE SUMSQU = %SUM(RSSAM)
DISPLAY 'SUM OF SQUARES OF U (RAM) FOR ARCH-M' SUMSQU
SUM OF SQUARES OF U (RAM) FOR ARCH-M
40.74819
*
Note that a0 and a1 from equation (12.6-5) were significant, with t scores of 15.21 and 2.69,
respectively, indicating persistence in the variance of the residual.  in equation (12.6-4) (called B8
in the output) was also significant, t = 2.37, as was  (called MU1), where t = - 4.01.18 These
preliminary results indicate variance persistence or memory helps to model the level.
The above examples illustrate a part of the identification process in modeling GARCH,
ARCH-M and GARCH(p,g) models. Note that the OLS model GASOUT = f(GASOUTt-1, GASOUTt-2)
finds e ' e  43.64 . For the ARCH-M with MA(1) term model, e ' e  40.748 , which suggests a gain.
However, if the command bjest is called to model GASOUT as an ARIMA(2,0,1) where a constant is
estimated, e ' e  37.89 . The likely reason for this is that the ARCH-M model involves constrained
estimation since the likelihood (12.6-1) is maximized.19 The ARIMA model is just minimizing the
sum of squares.
To further test the gain in the sum of squares using ARCH-M, a more complex problem is
estimated where an ARIMA (3,0,0) is compared to an ARIMA (3,0,0) with an ARCH-M
The command file for this job that shows both RATS and B34S estimation is:
18 Note that the older RATS 4.21 output is shown that indicates what appears to be convergence. If this job is run
with the newer RATS it will produce almost the same answer but will give convergence messages. This highlights
the importance of indicating the version of software used.
19 The ARCH-M model is often very hard to estimate. For example, if GASIN is substituted for GASOUT in the
ARCH-M setup, the model will not run at all. If the suggested model for GASIN (7.3-5) is estimated with an ARCHM term, 50% of the points are not usable. The reason for this is that during the estimation process parameters were
such that logs of negative numbers were taken. The solution is to estimate the model using a con strained estimator.
A full discussion of this is covered in Stokes (200x, Chapter 7).
Special Topics in Time Series Analysis
b34sexec options ginclude('gas.b34')$ b34srun$
/$
b34sexec bjest$
model gasout$
modeln p=(1,2,3) AR(.97,-.94,.5) avepa=.5$
b34seend$
/$
/$ Shows how ARIMA(3,0,0) beats ARIMA(3,0,0) with ARCH-M
/$ in sum of squares sense
/$
b34sexec options ginclude('gas.b34')$ b34srun$
/$
b34sexec bjest$
model gasout$
modeln p=(1,2,3) AR(.97,-.94,.5) avepa=.5$
b34seend$
/$
/$ Test to see the difference between AR and ARCH
/$
/$ user places RATS commands between
/$
PGMCARDS$
/$
note: user RATS commands here
/$
B34SRETURN$
/$
B34SEXEC OPTIONS OPEN('RATS.DAT') UNIT(28) DISP=UNKNOWN$ B34SRUN$
B34SEXEC OPTIONS OPEN('RATS.IN') UNIT(29) DISP=UNKNOWN$ B34SRUN$
B34SEXEC OPTIONS CLEAN(28)$ B34SRUN$
B34SEXEC OPTIONS CLEAN(29)$ B34SRUN$
B34SEXEC PGMCALL$
RATS PASSASTS
PCOMMENTS('* ',
'* Data passed from B34S(r) system to RATS',
'* ') $
PGMCARDS$
*
SET SERIESN = GASOUT
COMPUTE ITER = 100,ISITER=100
*
* ARCH
*
SMPL(SERIES=SERIESN)
SET RAM = 0.0
SET VV = 1.0
NONLIN B0 B1 B2 B3 B8 A0 A1
FRML ARCHVAR = A0+A1*RAM{1}**2
FRML REGRESID = SERIESN-B0-B1*SERIESN{1}-B2*SERIESN{2}-B3*SERIESN{3} $
-B8*SQRT(ARCHVAR(T))
* Note: To add more series on the right place added lines before
*
+ MU1 * RAM{1} line
FRML ARCHLOGL = (VV(T)=ARCHVAR(T)),(RAM(T)=REGRESID(T)), $
-.5*(LOG(VV)+RAM**2/VV)
LINREG SERIESN
# CONSTANT SERIESN{1} SERIESN{2} SERIESN{3}
COMPUTE B0=%BETA(1),B1=%BETA(2),B2=%BETA(3),B3=%BETA(4),A0=%SEESQ,A1=.01
COMPUTE B8=0
NLPAR(SUBITERATIONS=ISITER)
MAXIMIZE(METHOD=BHHH,RECURSIVE,ITERATIONS=ITER) ARCHLOGL 4 *
SMPL(SERIES=RAM)
STATISTICS RAM
SET RSSAM = RAM(T)*RAM(T)
STATISTICS RSSAM
73
74
Chapter 12
SMPL(SERIES=RSSAM)
COMPUTE SUMSQU = %SUM(RSSAM)
DISPLAY 'SUM OF SQUARES OF U (RAM) FOR ARCH-M' SUMSQU
*
B34SRETURN$
B34SRUN$
B34SEXEC OPTIONS CLOSE(28)$ B34SRUN$
B34SEXEC OPTIONS CLOSE(29)$ B34SRUN$
b34sexec options
/$
dodos('start /w /r
rats386 rats.in rats.out ')
dodos('start /w /r
rats32s rats.in /run')
dounix('rats
rats.in rats.out')$ b34srun$
B34SEXEC OPTIONS NPAGEOUT
WRITEOUT('OUTPUT FROM RATS',' ',' ')
COPYFOUT('RATS.OUT')
SYSTEM('ERASE RATS.IN','ERASE RATS.OUT','ERASE RATS.DAT') $
B34SRUN$
b34sexec matrix display=col80medium;
call loaddata;
j=norows(gasout);
arch
= array(j:);
res
= array(j:);
call garchest(res,arch, gasout,func,4,n :nar 3
:muorder index(1) :muparms array(:.01)
:ngma 1 :gmaparms array(:1.)
:cparms array(:.5,.4)
:print);
call print('Sum of squares of residual',sumsq(goodrow(res)):);
call print('Variance of residual
',variance(goodrow(res)):);
call print('Variance of Second Moment ',variance(goodrow(arch)):);
/; call tabulate(res,arch);
b34srun;
Edited output for this example, which documents the residual variance gain due to ARCH
constraints, is shown next.
B34S 8.11C
Variable
TIME
GASIN
GASOUT
CONSTANT
(D:M:Y)
11/ 7/07 (H:M:S) 20:16:53
Label
1
2 Input gas rate in cu. ft / min
3 Percent CO2 in outlet gas
4
Number of observations in data file
Current missing variable code
DATA STEP
# Cases
296
148.500
296 -0.568345E-01
296
53.5091
296
1.00000
296
1.000000000000000E+31
Time Series Parameter Estimation for Model
Data Z = VAR=GASOUT
Observations 296
Differencing on
Z - None
Transformations Examined - None.
Univariate Model Parameters.
Parameter
Beginning
# Type
Order
Value
1 Mean
0.5000
2 Autoregressive 1
1
0.9700
3 Autoregressive 1
2
-0.9400
4 Autoregressive 1
3
0.5000
Output at each iteration has been suppressed.
PAGE
Mean
1
Std. Dev.
85.5921
1.07277
3.20212
0.00000
5
Variance
Maximum
Minimum
7326.00
1.15083
10.2536
0.00000
296.000
2.83400
60.5000
1.00000
1.00000
-2.71600
45.6000
1.00000
Special Topics in Time Series Analysis
Residual output has been suppressed.
Initial sum of Squares
182780.2358359999
Iteration stops - Relative parameter change <
4.000000189989805E-03
Correlation Matrix of the Parameters. 1/Cond =
0.2495E-04
1
2
3
4
1 1.0000
2 0.0130
1.0000
3 -0.0164
-0.9614
1.0000
4 0.0231
0.8557
-0.9612
1.0000
End of Estimation for Model
1
Summary of model 1
Data Z = VAR=GASOUT
Observations 296
Differencing on
Z - None
Univariate Model Parameters.
Parameter
# Type
Order
1 Mean
2 Autoregressive 1
1
3 Autoregressive 1
2
4 Autoregressive 1
3
Estimated
Value
Lower Limit
53.60
52.09
2.203
2.099
-1.695
-1.891
0.4651
0.3603
Other Information and results.
Residual Sum of Squares
34.279711
Residual Mean Square
0.1186149155112212
Number of residuals
293
Residual Standard error
0.3444051618533340
Backforecasting not used in Estimation
t
70.93
42.21
-17.27
8.878
95 Per Cent
Upper Limit Std. Error
55.11
0.7556
2.308
0.5220E-01
-1.499
0.9814E-01
0.5698
0.5238E-01
289 D.F.
Autocorrelation Function
Data - THE ESTIMATED RESIDUALS -
MODEL 1
Original Series
Mean of the Series
St. Dev. of Series
Number of observations
S. E. of mean
T value of mean (against zero)
293 Observations
1.648126025586912E-11
0.3420461946265565
293
2.001673950658156E-02
8.233738691783460E-10
1- 12
St.E.
Mod. Q
-0.10
0.06
2.9
0.19
0.06
14.0
-0.06
0.06
15.0
-0.04
0.06
15.5
-0.11
0.06
18.9
0.08
0.06
21.1
-0.02
0.06
21.2
0.04
0.06
21.8
-0.08
0.06
23.6
0.06
0.06
24.7
-0.01
0.06
24.7
0.10
0.06
28.0
13- 24
St.E.
Mod. Q
-0.05
0.06
28.7
0.10
0.06
32.1
-0.08
0.06
33.9
0.07
0.06
35.3
-0.06
0.06
36.6
0.04
0.07
37.0
-0.11
0.07
40.9
0.02
0.07
41.0
-0.01
0.07
41.1
0.07
0.07
42.8
0.01
0.07
42.9
-0.02
0.07
43.1
Mean divided by St. Error (using N in S. D.)
Q Statistic
Modified Q Statistic
41.442
43.055
DF
DF
8.247825509083367E-10
20 Prob.
20 Prob.
0.99673
0.99799
NOTE: In some cases degrees of freedom for Q and Modified Q Statistics may have to be adjusted.
Partial Autocorrelations
Data - THE ESTIMATED RESIDUALS Original Series
Mean of the Series
St. Dev. of Series
Number of observations
S. E. of mean
T value of mean (against zero)
MODEL 1
293 Observations
1.648126025586912E-11
0.3420461946265565
293
2.001673950658156E-02
8.233738691783460E-10
1- 12
-0.10
0.19
-0.02
-0.09
-0.11
0.10
0.03
0.00
-0.09
0.05
0.06
0.09
13- 24
-0.06
0.05
-0.01
0.05
-0.04
-0.01
-0.08
-0.01
0.05
0.05
0.01
-0.09
OUTPUT FROM RATS
*
* Data passed from B34S(r) system to RATS
*
CALENDAR(IRREGULAR)
ALLOCATE
296
OPEN DATA rats.dat
DATA(FORMAT=FREE,ORG=OBS,
$
MISSING=
0.1000000000000000E+32
) / $
TIME
$
GASIN
$
GASOUT
$
CONSTANT
SET TREND = T
TABLE
Series
Obs
Mean
Std Error
TIME
296
148.500000
85.592056
Minimum
1.000000
Maximum
296.000000
75
76
GASIN
GASOUT
TREND
Chapter 12
296
296
296
-0.056834
53.509122
148.500000
1.072766
3.202121
85.592056
-2.716000
45.600000
1.000000
2.834000
60.500000
296.000000
*
SET SERIESN = GASOUT
COMPUTE ITER = 100,ISITER=100
*
* ARCH
*
SMPL(SERIES=SERIESN)
SET RAM = 0.0
SET VV = 1.0
NONLIN B0 B1 B2 B3 B8 A0 A1
FRML ARCHVAR = A0+A1*RAM{1}**2
FRML REGRESID = SERIESN-B0-B1*SERIESN{1}-B2*SERIESN{2}-B3*SERIESN{3} $
-B8*SQRT(ARCHVAR(T))
* Note: To add more series on the right place added lines before
*
+ MU1 * RAM{1} line
FRML ARCHLOGL = (VV(T)=ARCHVAR(T)),(RAM(T)=REGRESID(T)), $
-.5*(LOG(VV)+RAM**2/VV)
LINREG SERIESN
# CONSTANT SERIESN{1} SERIESN{2} SERIESN{3}
Linear Regression - Estimation by Least Squares
Dependent Variable SERIESN
Usable Observations
293
Degrees of Freedom
289
Total Observations
296
Skipped/Missing
3
Centered R**2
0.988667
R Bar **2
0.988549
Uncentered R**2
0.999959
T x R**2
292.988
Mean of Dependent Variable
53.507849829
Std Error of Dependent Variable 3.218478298
Standard Error of Estimate
0.344405162
Sum of Squared Residuals
34.279710583
Regression F(3,289)
8403.7555
Significance Level of F
0.00000000
Log Likelihood
Durbin-Watson Statistic
-101.41581
2.197329
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. Constant
1.428665959 0.368702791
3.87484 0.00013206
2. SERIESN{1}
2.203386923 0.052199815
42.21063 0.00000000
3. SERIESN{2}
-1.695103674 0.098144855
-17.27145 0.00000000
4. SERIESN{3}
0.465062289 0.052382207
8.87825 0.00000000
COMPUTE B0=%BETA(1),B1=%BETA(2),B2=%BETA(3),B3=%BETA(4),A0=%SEESQ,A1=.01
COMPUTE B8=0
NLPAR(SUBITERATIONS=ISITER)
MAXIMIZE(METHOD=BHHH,RECURSIVE,ITERATIONS=ITER) ARCHLOGL 4 *
MAXIMIZE - Estimation by BHHH
Convergence in
45 Iterations. Final criterion was
Usable Observations
293
Function Value
178.42900426
0.0000083 <=
0.0000100
Variable
Coeff
Std Error
T-Stat
Signif
*******************************************************************************
1. B0
0.770870548 0.413629667
1.86367 0.06236760
2. B1
2.273965474 0.058107155
39.13400 0.00000000
3. B2
-1.807858365 0.105405085
-17.15153 0.00000000
4. B3
0.512700989 0.053353578
9.60950 0.00000000
5. B8
1.134464182 0.449944894
2.52134 0.01169087
6. A0
0.089080496 0.004958969
17.96351 0.00000000
7. A1
0.219881803 0.085416966
2.57422 0.01004672
SMPL(SERIES=RAM)
STATISTICS RAM
Statistics on Series RAM
Observations
293
Sample Mean
-0.014006
Standard Error
0.351917
t-Statistic (Mean=0) -0.681261
Skewness
0.232670
Kurtosis (excess)
3.682781
Jarque-Bera
168.223710
Skipped/Missing
Variance
of Sample Mean
Signif Level
Signif Level (Sk=0)
Signif Level (Ku=0)
Signif Level (JB=0)
3
0.123846
0.020559
0.496246
0.105751
0.000000
0.000000
SET RSSAM = RAM(T)*RAM(T)
STATISTICS RSSAM
Statistics on Series RSSAM
Observations
293
Sample Mean
0.123619
Standard Error
0.291768
t-Statistic (Mean=0)
7.252405
Skewness
5.940839
Kurtosis (excess)
45.020318
Jarque-Bera
26467.706911
Skipped/Missing
Variance
of Sample Mean
Signif Level
Signif Level (Sk=0)
Signif Level (Ku=0)
Signif Level (JB=0)
SMPL(SERIES=RSSAM)
COMPUTE SUMSQU = %SUM(RSSAM)
DISPLAY 'SUM OF SQUARES OF U (RAM) FOR ARCH-M' SUMSQU
SUM OF SQUARES OF U (RAM) FOR ARCH-M
36.22041
3
0.085129
0.017045
0.000000
0.000000
0.000000
0.000000
Special Topics in Time Series Analysis
B34S(r) Matrix Command. d/m/y 11/ 7/07. h:m:s 20:57:56.
=>
CALL LOADDATA$
=>
J=NOROWS(GASOUT)$
=>
ARCH
= ARRAY(J:)$
=>
RES
= ARRAY(J:)$
=>
=>
=>
=>
=>
CALL GARCHEST(RES,ARCH, GASOUT,FUNC,4,N :NAR 3
:MUORDER INDEX(0) :MUPARMS ARRAY(:.01)
:NGMA 1 :GMAPARMS ARRAY(:1.)
:CPARMS ARRAY(:.5,.4)
:PRINT)$
GARCH/ARCH Model Estimated using DB2ONF Routine
Constrained Maximum Likelihood Estimation using CMAXF2 Command
Finite-difference Gradiant
ARCH/GARCH-M using sqrt(h(t)) in First Moment Eq
Model Estimated
res1(t)=y(t)-cons(1)-ar(1)*y(t-1)
-...
-ma(1)*res1(t-1)
-...
-mu*dsqrt(res2(t)|(t-muorder))
res2(t)=
cons(2)+gar(1)* res2(t-1)
+...+
gma(1)*(res1(t-1)**2) + ..
LF
=-.5*sum((ln(res2(t))+res1(t)**2/res2(t)))
Final Functional Value
# of parameters
# of good digits in function
# of iterations
# of function evaluations
# of gradiant evaluations
Scaled Gradient Tolerance
Scaled Step Tolerance
Relative Function Tolerance
False Convergence Tolerance
Maximum allowable step size
Size of Initial Trust region
# of terms dropped in ML
1/ Condition of Hessian Matrix
#
1
2
3
4
5
6
7
Name
AR
AR
AR
GMA
MU
CONS_1
CONS_2
177.2570585166265
7
15
63
92
65
6.055454452393343E-06
3.666852862501036E-11
3.666852862501036E-11
2.220446049250313E-14
2645.751311064591
-1.000000000000000
4
8.082581791995909E-07
order Parm. Est.
1
2.2665196
2
-1.7903764
3
0.50251139
1
0.22197323
0
1.1361060
0
0.77729865
0
0.89263707E-01
SE
0.15122308E-02
0.15106239E-02
0.15015982E-02
0.65249790E-01
0.19939269
0.78315557E-01
0.87229125E-02
t-stat
1498.7921
-1185.1900
334.65104
3.4018996
5.6978318
9.9252138
10.233246
SE calculated as sqrt |diagonal(inv(%hessian))|
Order of Parms: AR, MA, GAR, GMA, MU, vd, Const 1&2
Hessian Matrix
1
6
0.888413E+07
156754.
0.889752E+07
156988.
0.889741E+07
157003.
17969.1
320.385
53135.2
936.291
164883.
3070.89
294245.
5467.44
1
2
3
4
5
6
7
2
7
0.846004E+07
289944.
0.891255E+07
290064.
0.891390E+07
289794.
18129.5
1243.92
53222.9
1739.77
165156.
5389.06
294453.
24317.5
3
4
5
0.845843E+07
16641.0
50228.6
0.847286E+07
16795.6
50304.3
0.891702E+07
16977.2
50315.4
18315.1
320.499
123.157
53241.7
131.923
327.476
165200.
345.196
990.616
294281.
1260.57
1782.57
Gradiant Vector
0.304744E-03
0.539264E-05
0.304464E-03
0.103359E-04
0.297943E-03
0.719019E-05
-0.100000E+33
0.100000E-16
-0.100000E+33
0.100000E-16
0.00000
Lower vector
-0.100000E+33
-0.100000E+33
Upper vector
-0.100000E+33
77
78
Chapter 12
0.100000E+33
0.100000E+33
=>
0.100000E+33
0.100000E+33
0.100000E+33
36.22696282402386
CALL PRINT('Variance of residual
Variance of residual
=>
0.100000E+33
CALL PRINT('Sum of squares of residual',SUMSQ(GOODROW(RES)):)$
Sum of squares of residual
=>
0.100000E+33
',VARIANCE(GOODROW(RES)):)$
0.1243030093282264
CALL PRINT('Variance of Second Moment ',VARIANCE(GOODROW(ARCH)):)$
Variance of Second Moment
4.219559299236956E-03
B34S Matrix Command Ending. Last Command reached.
Space available in allocator
Number variables used
Number temp variables used
11869853, peak space used
57, peak number used
31, # user temp clean
5989
59
0
For this example the same residual sum of squares gain is again observed. When an
ARIMA(3,0,0) model for GASOUT is estimated using B34S, it was found that e ' e  34.2797 . The
same model estimated with RATS version 6.35 with the addition of an ARCH-M term finds
e ' e  36.22041 where the  term (1.134464182)is significant with t = 2.52134. Using the
garchest command e ' e  36.22696 ,  was 1.1361060 and had a t for  = 5.697 which
verified the loss in sum of squares due to the constraint of the ARCH-M model. Space limitations
preclude more experiments with GARCH and other specifications at this time. In no way is the
model for GASOUT complete. A first step might be to add GASIN to the model such as was done in
the VAR and VARMA models discussed in Chapter 8. A full identification process would involve
investigating alternative specifications such as GARCH and a detailed look at the residuals, a task
covered in Stokes (2007, chapter 7) for a range of ARCH/GARCH models. It should be noted that
there is a very real probability that ARCH/GARCH models are observed because the first moment
models do not correctly model nonlinearity. In Chapter 14 nonlinearity is investigated using MARS,
GAM, ACE and PISPLINE models.
12.7 Conclusion
This chapter has illustrated the varfreq and kfilter commands, using the gas furnace data.
While the varfreq command decomposes the VAR model into the frequency domain to study the
patterns of adjustment, the kfilter command shows how a state space model can be identified, using
information in the Hankel matrix. An additional example, using price expectations data, has been
presented to illustrate the problems of feedback.
Testing for unit roots is an important part of time series model building. The dangers of unit
roots were illustrated by means of sample data which produce erroneous or spurious results. Finally,
model building with ARCH and GARCH class models has been illustrated using the B34S
PGMCALL procedure interface into RATS. Stokes (200x) chapter 7 discusses in detail GARCH
modeling using the matrix facility.