Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Time Series Analysis and Control Examples

Computational Details

Least Squares and Householder Transformation

Consider the univariate AR(p) process
y_t = \alpha_0 + \sum_{i=1}^p \alpha_i y_{t-i} + \epsilon_t
Define the design matrix X.
X= [1 & y_p &  ...  & y_1 \ \vdots & \vdots & \ddots & \vdots \ 1 & y_{T-1} &  ...  & y_{T-p}
 ]
Let y = (yp+1, ... ,yn)'. The least squares estimate, \hat{a}=(X^'X)^{-1}X^'y,is the approximation to the maximum likelihood estimate of a=(\alpha_0,\alpha_1, ... ,\alpha_p)if \epsilon_t is assumed to be Gaussian error disturbances. Combining X and y as
Z= [X\,\vdots\,y]
the Z matrix can be decomposed as
Z= Q{U}= Q[R& w_1 \ 0 & w_2
 ]
where Q is an orthogonal matrix and R is an upper triangular matrix, w1 = (w1, ... ,wp+1)', and w2 = (wp+2,0, ... ,0)'.
Q^'y= [w_1 \ w_2 \ \vdots \ w_{T-p}
 ]

The least squares estimate using Householder transformation is computed by solving the linear system

Ra = w1
The unbiased residual variance estimate is
\hat{\sigma}^2 = \frac{1}{T-p} \sum_{i=p+2}^{T-p} w_i^2
 = \frac{w_{p+2}^2}{T-p}
and
{\rm AIC}=(T-p)\log(\hat{\sigma}^2) + 2(p+1)
In practice, least squares estimation does not require the orthogonal matrix Q. The TIMSAC subroutines compute the upper triangular matrix without computing the matrix Q.

Bayesian Constrained Least Squares

Consider the additive time series model
y_t = T_t + S_t + \epsilon_t,\hspace*{.25in}\epsilon_t\sim N(0,\sigma^2)

Practically, it is not possible to estimate parameters a = (T1, ... ,TT,S1, ... ,ST)', since the number of parameters exceeds the number of available observations. Let \nabla_L^m denote the seasonal difference operator with L seasons and degree of m; that is, \nabla_L^m = (1-B^L)^m.Suppose that T=L*n. Some constraints on the trend and seasonal components need to be imposed such that the sum of squares of \nabla^k T_t, \nabla_L^m S_t, and (\sum_{i=0}^{L-1} S_{t-i}) is small. The constrained least squares estimates are obtained by minimizing

\sum_{t=1}^T \{(y_t-T_t-S_t)^2 + d^2[s^2(\nabla^k T_t)^2
 + (\nabla_L^m S_t)^2 + z^2(S_t+ ... +S_{t-L+1})^2]\}
Using matrix notation,
(y-Ma)'(y-Ma) + (a-a0)'D'D(a-a0)
where M= [I_T\,\vdots\,I_T], y = (y1, ... ,yT)', and a0 is the initial guess of a. The matrix D is a 3T×2T control matrix in which structure varies according to the order of differencing in trend and season.
D= d [E_m & 0 \ z{F}& 0 \ 0 & s{G}_k
 ]
where
E_m & = & C_m\otimes{I}_L,\hspace*{.25in} m=1,2,3 \ F& = & [1 & 0 &  ...  & 0 \ ...
 ...ddots & \ddots & \ddots & \ddots & 0 \ 0 &  ...  & 0 & -1 & 3 & -3 & 1
 ]_{Tx T}
