Harmonic Method
Each frequency \(lambda_j = 2\pi j / S\) where S
is the period (number of time points in a full cycle) is associated
with two time-varying random components: \(\gamma_{jt}\), and \(gamma^*_{jt}\). They evolve through
time as
$$%
\gamma_{j, t + 1} = \gamma_{jt} \cos(\lambda_j) + \gamma^*_{j, t} %
\sin(\lambda_j) + \epsilon_{0t}$$
$$%
\gamma^*_{j, t + 1} = \gamma^*[j, t] \cos(\lambda_j) - \gamma_{jt} *
\sin(\lambda_j) + \epsilon_1$$
where \(\epsilon_0\) and \(\epsilon_1\) are
independent with the same variance. This is the real-valued version
of a harmonic function: \(\gamma \exp(i\theta)\).
The transition matrix multiplies the function by
\(\exp(i \lambda_j\), so that
after 't' steps the harmonic's value is
\(\gamma \exp(i \lambda_j t)\).
The model dynamics allows gamma to drift over time in a random walk.
The state of the model is
\((\gamma_{jt}, \gamma^*_{jt})\),
for j = 1, ... number of frequencies.
The state transition matrix is a block diagonal matrix, where block 'j' is
$$\cos(\lambda_j) \sin(\lambda_j)$$
$$-\sin(\lambda_j) \cos(\lambda_j)$$
The error variance matrix is sigma^2 * I. There is a common sigma^2
parameter shared by all frequencies.
The model is full rank, so the state error expander matrix R_t is the
identity.
The observation_matrix is (1, 0, 1, 0, ...), where the 1's pick out the
'real' part of the state contributions.
Direct Method
Under the 'direct' method the trig component adds a collection of sine
and cosine terms with randomly varying coefficients to the state
model. The coefficients are the states, while the sine and cosine
values are part of the "observation matrix".
This state component adds the sum of its terms to the observation
equation.
$$y_t = \sum_j \beta_{jt} sin(f_j t) + \gamma_{jt} cos(f_j t)$$
The evolution equation is that each of the sinusoid coefficients
follows a random walk with standard deviation sigma[j].
$$\beta_{jt} = \beta_{jt-1} + N(0, sigma_{sj}^2)
\gamma_{jt} = \gamma_{j-1} + N(0, sigma_{cj}^2) $$
The direct method is generally inferior to the harmonic method. It
may be removed in the future.