Skip to content

Commit 452f1cb

Browse files
committed
Minor fixes
1 parent 07d94b6 commit 452f1cb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pymc_extras/statespace/models/structural/components/seasonality.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ class TimeSeasonality(Component):
2828
components are included in the same model. Default is ``f"Seasonal[s={season_length}, d={duration}]"``
2929
3030
state_names: list of str, default None
31-
List of strings for seasonal effect labels. If provided, it must be of length ``season_length``. An example
32-
would be ``state_names = ['Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun']`` when data is daily with a weekly
31+
List of strings for seasonal effect labels. If provided, it must be of length ``season_length`` times ``duration``.
32+
An example would be ``state_names = ['Mon', 'Tue', 'Wed', 'Thur', 'Fri', 'Sat', 'Sun']`` when data is daily with a weekly
3333
seasonal pattern (``season_length = 7``).
3434
35-
If None, states will be numbered ``[State_0, ..., State_s-1]``
35+
If None and ``duration = 1``, states will be named as ``[State_0, ..., State_s-1]`` (here s is ``season_length``).
36+
If None and ``duration > 1``, states will be named as ``[State_0_0, ..., State_s-1_d-1]`` (here d is ``duration``).
3637
3738
remove_first_state: bool, default True
3839
If True, the first state will be removed from the model. This is done because there are only ``season_length-1`` degrees of
@@ -148,7 +149,7 @@ class TimeSeasonality(Component):
148149
And so on. So for interpretation, the ``season_length - 1`` initial states are, when reversed, the coefficients
149150
associated with ``state_names[1:]``.
150151
151-
In the next example, we set :math:`s=3`, :math:`d=2`, ``remove_first_state=True``, and omit the shock term.
152+
In the next example, we set :math:`s=2`, :math:`d=2`, ``remove_first_state=True``, and omit the shock term.
152153
By definition, the initial vector :math:`\alpha_{0}` is
153154
154155
.. math::
@@ -178,7 +179,7 @@ class TimeSeasonality(Component):
178179
179180
.. warning::
180181
Although the ``state_names`` argument expects a list of length ``season_length`` times ``duration``,
181-
only ``state_names[1:]`` will be saved as model dimensions, since the first coefficient is not identified
182+
only ``state_names[duration:]`` will be saved as model dimensions, since the first coefficient is not identified
182183
(it is defined as :math:`-\sum_{i=1}^{s-1} \tilde{\gamma}_{-i}`).
183184
184185
Examples
@@ -269,7 +270,7 @@ def __init__(
269270

270271
self.provided_state_names = state_names
271272

272-
k_states = season_length * duration - int(self.remove_first_state) * duration
273+
k_states = (season_length - int(self.remove_first_state)) * duration
273274
k_endog = len(observed_state_names)
274275
k_posdef = int(innovations)
275276

0 commit comments

Comments
 (0)