Skip to contents

Intuitive explanation

We consider the problem of reporting the number of cases for a certain disease. Results of disease’s tests are reported with a delay. So for any day we will see only some disease-cases in that day; other disease-cases for the same day will be reported in the upcoming days.

Delay ladder shows that by each day the reports come in the subsequent days thus forming a ladder.

Delay ladder shows that by each day the reports come in the subsequent days thus forming a ladder.

Figure 1 shows this idea where we assume that the maximum delay corresponds to 66 days. We can see that by today, April 11th, all of the data for April the 2nd has already arrived: the data that arrived with zero delay (report Apr. 2) as well as the data that arrived with a delay of 11 (report Apr. 3), 22 (report Apr. 4), 33 (report Apr. 5), etc until the data that was reported on April 8th with the maximum delay of 6. For other dates not all data has yet arrived. We can see that for April 9th we only see the data with delay 0 up till 3 (corresponding to April 11th). Data with delay larger than 3 will be seen in the future.

The idea of the model is to predict the number of cases that will be seen at time tt denoted ntn_{t} as the sum of the delayed cases. This includes both the cases we’ve already observed nt,dn_{t,d} and the cases we haven’t yet observed ñt,d\tilde{n}_{t,d}.

The number of cases at time $t$, $n_t$ can be decomposed into those observed with delays $0$ (no delay), and $1,2,3$, $n_{t,0},n_{t,1},n_{t,2},n_{t,3}$ and those predicted for delays $4,5,6$:  $n_{t,4},n_{t,5},n_{t,6}$

The number of cases at time tt, ntn_t can be decomposed into those observed with delays 00 (no delay), and 1,2,31,2,3, nt,0,nt,1,nt,2,nt,3n_{t,0},n_{t,1},n_{t,2},n_{t,3} and those predicted for delays 4,5,64,5,6: nt,4,nt,5,nt,6n_{t,4},n_{t,5},n_{t,6}

The main objective is then to model nt,dn_{t,d}, the number of cases at time tt that will appear with delay dd. What we actually model is the log expected value of nt,dn_{t,d}, denoted t,d\ell_{t,d}. The average of this variable is driven by a process composed of two elements: a time-dependent process and a delay-time-dependent process. You can think of the time-dependent process as the process that drives the epidemic curve while the delay-time-dependent process is the process that drives the testing (or changes in the testing).

The log expected number of cases at time $t$ reported with delay $d$, $\ell_{t,d}$ is a function of a **time-dependent** process $\mu_t$ and a **delay-time-dependent** process $\nu_{t,d}$.

The log expected number of cases at time tt reported with delay dd, t,d\ell_{t,d} is a function of a time-dependent process μt\mu_t and a delay-time-dependent process νt,d\nu_{t,d}.

Each of the processes can be further decomposed into a trend, a season (or multiple seasons), and a cycle:

The decomposition of the **time-dependent** process $\mu_t$. The **delay-time-dependent** process $\nu_{t,d}$ is decomposed in a similar fashion.

The decomposition of the time-dependent process μt\mu_t. The delay-time-dependent process νt,d\nu_{t,d} is decomposed in a similar fashion.

The model thus captures seasonality both for the epidemic curve and for the delay curve as well as their own trends and noise.

Mathematical explanation

Let nt,dsn_{t,d}^s denote the number of incident cases (individuals) in stratum ss (say race/gender) at time tt who were reported with a delay dd. That is, nt,0n_{t,0} denotes the the number of individuals diseased at time tt that were reported at moment tt, nt,1n_{t,1} the number of individuals diseased at time tt that were reported at moment t+1t + 1 and in general nt,dn_{t,d} the number of individuals diseased at time tt that were reported at moment t+dt + d.

We assume that the expected value of nt,dsn_{t,d}^s is given by: 𝔼[nt,ds]=λt,ds \mathbb{E}\left[n_{t,d}^s\right] = \lambda_{t,d}^s where t,ds=lnλt,ds\ell_{t,d}^s = \ln\lambda_{t,d}^s follows a linear state-space model with covariates (see Durbin and Koopman (2012)):