The n×n matrix Cm has the same structure as the matrix Gm, and IL is the L×L identity matrix. The solution of the constrained least squares method is equivalent to that of maximizing the following function
L(a) = \exp\{-\frac{1}{2\sigma^2}(y-M{a})^'(y-M{a})\}
 \exp\{-\frac{1}{2\sigma^2}(a-a_0)^'D^'D(a-a_0)\}
Therefore, the PDF of the data y is
f(y|\sigma^2,a) = (\frac{1}{2\pi})^{T/2}
 (\frac{1}{\sigma})^T
 \exp\{-\frac{1}{2\sigma^2}(y-M{a})^'(y-M{a})\}
The prior PDF of the parameter vector a is
\pi(a|{D},\sigma^2,a_0) = (\frac{1}{2\pi})^T
 (\frac{1}{\sigma})^{2T}|{D}^'D|
 \exp\{-\frac{1}{2\sigma^2}(a-a_0)^'D^'D(a-a_0)\}
When the constant d is known, the estimate \hat{a} of a is the mean of the posterior distribution, where the posterior PDF of the parameter a is proportional to the function L(a). It is obvious that \hat{a} is the minimizer of \Vert{g}(a| d)\Vert^2 = (\tilde{y}-\tilde{D}a)^'(\tilde{y}-\tilde{D}a),where
\tilde{y} = [y\ D{a}_0
 ]
\tilde{D} = [M\ D
 ]
The value of d is determined by the minimum ABIC procedure. The ABIC is defined as
{\rm ABIC} = T\log[\frac{1}T\Vert{g}(a| d)\Vert^2]
 + 2\{\log[\det(D^'D+M^'M)]
 - \log[\det(D^'D)]\}

State Space and Kalman Filter Method

In this section, the mathematical formulas for state space modeling are introduced. The Kalman filter algorithms are derived from the state space model. As an example, the state space model of the TSDECOMP subroutine is formulated.

Define the following state space model:

x_t & = & F{x}_{t-1} + G{w}_t \y_t & = & H_t{x}_t + \epsilon_t
where \epsilon_t\sim N(0,\sigma^2) and w_t\sim N(0,Q).If the observations, (y1, ... ,yT), and the initial conditions, x_{0|} and P_{0|}, are available, the one-step predictor (x_{t| t-1})of the state vector xt and its mean square error (MSE) matrix P_{t| t-1} are written as
x_{t| t-1} = F{x}_{t-1| t-1}
P_{t| t-1} = F{P}_{t-1| t-1}F^' + G{Q}G^'
Using the current observation, the filtered value of xt and its variance P_{t| t} are updated.
x_{t| t} = x_{t| t-1} + K_t e_t
P_{t| t} = (I- K_t H_t)P_{t| t-1}
where e_t = y_t - H_t{x}_{t| t-1} and K_t = P_{t| t-1}H^'_t[H_t P_{t| t-1}H^'_t + \sigma^2{I}]^{-1}.The log-likelihood function is computed as
\ell = -\frac{1}2\sum_{t=1}^T \log(2\pi v_{t| t-1})
 - \sum_{t=1}^T \frac{e_t^2}{2v_{t| t-1}}
where vt|t-1 is the conditional variance of the one-step prediction error et.

Consider the additive time series decomposition

y_t = T_t + S_t + T\!D_t + u_t + x^'_t\beta_t + \epsilon_t
where xt is a (K×1) regressor vector and \beta_t is a (K×1) time-varying coefficient vector. Each component has the following constraints:
\nabla^k T_t & = & w_{1t},\hspace*{.25in}w_{1t}\sim N(0,\tau_1^2) \ \nabla_L^m S...
 ...\sum_{i=1}^6 \gamma_{it}(T\!D_t(i)-T\!D_t(7)) \ \gamma_{it} & = & \gamma_{i,t-1}
where \nabla^k = (1-B)^k and \nabla_L^m = (1-B^L)^m.The AR component ut is assumed to be stationary. The trading day component TDt(i) represents the number of the ith day of the week in time t. If k=3, p=3, m=1, and L=12 (monthly data),
T_t & = & 3T_{t-1} - 3T_{t-2} + T_{t-3} + w_{1t} \ \sum_{i=0}^{11} S_{t-i} & = & w_{2t} \ u_t & = & \sum_{i=1}^3 \alpha_i u_{t-i} + w_{3t}
The state vector is defined as
x_t = (T_t,T_{t-1},T_{t-2},S_t, ... ,S_{t-11},u_t,u_{t-1},u_{t-2},
 \gamma_{1t}, ... ,\gamma_{6t})^'
The matrix F is
F= [F_1 & 0 & 0 & 0 \ 0 & F_2 & 0 & 0 \ 0 & 0 & F_3 & 0 \ 0 & 0 & 0 & F_4
 ]
where
F_1 = [3 & -3 & \phantom{-}1 \ 1 & 0 & 0 \ 0 & 1 & 0
 ]
F_2 = [-1^' & -1 \ I_{10} & 0
 ]
F_3 = [\alpha_1 & \alpha_2 & \alpha_3 \ 1 & 0 & 0 \ 0 & 1 & 0
 ]
F4 = I6
1' = (1,1, ... ,1)
The matrix G can be denoted as
G = [g_1 & 0 & 0 \ 0 & g_2 & 0 \ 0 & 0 & g_3 \ 0 & 0 & 0 \ 0 & 0 & 0 \ 0 & 0 & 0 \ 0 & 0 & 0 \ 0 & 0 & 0 \ 0 & 0 & 0
 ]
where
g_1 = g_3 = [1 & 0 & 0
 ]^'
g_2 = [1 & 0 & 0 & 0 & 0 & 0
 ]^'
Finally, the matrix Ht is time-varying,
H_t = [1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & h^'_t
 ]
where
h_t & = & [D_t(1) & D_t(2) & D_t(3) & D_t(4) & D_t(5) & D_t(6)
 ]^' \ D_t(i) & = & T\!D_t(i)-T\!D_t(7),\hspace*{.5in}i=1, ... ,6

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.