Académique Documents
Professionnel Documents
Culture Documents
NOTES ON PROGRAMS
TRAMO AND SEATS
SEATS PART
Signal Extracion in ARIMA Times Series
Agustn Maravall
Bank of Spain
linear trend
st = i dit
pt
st
utut
600000
400000
200000
0
1
10
20
30
40
50
60
stochastic trend
70
80
90
stochastic SA series
Seasonal noise,
(Highly transitory) irregular noise,
so as to read data better in short-term policy, the remaining signal
may well contain variation for cyclical frequencies.
In this case,
trend "trend-cycle"
10
20
30
40
50
60
70
80
90
100
110
120
130
140
stochastic trend
("moving
Spurious results
Can overadjust
Can underadjust
......................
2)
An alternative approach:
Use simple stochastic models to capture structure of series.
(ARIMA models)
Derive optimal filter
(Signal Extraction)
THIS IS OUR APPROACH
15
22 29 36
43 50 57
64 71 78
15
22 29 36
43 50
57 64 71
78 85 92
15
22 29
36 43
50 57 64
71 78
Observed series
TRAMO
(Interpolated series)
Stochastic Part:
Deterministic Part:
"Linearized" Series
Regression Effects
(output of ARIMA)
SEATS
Trend
+
Seasonal
+
(Transitory)
+
Irregular
AO (Outlier)
TC (Outlier)
LS (Outlier)
Trading Day/Leap Year
Easter Effect
Holidays
Intervention Variables
Regression Variables
(can be assigned to
any component)
Final components
9
b) PURELY SEASONAL
SERIES
x t = white noise
S xt = wt
Spectrum of non
seasonal series
(stationary MA)
Spectrum of seasonal
series
/2
Conclusion:
SERIES WITH DIFFERENT STOCHASTIC STRUCTURES
REQUIRE
DIFFERENT FILTERS
What SEATS does:
To taylor the filter to the structure of the series
(in some optimal way)
10
11
st
(ct) +
st
ut
pt : trend
st : seasonal
ct : transitory
ut : irregular
or
zt
nt
ut
Assumption:
COMPONENTS ARE ORTHOGONAL
(what causes seasonal fluctuations -weather, holidays, ...- has little
to do with what causes the long-term evolution of the series productivity, technology, ... )
12
zt =
(B )
at
(B )
2) Express zt as:
(B )
p ( B )
s ( B ) + c ( B ) + ,
at =
apt +
ast
act ut
(B )
p ( B )
s ( B )
c ( B )
p ( B ) pt = p ( B ) apt
s ( B ) st = s ( B ) a st
c ( B ) c t = c ( B ) a ct
u t = white noise
14
Example:
Let the model be
( 1 .4 B ) 12 x t = ( B ) a t .
Then,
( B ) = ( 1 .4 B ) 12 =
= ( 1 .4 B ) 2 S
We know that
( 1 .4 B ) generates stationary (highly transitory) behavior,
*
*
*
p (B ) = 2
s (B ) = S
c ( B ) = ( 1 .4 B ) ,
15
xt =
(B )
(B )
at =
=
=
p (B )
a pt +
pt
s (B)
S
st
a st +
+
c (B)
1 .4 B
a ct + u t
+ ut
ct
where
2 p t = p ( B ) a pt
S s t = s ( B ) a st
,
,
( 1 .4 B ) c t = c ( B ) a ct
16
SEASONAL COMPONENT
For a deterministic seasonal component, the sum over a year
period of the component should be zero,
st+ st-1 + + st-11 = 0
(monthly data)
or
(1 + B + B2 + + B11) st = 0 .
In short, if
S = 1 + B + B2 + + B11,
S st = 0
For "moving" or stochastic seasonality, this condition cannot hold
for every t. (Precisely because component is moving.)
But, in any case, the annual sum of st should, on average, be zero,
and should not depart too much from it.
Thus we may say
S st = ast
where
17
More generally,
for the seasonal component, often:
s ( B ) = S = 1 + B + B2 + K + Bs-1
where s = # of observations / year.
S st = w t ,
where wt is a stationary ARMA model with:
* zero mean
* small variance,
implies
"annual aggregation of the seasonal component will on average be
zero, and will not depart too much from it.
( 1+ s B s ) .
18
When s < k ,
k = a preassigned (moderate) value (in SEATS: parameter
RMOD = .5 by default),
then factor is assigned to the transitory component.
(A small correlation whose effect disappears, in practice, after
one or two years cannot be properly called seasonality.)
When s < k ,
the following identity is used
[ similar to 1 B s = ( 1 B ) ( 1 + B + K + B s 1 ) ] .
Let s denote now ( s ) . Then,
1 s B s = ( 1 B ) ( 1 + B + 2 B 2 + K + s 1B s 1 ) ,
where
= [ s
]1/ s
(Ex.: 4 = .7
12 = .7
= .915
= .987 ) .
19
Then,
-
s ( B ) = 1 + B + 2 B 2 + K + s 1B s 1
are assigned to the seasonal component.
ds
s t = s ( B ) a st
20
TREND
Analogously, we may start with a deterministic trend, say
pt = a + bt
We know that
pt = b,
or
2 pt = 0
We cannot expect a "moving" trend to exactly satisfy the above
conditions at every t. Instead, we require that departures from
those conditions should, on average, cancel out, and that they
should not be too large.
This yields as a possible specification:
pt = b + apt
with
E apt = 0
Var (apt) = Vp
relatively small
with
E apt = 0
Var (apt) = Vp
relatively small
p pt = w t
d
where wt is a
-zero mean
-stationary
ARMA process.
22
d = (0), 1, 2, (3),
23
SEATS PROVIDES
the decomposition:
xt = p t |T + s t |T + c t |T + u t |T
t > T x t is replaced by its ARIMA forecast x t|T )
where (for ex.)
( when
s t |T = MMSE estimator = E ( s t | x1 K x T ) .
SEATS also provides standard error of estimators and forecasts.
24
ALLOCATION OF AR ROOTS
Ex.: Quartely data
Pseudospectrum:
Spectrum ( Quaterly Series )
/2
Trend Roots
Unit AR roots at = 0 ( i.e., root B=1 in AR polynomial
( 1 ) = 0 ).
Also:
Stationary roots for = 0 if large enough modulus.
Ex.: (1 - .8B) in AR polynomial.
"Large enough" = above the value of parameter RMOD
25
Seasonal roots
Seasonal frequencies:
[ , - ]
will be treated as seasonal
( : controlled by EPSPHI)
Transitory
*
( 1 - .4B ) or ( 1 + .4B )
or
= with small moduli, as
Irregular
Always white noise
(Convenient for testing)
26
27
ALLOCATION OF AR ROOTS
Example: Quarterly data
freq.
/2
range of cyclical
range of intraseasonal
frequencies
frequencies
TO TRANSITORY
TO TREND
TO SEASONAL
TO TRANSITORY
TO SEASONAL
28
An example:
Model for monthly observed series:
( 1 - .78 B - .624 B 2 + .512 B 3 ) 12 x t = ( B ) a t
Regular AR polynomial factorizes as:
1 - .78 B - .624 B 2 + .512 B 3 = ( 1 + .8 B ) ( 1 - 1.58 B + .64 B 2 )
Root of
( 1 + .8 B ) =
= 2 / = 2 months
( 1 - 1.58 B + .64 B 2 )
complex root with modulus r = 2 = .8 ;
frequency (in radians) = arcos ( 1 / 2 r ) =
= .16 rads ;
period =
2
= 40 months .
to transitory component
29
Roots of
= 1 - B trend
Roots of
12
12 = 1 - B =
= ( 1 - B ) ( 1 + B + K + B11 ) =
=S
trend
seasonal
2 pt = p ( B ) a pt
- seasonal:
( 1 + .8 B ) S st = s ( B ) a st
- transitory:
- irregular:
*
ut = w . n .
30
12 x t = ( 1 + 1 B ) ( 1 + 12 B ) a t
models for the components are of the type:
( 12 = 2 S )
TREND-CYCLE
2 p t = p ( B ) a pt
with
(A)
order [ p ( B ) ] = 2 .
SEASONAL
( 1 + B + K + B 11 ) s t = s ( B ) a st
with
(B)
order [ s ( B ) ] = s - 1
ut ~ white noise
(C)
31
B:
C:
Trend Component
2
2
pt = ( 1 + B ) a p t pt = ( 1 + B ) ( 1 + B ) a p t
Seasonal
Component
S ( B ) st = a s t
S ( B ) st = s ( B ) a s t
C
2
2
3
p t = ( 1 + .26 B + .30 B - .32 B ) a p t
S ( B ) s t = ( 1 + .26 B12 ) a st
s ( B ) of order 11
Irregular
Component
Overall Series
w .n.
w .n.
w .n.
12 x t = ( B ) a t
12 x t = (1 + 1 B) (1 + 12 B12 ) a t 12 x t = ( B ) a t
( B ) of order 13 ;
( B ) of order 13 ;
( B ) of order 14 ;
3 parameters
2 parameters
0 parameters
33
pt
ct
ut ,
IMA ( 2, 2 ) + w . n . IMA ( 2, 2 ) ,
nt ~ IMA (2,2) , say
2 nt = 2 (B) ant .
Typically one obtains:
2 (B) (1 - .9 B) (1 + B) ,
with of moderate size.
If (1 - .9B) cancels one , the model becomes
nt = ( 1 + B) ant + k ,
with small.
34
Hence model for SA series often is not far from the popular
"random walk + drift" model.
Remark:
Also we could aggregate the transitory and the irregular to yield a
stationary (transitory- irregular) component
vt = ct + ut
If ct is ARMA (pc, qc), then
vt is ARMA (pv, qv) with
pv = pc
qv = max (pc, qc)
However, a word of caution:
Transitory + Irreg.
detrended series
But trend is "short-term" trend
(i.e., a trend for short-term analysis)
and may contain variation for cyclical frequencies. More properly
called trend-cycle.
35
/4
/2
36
IDENTIFICATION PROBLEM
Example:
Old Components
New Components
Old trend
old trend
New trend
new trend
w.n.
37
In gral:
Can exchange noise among invertible components.
Hence:
* UNDERIDENTIFICATION problem:
- There are models that yield the same aggregate
- They only differ in the relative allocation of white noise to the
components.
38
CANONICAL SOLUTION
Trend-Cycle
Seasonal Component
Canonical Decomposition
Irregular Component
: canonical component
: any other admissible decomposition
39
Ex. Seasonal:
Canonical Seasonal Component
gs ( 0 ) = 0 s ( B ) contains factor ( 1 - B )
40
(B)
where:
- p t , e t are
- p t is canonical trend-cycle
- e t is w.n. with V e 0 .
( p can be replaced by s or c )
Hence: For an observed ARIMA model, the canonical
decomposition provides the "cleanest" signal.
41
(2)
Notice that:
42
Remark:
43
= [ x- K x t K x ]
MMSE estimator of st: ( F = B 1 ; F j x t = x t + j )
s t = E ( s t | ) =
= 0 + j ( B j + F j ) x t
j =1
= 0 + 1 ( x t+1 + x t-1 ) + 2 ( x t+ 2 + x t- 2 ) + K
= ( B, F ) x t
( B, F )
Wiener-Kolmogorov filter.
- Convergent;
- Symmetric and centered;
- Adapts to the series;
44
WK FILTER
Easy algorithm to obtain it:
Assume we wish to estimate a signal, given by the model:
s (B) st = s (B) ast
as in
xt = st + rt ,
rt = "rest"
[Notice: (B) = s (B) r (B)]
Write:
st = s (B) ast ;
s (B) =
s (B)
;
s (B)
xt = (B) at ;
(B) =
(B)
;
(B)
45
Thus, in order to estimate the signal, once the ARIMA model for
xt has been identified, only the model for the signal is needed.
(The other components can be ignored).
(B, F) =
ACGF (s t )
]
ACGF ( x t )
46
Expressing the - polynomials as functions of the - and polynomials, after cancelation of roots, one obtains:
(B, F) =
(invertibility of (B))
- Bounded
or:
WK filter to estimate st is ACGF of the ARMA model
(B) y t = [ s (B) r (B)] a yt ;
V
a yt = wn 0, s
Va
a stationary model.
47
WK Trend-cycle
WK Seasonal Component
0,35
0,25
0,3
0,2
0,25
0,15
0,2
0,15
0,1
0,1
0,05
0,05
-0,05
-0,05
1
12
24
36
48
60
12
WK SA series
24
36
48
60
48
60
WK Irregular Component
0,8
0,6
0,5
0,6
0,4
0,4
0,3
0,2
0,2
0,1
-0,2
-0,1
-0,4
-0,2
12
24
36
48
60
12
24
36
48
Example:
Estimate trend-cycle
2 pt = p (B) apt
in series with model
4 xt = (B) at ,
as in
xt = pt + rt .
We have:
p (B ) =
(B) =
p (B)
2
(B) (B)
=
4 2S
and
p (B, F) = k p
p (B) S p (F) S
(B)
(F)
( S = 1 + F + F 2 + F3 )
The filter p (B, F) is the ACF of the model
(B) y t = [p (B) S] a yt
49
s t = (B, F) x t
can be assumed for the middle years of the sample.
For ex.,
if data spans 20 years, for most series the full filter can be
assumed for the central 10 - 14 years.
This estimator
50
s t = s (B,F) x t
(1)
g s ( ) = [ G s ( ) ] 2 g x ( )
where
G s ( ) = [~
s ( ) ]2
Squared Gain of filter
51
1,2
0,8
0,8
0,6
0,6
0,4
0,4
0,2
0,2
1,20
1,20
1,00
1,00
0,80
0,80
0,60
0,60
0,40
0,40
0,20
0,20
0,00
0,00
52
TESTING
PRESENCE / ABSENCE OF SEASONALITY;
DETERMINISTIC / STOCHASTIC SEASONALITY.
Absence or presence of seasonality:
Determined in AMI.
However:
Given that concept of seasonality somewhat implies NS, AMI in
TRAMO-SEATS
is
slightly
biased
towards
seasonal
differencing.
Thus, on occasion, when a model of the type
[ ( B ) ]
d
12
x t = ( B ) ( 1 .98 B 12 ) a t
(D)
(B ) d x t = (B ) a t + ,
a model that has no seasonality.
It can also be the result of the presence of deterministic
seasonality
11
( B ) d x t = ( B ) a t + + i d it
(E)
i =1
53
However,
in the case in which there is highly stable seasonality in the
series, the stochastic specification (D) is maintained, instead of
the dummy-variable specification. Both are very close, and the
starting values lost in (D) are compensated by the 12 additional
parameters in (E)
) 12 x t = (
) ( 1 .99 B 12 ) a t .
54
Overestimation of seasonality
Excess Variance in SA
series
Variance of SA series is
too small.
V ( s t )
V ( s t )
(Bartlets approximation for SD ( V ) yields
2
m
SD ( V s ) = 0
1 + 2 2j
T
j =1
1
2
).
55
Then:
H0 :
When
V (s t ) = V (s t ) .
For ex.:
V s = .067
V s = .100
( SD = .010 )
56
s t = s (B,F) x t
using xt =
(B)
at
(B)
(B)
s t = s (B,F)
a t = [ s (B, F) ] a t
(
B
)
s (B, F) =
s (B, F) = K + j B j + K + 1 B + 0 +
applies to prior and
concurrent innovations
+ 1 F + K + j F j + K
applies to "future"
innovations (posterior to t)
j = contribution of at-j to s t
-j = contribution of at+j to s t
57
Note
s (B,F) is: asymmetric
non-convergent in B (unless series is stationary)
convergent in F (always)
PSIE-WEIGHTS: SA series
1,2
1
0,8
0,6
0,4
0,2
0
-0,2
-0,4
-0,6
24
21
18
15
12
-3
-6
-9
PSIE-WEIGHTS: Trend-cycle
1,2
1
0,8
0,6
0,4
0,2
0
-0,2
24
21
18
15
12
-3
-6
-9
21
18
15
12
-3
-6
-9
58
Example:
2 pt =p (B) apt : SIGNAL
4 xt = (B) at : SERIES
Then:
p t = p (B, F) x t ,
p (B, F) =
p (B) S p (F) S
(B)
(F)
kp ,
where kp = Vp / Va ,
S = 1 + F + F2 + F3 .
p t = p (B, F)
Thus
(B)
at =
2S
(B)
= k p p 2
p (F) S
at
(F)
part in B part in F
Notice:
p (F ) S
p t = p ( B )
( F )
a 't
59
(observed)
(two components)
[ ( B ) = s ( B )
n ( B ) ]
s ( B ) s t = s ( B ) a st
s (F ) n (F)
xt
(F )
it is found:
(
F
)
( a 't = k s a t )
60
Stationary
Stationary model
transformation
Part in B
Component s ( B ) s t =
s (B )
s ( B ) s t =
s (B )
Estimator
Part in F
s (F) n (F)
(F )
61
One implication
It is (close to) standard practice to build models on seasonally
adjusted data.
This is based on the belief that, by removing seasonality, model
dimensions can be reduced.
This belief is wrong.
Example:
DEFAULT MODEL
12 x t = ( 1 + 1 B ) ( 1 + 12 B12 ) a
Decomposes into:
2 n t = n ( B ) a nt
S s t = s ( B ) a st
The model for the estimator of the SA series has ACF of model:
( 1 + 1 B ) ( 1 + 12 B12 ) 2 n t =
= n ( B )
n ( B ) S a t ,
62
1 = - .4
12 = - .6 .
The MA expansions
transformation of
(or
-weights)
of
the
stationary
63
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
35
36
37
38
ORIGINAL SERIES
1
- 0.4
- 0.6
0.24
-
Hence: *
*
SA-SERIES (ESTIM.)
1.00
-1.33
0.38
-0.40
0.53
-0.15
0.37
0.15
0.06
0.02
0.01
-0.24
0.32
-0.09
-0.14
0.19
-0.05
64
A second implication:
Broadly, the difference between theoretical component and
estimator is the following
Component:
s ( B ) st = s ( B ) a s t
Estimator:
s ( B ) st = s ( B ) s ( F ) at
Difference:
s(F )=
s (F) n (F)
(F )
65
Example:
Component models:
nt = 2 ( B ) ant
2
S st = 11 ( B ) ast
Thus s ( B ) = S .
S 11 unit root.
Therefore, n t will be NI because of these unit roots.
unit AR
66
Consequence:
In gral, for n t
* No convergent AR representation (nor VAR representation)
exists.
AVOID USING AR MODELS TO MODEL SA SERIES
67
General result:
x t =m t +n t
m
t is Noninvertible if
n t is Nonstationary
(Maravall, 1995)
Hence in a standard
trend + seasonal + irregular
decomposition, with NS trend and NS seasonality, all three :
p t , s t , and u t will be NI.
Noninvertibility of the estimators
(and hence previous implications)
is a fairly general property of SA and detrending methods
(including X11)
68
g u ( ) = [ G u ( ) ] 2 g x ( ) ,
where u denotes now any of the components, and
Gu ( )=
gu ( )
gx( )
Gain of filter .
Thus
gu ( )
g u ( ) =
gu ( )
(
)
gu ( )
Since
g x ( )
1,
70
5 6 7
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
3 4
5 6
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
6 7
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
71
Therefore:
- Given our Normality assumption, the joint distribution of the (ST
of the) estimators is known;
- it is fully determined by the observed ARIMA;
- this knowledge permits us to devise simple tests having to do
with issues related to the decomposition obtained in a particular
application.
72
The properties of the estimators have been derived for the case
of an
realization.
73
t1
t2
74
EXTEND
SERIES
WITH
FORECASTS
AND
Preliminary Estimator
4
3,5
3
2,5
2
1,5
1
0,5
0
-0,5
forecasts
75
n T|T
Concurrent Estimator
4
3,5
3
2,5
2
1,5
1
0,5
0
-0,5
76
FINAL ESTIMATOR:
s t = s (B, F) x t =
= + 1 xt-1 + 0 xt + 1 xt+1 +
PRELIMINARY ESTIMATOR:
Obtained by replacing observations not yet available with
forecasts.
Let
s t|T : Estimator of st when last observation is xT
77
For example:
s t|t 1 = + 1 xt-1 + 0 x t|t 1 + 1 x t+1|t 1 +
1 p.a.f.
2 p.a.f.
obtained as
ARIMA forecasts
In summary, for finite realization:
[x1 , x2, , xT]
Preliminary Estimator:
e
s t |T = s ( B, F ) x t |T
e
x t|T = [backcasts, observations, forecasts]
78
(In practice,
79
s T-100|T
s T- j|T
PRELIMINARY EST.
s T|T
CONCURRENT EST.
80
st = K + 1 x t-1 + 0 xt + 1 x t+1 + 2 x t+ 2 + K
Two-sided filter is
- necessary to avoid phase effects;
- implied by MMSE ("optimal") estimation in model-based
approach.
Starting with concurrent estimator:
Observations: [ x1 , K, x t ]
2 p.a. forecast
Notice that:
Given that all forecasts are l.c. of x t j (j = 0, 1, 2, ), s t|t
implicitely obtained with a one-sided filter.
81
is
new observation
updated forecast
Likewise, when x t + 2 becomes available, the 2-period revision of the
concurrent estimator will be given by
s t | t+2 = K + 1 x t 1 + 0 x t + 1 x t +1 + 2 x t + 2 + 3 x t + 3 | t + 2 + K
and so on.
Of course,
inconvenience.
But it is due to the fact that knowledge of the future helps us to
understand the present ( a very basic fact of life! ).
To suppress revisions is
-
82
Revisions:
1-period revision:
( 1)
r t|t
= s t|t +1 s t|t = 1 ( x t +1 x t +1 | t ) + 2 ( x t + 2 | t +1 x t + 2 | t ) + K =
= 1 a t +1
( = w . n .)
( 1 = a constant) .
2-period revision:
(2)
r t| t
..
k-period revision:
(k )
r t| t
= s t|t + k s t|t = 1 a t +1 + K + k a t + k =
= MA ( k 1 )
83
= 1 ( x t+1 - x t+1| t ) +
+ 2 ( x t+ 2 - x t+ 2 | t ) + K
= 1 et (1) + 2 et (2) + K
where:
84
Hence
rt = j e t ( j)
j =1
depends on:
- forecast errors
- weights of the WK filter
Thus:
- interest in "small" forecast errors ( X11 X11 ARIMA)
- but revision still depends on the j s ,
WHICH
DEPEND, in turn, ON
THE
STOCHASTIC
85
86
first revisions
final estimator
k = 1, 2 ,K ,
87
88
st = s ( B, F ) xt
= s ( B, F )
(B )
at ,
(B )
or
st = s ( B, F ) at
* Divergent in B
* Convergent in F
Write:
st = s ( B ) a t + s ( F ) a t+1
-
The filter
Forecasting, 94).
89
s ( B )- at
r,t = s ( F ) + a t+1
90
"unobservable"
finite variance
Vs Vn
a et wn 0 ,
Va
91
s = 0 ,
SMALLER REVISIONS
(and fast convergence) .
94
Ex.:
- deterministic trend:
1 - .99
- deterministic seasonal:
12 - .99
(1 and 12 - .99)
95