t,ds=Lμμts+Ldννt,ds+BdXt,ds+ϵt,dsμt+1s=Aμμts+Rμξts,μ(time-dependent process)νt+1,ds=Adννt,ds+Rdνξt,ds,ν(delay-dependent process)\begin{equation} \begin{aligned} \ell_{t,d}^s & = L^{\mu} \cdot \mu_{t}^s + L_{d}^{\nu} \cdot \nu_{t,d}^s + B_{d} \cdot X_{t,d}^s + \epsilon_{t,d}^s \\ \mu_{t+1}^s & = A^{\mu} \mu_{t}^s + R^{\mu} \xi_{t}^{s,\mu} \quad & \text{(time-dependent process)}\\ \nu_{t+1,d}^s & = A_{d}^{\nu}\nu_{t,d}^s + R_d^{\nu} \xi_{t,d}^{s,\nu} \quad & \text{(delay-dependent process)}\\ \end{aligned} \end{equation}

where μts\mu_{t}^s represents the time-dependent latent process and νt,ds\nu_{t,d}^s the delay-dependent latent process. The system is defined for t=1,,Tt = 1,\dots, T (time), d=0,,Dd = 0,\dots, D (delays) and s=1,,Ss = 1,\dots,S (strata). Table 1 describes each of the variables and their dimensions.

Dimensions of variables.
Variable(s) Dimension
AμA^{\mu} (rμ×pμ)(r_{\mu} \times p_{\mu})
AdνA_{d}^{\nu} (rν×pν)(r_{\nu} \times p_{\nu})
RμR^{\mu} (rμ×rμ)(r_{\mu} \times r_{\mu})
RdνR_d^{\nu} (rν×rν)(r_{\nu} \times r_{\nu})
BdB_{d}, Xt,dsX_{t,d}^s (q×1)(q \times 1)
LμL^{\mu}, μt+1s\mu_{t+1}^s (rμ×1)(r_{\mu} \times 1)
LdνL_d^{\nu}, νt+1,ds\nu_{t+1,d}^s (rν×1)(r_{\nu} \times 1)
ϵd,ts\epsilon_{d,t}^{s} (1×1)(1 \times 1)
ξd,ts,μ\xi_{d,t}^{s,\mu} (rμ×1)(r_{\mu} \times 1)
ξd,ts,nu\xi_{d,t}^{s,nu} (rν×1)(r_{\nu} \times 1)

In this model, AμA^{\mu},AdνA_{d}^{\nu}, RμR^{\mu},RdνR_d^{\nu},LμL^{\mu}, and LdνL_d^{\nu} are given. Variables ϵt,ds\epsilon_{t,d}^s, ξts,μ\xi_{t}^{s,\mu}, and ξt,ds,ν\xi_{t,d}^{s,\nu} represent random (correlated) noise; Xt,dsX_{t,d}^s is a vector of known covariates, BdB_d is a vector of unknown parameters. Additionally, μ0\mu_{0} and ν0,d\nu_{0,d} are also unknown parameters.

The total number of incident cases for stratum ss expected to at time tt is given by: nts=d=0nt,ds=nt,D+s+d=0Dnt,dsd=0Dnt,ds\begin{equation} n_t^s = \sum\limits_{d = 0}^{\infty} n_{t,d}^s = n_{t,D+}^s + \sum\limits_{d = 0}^{D} n_{t,d}^s \approx \sum\limits_{d = 0}^{D} n_{t,d}^s \end{equation} At time tt, the predicted number of cases with delay dd of stratum ss is denoted by ñt,ds\tilde{n}_{t,d}^s. Finally, the predicted number of cases (nowcasted cases) in stratum ss for time tt is estimated by: ñts=d=0d*nt,dsAlready observed+d=d*+1Dñt,dsPredicted\begin{equation} \tilde{n}_t^s = \underbrace{\sum\limits_{d = 0}^{d^{*}} n_{t,d}^s}_{\text{Already observed}} + \underbrace{\sum\limits_{d = d^{*} + 1}^{D} \tilde{n}_{t,d}^s}_{\text{Predicted}} \end{equation} where d*d^* denotes the latest delay observed with the current data.

We should add the option for zero-inflation

Construction of the LdL_{d}, AdA_{d}, μts\mu_{t}^s, and νt,ds\nu_{t,d}^s

