Skip to content

Commit 13ffcdd

Browse files
committed
Add second examples in the documentation
1 parent c1937b4 commit 13ffcdd

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

pymc_extras/statespace/models/structural.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,10 +1199,38 @@ class TimeSeasonality(Component):
11991199
And so on. So for interpretation, the ``season_length - 1`` initial states are, when reversed, the coefficients
12001200
associated with ``state_names[1:]``.
12011201
1202+
In the next example, we set :math:`s=3`, :math:`d=2`, ``remove_first_state=True``, and omit the shock term.
1203+
By definition, the initial vector :math:`\alpha_{0}` is
1204+
1205+
.. math::
1206+
\alpha_0=(\tilde{\gamma}_{0}, \tilde{\gamma}_{0}, \tilde{\gamma}_{-1}, \tilde{\gamma}_{-1})
1207+
1208+
and the transition matrix is
1209+
1210+
.. math::
1211+
\begin{bmatrix}
1212+
-1 & 0 & -1 & 0 \\
1213+
0 & -1 & 0 & -1 \\
1214+
1 & 0 & 0 & 0 \\
1215+
0 & 1 & 0 & 0 \\
1216+
\end{bmatrix}
1217+
1218+
It is easy to verify that:
1219+
1220+
.. math::
1221+
\begin{align}
1222+
\gamma_1 &= -\tilde{\gamma}_0 - \tilde{\gamma}_{-1}\\
1223+
\gamma_2 &= -(-\tilde{\gamma}_0 - \tilde{\gamma}_{-1})-\tilde{\gamma}_0\\
1224+
&= \tilde{\gamma}_{-1}\\
1225+
\gamma_3 &= -\tilde{\gamma}_{-1} +(\tilde{\gamma}_0 + \tilde{\gamma}_{-1})\\
1226+
&= \tilde{\gamma}_{0}\\
1227+
\gamma_4 &= -\tilde{\gamma}_0 - \tilde{\gamma}_{-1}.\\
1228+
\end{align}
1229+
12021230
.. warning::
1203-
Although the ``state_names`` argument expects a list of length ``season_length``, only ``state_names[1:]``
1204-
will be saved as model dimensions, since the 1st coefficient is not identified (it is defined as
1205-
:math:`-\sum_{i=1}^{s} \gamma_{t-i}`).
1231+
Although the ``state_names`` argument expects a list of length ``season_length`` times ``duration``,
1232+
only ``state_names[1:]`` will be saved as model dimensions, since the first coefficient is not identified
1233+
(it is defined as :math:`-\sum_{i=1}^{s-1} \tilde{\gamma}_{-i}`).
12061234
12071235
Examples
12081236
--------

0 commit comments

Comments
 (0)