The LμL^{\mu}, LdνL_d^{\nu}, AμA^{\mu}, AdνA_{d}^{\nu}, RμR^{\mu}, RdνR_{d}^{\nu}, μts\mu_{t}^s, and νt,ds\nu_{t,d}^s matrices can be constructed by blocks. In what follows we’ll only show how the construction works for general matrices αt,ds\vec{\alpha}_{t,d}^s, LdL_{d}, AdA_d, RdR_{d} which stand for either νt,ds\nu_{t,d}^s , LdνL_d^{\nu}, AdνA_{d}^{\nu} and RdνR_{d}^{\nu}; or μts\mu_{t}^s, LμL^{\mu}, AμA^{\mu} and RμR^{\mu}.

The general idea is that the vectors αt,ds\vec{\alpha}_{t,d}^s and LdL_{d}, and the matrices AdA_d and RdR_{d} can be constructed by three blocks: a trend, a seasonality, and a cyclical component: Ld=(LdTrend,LdSeason,LdCycle),Ad=diag(AdTrend,AdSeason,AdCycle),Rd=diag(RdTrend,RdSeason,RdCycle), andαt,ds=(αt,ds,Trend,αt,ds,Season,αt,ds,Cycle).\begin{equation} \begin{aligned} L_{d} & = \left(L_{d}^{\text{Trend}}, L_{d}^{\text{Season}}, L_{d}^{\text{Cycle}} \right)^{\top}, \\ A_{d} & = \text{diag}\left(A_{d}^{\text{Trend}}, A_{d}^{\text{Season}}, A_{d}^{\text{Cycle}}\right),\\ R_{d} & = \text{diag}\left(R_{d}^{\text{Trend}}, R_{d}^{\text{Season}}, R_{d}^{\text{Cycle}}\right), \text{ and} \\ \vec{\alpha}_{t,d}^s & = \left(\alpha_{t,d}^{s,\text{Trend}}, \alpha_{t,d}^{s,\text{Season}}, \alpha_{t,d}^{s,\text{Cycle}} \right)^{\top}. \end{aligned} \end{equation}

In this notation, if a section of the model is not specified then that empty block is not considered. For example, a model without seasonality might have the following LdL_d: Ld=(LdTrend,LdCycle) L_{d} = \left(L_{d}^{\text{Trend}}, L_{d}^{\text{Cycle}} \right)^{\top} The definitions for Ad,RdA_{d}, R_{d}, and αt,ds\alpha_{t,d}^s in this case follow the same pattern.

Trend

The trend describes the general direction of t,ds\ell_{t,d}^s. There are three trend options:

Constant trend

The constant trend model is given by: t,ds=αt,ds+ϵt,dsαt+1,ds=αt,ds\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \alpha_{t+1,d}^s & = \alpha_{t,d}^s \\ \end{aligned} \end{equation} in which case LdTrend=1L_{d}^{\text{Trend}} = 1, αt,ds,Trend=αt,ds\alpha_{t,d}^{s,\text{Trend}} = \alpha_{t,d}^s, AdTrend=1A_{d}^{\text{Trend}} = 1, and Rd=0R_d = 0.

Local linear trend

The simplest local linear trend model is given by: t,ds=αt,ds+ϵt,dsνt+1,ds=νt,ds+Rdξt,ds\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \nu_{t+1,d}^s & = \nu_{t,d}^s + R_d \xi_{t,d}^s \end{aligned} \end{equation} in which case LdTrend=1L_{d}^{\text{Trend}} = 1, αt,ds,Trend=αt,ds\alpha_{t,d}^{s,\text{Trend}} = \alpha_{t,d}^s, AdTrend=1A_{d}^{\text{Trend}} = 1, and RdTrend{0,1}R_d^{\text{Trend}} \in\{0,1\}. Notice that if Rd=0R_d = 0 we recover the constant trend model.

Local trend of degree kk

In general (for smoothing purposes), we can adjust the local linear trend of degree kk by fitting the model: t,ds=αt,ds+ϵt,dsΔkαt+1,ds=Rdξt,ds\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \Delta^{k} \alpha_{t+1,d}^s & = R_d\xi_{t,d}^s \end{aligned} \end{equation} where Δαt+1=αt+1αt\Delta \alpha_{t+1} = \alpha_{t+1} - \alpha_{t} and in general Δkαt+1=Δ(Δk1αt+1)\Delta^k \alpha_{t+1} = \Delta\big(\Delta^{k-1} \alpha_{t+1}\big). The model can be rewritten using the general formula for higher order (backward) differences as: t,ds=αt,ds+ϵt,dsαt+1,ds=j=1k(1)j+1(kj)αtj,ds+Rdξt,ds\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \alpha_{t+1,d}^s & = \sum\limits_{j=1}^{k} (-1)^{j+1} \binom{k}{j} \alpha_{t - j,d}^s + R_d\xi_{t,d}^s \end{aligned} \end{equation} where αt,ds,Trend=(αts,αt1s,,αt(k1)s)\alpha_{t,d}^{s,\text{Trend}} = (\alpha_t^s,\alpha_{t-1}^s,\dots,\alpha_{t-(k-1)}^s)^{\top}, RdTrend=diag(1,0,0,,0)R_d^{\text{Trend}} = \textrm{diag}(1,0,0,\dots,0), LdTrend=(1,0,0,,0)L_{d}^{\text{Trend}} = (1, 0, 0, \dots, 0)^{\top} is a vector of zeroes with a one in the first entry, and AdTrend=((k1)(k2)(1)j+1(kj)(1)k(kk1)(1)k+1(kk)100000100000010) A_{d}^{\text{Trend}} = \begin{pmatrix} \binom{k}{1} & -\binom{k}{2} & \dots & (-1)^{j + 1} \binom{k}{j} & \dots & (-1)^{k} \binom{k}{k-1} & (-1)^{k + 1} \binom{k}{k} \\ 1 & 0 & \dots & 0 & \dots & 0 & 0\\ 0 & 1 & \dots & 0 & \dots & 0 & 0\\ \vdots & & & \\ 0 & 0 & \dots & 0 & \dots & 1 & 0\\ \end{pmatrix}

Delvelopers The Local trend of degree kk encompasses both the constant trend when Rd=0R_d = 0 and the local linear trend when k=1k = 1 and Rd=1R_d = 1. As this is the general option this is the one programmed.

Seasonality

There are two types of seasonality considered in this model:

Discrete seasonality

We assume that there are zz given seasons of length ll. For example if tt represents days we can have z=52z = 52 (weekly) seasons each of length 77 (as each week contains 77 days). This is represented in the following baseline model: t,ds=αt,ds+ϵt,dsγk+1,ds=j=1z1γk+1j,ds+wkαt+1,ds=γt+1l,ds\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \gamma_{k+1,d}^s & = - \sum\limits_{j=1}^{z-1} \gamma_{k+1-j, d}^s + w_k\\ \alpha_{t+1,d}^s & = \gamma_{\lceil \frac{t+1}{l} \rceil,d}^s \end{aligned} \end{equation} where wkw_k is a gaussian white noise. This expression can be represented in matrix form with LdSeason=(1,0,0,,0)L_{d}^{\text{Season}} = (1,0,0,\dots,0)^{\top} and Rd=(0,0,,0,rt)R_d = (0, 0, \dots, 0,r_t)^{\top} with rt=1r_t = 1 if tl\frac{t}{l} is an integer and 00 otherwise. The vector αt,ds,Season\alpha_{t,d}^{s,\text{Season}} has length zl+1z l + 1. It is defined initially for tt such that t/l=z\lceil t/l \rceil = z

αt,ds,Season=(γz,γz,,γzl times,γz1,γz1,,γz1l times,γ1,,γ1l times,w1). \alpha_{t,d}^{s,\text{Season}} = \Big( \underbrace{\gamma_{z}, \gamma_{z}, \dots, \gamma_{z}}_{l\text{ times}}, \underbrace{\gamma_{z-1}, \gamma_{z-1},\dots,\gamma_{z-1}}_{l\text{ times}}, \dots \underbrace{\gamma_{1}, \dots, \gamma_{1}}_{l\text{ times}}, w_1 \Big)^{\top}.

Matrix AdSeasonA_d^{\text{Season}} is given by the following expression:

Ad=(000100100100001100000000000000010000000000000001000000000000000000000000100000000000000001) A_d = \begin{pmatrix} 0 & 0 & 0 & \dots & -1 & 0 & 0 & \dots & -1 & 0 & 0 & \dots & -1 & 0 & 0 & \dots & 0 & 0 & 1\\ 1 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 \\ 0 & 1 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 \\ 0 & 0 & 1 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 \\ \vdots & &&& &&&& \vdots &&&&&& \vdots\\ 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 1 & 0 & 0\\ 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 0 & \dots & 0 & 0 & 1\\ \end{pmatrix} where the first row of AdA_d has a 1-1 every llth column starting from column ll until column l×(z1)l\times (z-1). The last entry of the first row of AdA_d is 11. For the rest of the entries, AdA_d has zeroes except in the entries Ai,i1A_{i,i-1} (i>1i > 1) where it has value 11. And the last entry of the last row column of AdA_d is also 11.

Example

Consider a seasonality of z=3z = 3 seasons each of length l=2l = 2. We then have α6=(γ3,γ3,γ2,γ2,γ1,γ1,0) \alpha_6 = (\gamma_3, \gamma_3, \gamma_2, \gamma_2, \gamma_1, \gamma_1, 0)^{\top} and Ad=(0101001100000001000000010000000100000001000000001) A_d = \begin{pmatrix} 0 & -1 & 0 & -1 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{pmatrix} then:

α7=(0101001100000001000000010000000100000001000000001)Ad(γ3γ3γ2γ2γ1γ1w1)α6+(0000000)Rdξ6,d=(γ3γ2+w1γ3γ3γ2γ2γ1w1) \alpha_7 =\underbrace{\begin{pmatrix} 0 & -1 & 0 & -1 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{pmatrix}}_{A_d} \underbrace{\begin{pmatrix} \gamma_3\\ \gamma_3\\ \gamma_2\\ \gamma_2\\ \gamma_1\\ \gamma_1\\ w_1 \end{pmatrix}}_{ \alpha_6} + \underbrace{\begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \end{pmatrix}}_{R_d} \xi_{6,d} = \begin{pmatrix} -\gamma_3 - \gamma_2 + w_1\\ \gamma_3\\ \gamma_3\\ \gamma_2\\ \gamma_2\\ \gamma_1\\ w_1 \end{pmatrix} Substituting γ4=γ3γ2+w1\gamma_4 = -\gamma_3 - \gamma_2 + w_1 we obtain that next component is: α8=(0101001100000001000000010000000100000001000000001)(γ4γ3γ3γ2γ2γ1w1)+(0000001)Rdξ7,d=(γ3γ2+w1γ4γ3γ3γ2γ2w1+ξ7,d) \alpha_8 =\begin{pmatrix} 0 & -1 & 0 & -1 & 0 & 0 & 1\\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{pmatrix} \begin{pmatrix} \gamma_4 \\ \gamma_3\\ \gamma_3\\ \gamma_2\\ \gamma_2\\ \gamma_1\\ w_1 \end{pmatrix} + \underbrace{\begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 1 \\ \end{pmatrix}}_{R_d} \xi_{7,d} = \begin{pmatrix} -\gamma_3 - \gamma_2 + w_1\\ \gamma_4 \\ \gamma_3\\ \gamma_3\\ \gamma_2\\ \gamma_2\\ w_1 + \xi_{7,d} \end{pmatrix} defining w2=w1+ξ7,dw_2 = w_1 + \xi_{7,d} and using the fact that the sum of independent gaussians is independent from one of its summands we recover the original expression.

Trigonometric seasonality

A different approach is to use harmonic functions. In particular, let ll define the period (number of time frames in a cycle) and define λk=2πkl\lambda_k = \frac{2\pi k}{l} and use the following baseline model t,ds=αt,ds+ϵt,dsαt,ds=j=1l2γt,ds,jγt,ds,j=γt1,ds,jcosλj+γ̃t,ds,jsinλj+wt,ds,jγ̃t,ds,j=γt1,ds,jsinλj+γ̃t,ds,jcosλj+w̃t,ds,j\begin{equation} \begin{aligned} \ell_{t,d}^s & = \alpha_{t,d}^s + \epsilon_{t,d}^s \\ \alpha_{t,d}^s & = \sum\limits_{j=1}^{\lfloor \frac{l}{2} \rfloor} \gamma_{t,d}^{s,j}\\ \gamma_{t,d}^{s,j} & = \gamma_{t-1,d}^{s,j}\cos\lambda_j + \tilde{\gamma}_{t,d}^{s,j}\sin\lambda_j + w_{t,d}^{s,j}\\ \tilde{\gamma}_{t,d}^{s,j} & = -\gamma_{t-1,d}^{s,j}\sin\lambda_j + \tilde{\gamma}_{t,d}^{s,j}\cos\lambda_j + \tilde{w}_{t,d}^{s,j}\\ \end{aligned} \end{equation} Following Durbin and Koopman (2012) we can write: αt,ds=(γt,ds,1,γ̃t,ds,1,γt,ds,2,γ̃t,ds,2,,γt,ds,l,γ̃t,ds,l) \alpha_{t,d}^s = (\gamma_{t,d}^{s,1},\tilde{\gamma}_{t,d}^{s,1},\gamma_{t,d}^{s,2},\tilde{\gamma}_{t,d}^{s,2},\dots, \gamma_{t,d}^{s,l},\tilde{\gamma}_{t,d}^{s,l})^{\top} with Ld=(1,0,1,0,1,0,)L_d = (1,0,1,0,1,0,\dots)^{\top}, Rd=Il1R_d = I_{l-1} the identity, and Ad={diag(C1,C2,,Cl*,1)if l is even,diag(C1,C2,,Cl*)if l is odd. A_d = \begin{cases} \text{diag}(C_1, C_2, \dots, C_{l^*}, -1) & \text{if } l \text{ is even,}\\ \text{diag}(C_1, C_2, \dots, C_{l^*}) & \text{if } l \text{ is odd.} \end{cases} where l*=z/2l^* = \lfloor z/2 \rfloor and Cj=(cosλjsinλjsinλjcosλj) C_j = \begin{pmatrix} \cos \lambda_j & \sin \lambda_j \\ - \sin \lambda_j & \cos\lambda_j \end{pmatrix}

Multiple seasons

Multiple seasonalities can be adjusted into blocks to construct the seasonal block:

LdSeason=(LdSeason1,LdSeason2,,LdSeasonk),AdSeason=diag(AdSeason1,AdSeason2,,AdSeasonk),RdSeason=diag(RdSeason1,RdSeason2,,RdSeasonk),αt,ds,Season=(αt,ds,Season1,αt,ds,Season2,,αt,ds,Seasonk).\begin{equation} \begin{aligned} L_{d}^{\text{Season}} & = \left(L_{d}^{\text{Season}_1}, L_{d}^{\text{Season}_2}, \dots, L_{d}^{\text{Season}_k} \right)^{\top}, \\ A_{d}^{\text{Season}} & = \text{diag}\left(A_{d}^{\text{Season}_1}, A_{d}^{\text{Season}_2}, \dots, A_{d}^{\text{Season}_k}\right),\\ R_{d}^{\text{Season}} & = \text{diag}\left(R_{d}^{\text{Season}_1}, R_{d}^{\text{Season}_2}, \dots, R_{d}^{\text{Season}_k}\right), \\ \alpha_{t,d}^{s,\text{Season}} & = \left(\alpha_{t,d}^{s,\text{Season}_1}, \alpha_{t,d}^{s,\text{Season}_2}, \dots, \alpha_{t,d}^{s,\text{Season}_k}\right)^{\top}. \end{aligned} \end{equation}

which are then used in the definitions of Ld,Ad,RdL_d, A_d, R_d, and αt,ds\alpha_{t,d}^{s} respectively.

Cycle

Cycles represent fluctuations of rises and falls which are not of fixed period. Usually they are of greater length than seasonal cycles. For example an epidemic wave might be a cycle while daily effects are seasonal. A cycle is modelled as trigonometric seasons with unknown λc\lambda_c and a damping factor ρc\rho_c. Hence: Ld=(1,0),Ad=Cc,Rd=I2 L_d = (1,0)^{\top}, \quad A_d = C_c, \quad R_d = I_2 with Cc=ρc(cosλcsinλcsinλccosλc) C_c = \rho_c \begin{pmatrix} \cos \lambda_c & \sin \lambda_c \\ -\sin\lambda_c & \cos\lambda_c \end{pmatrix}

Examples

Example 1 (replicating XXX paper)

References

Durbin, James, and Siem Jan Koopman. 2012. Time Series Analysis by State Space Methods. Vol. 38. OUP Oxford.