Skip to content

Commit 09e44e2

Browse files
jessegrabowskiricardoV94
authored andcommitted
Add option to TimeSeasonality to keep all states
1 parent 04b9349 commit 09e44e2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pymc_experimental/statespace/models/structural.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ def __init__(
11481148
innovations: bool = True,
11491149
name: Optional[str] = None,
11501150
state_names: Optional[list] = None,
1151+
pop_state: bool = True,
11511152
):
11521153
if name is None:
11531154
name = f"Seasonal[s={season_length}]"
@@ -1160,11 +1161,14 @@ def __init__(
11601161
)
11611162
state_names = state_names.copy()
11621163
self.innovations = innovations
1163-
1164-
# The first state doesn't get a coefficient, it is defined as -sum(state_coefs)
1165-
# TODO: Can I stash that information in the model somewhere so users don't have to know that?
1166-
state_0 = state_names.pop(0)
1167-
k_states = season_length - 1
1164+
self.pop_state = pop_state
1165+
1166+
if self.pop_state:
1167+
# In traditional models, the first state isn't identified, so we can help out the user by automatically
1168+
# discarding it.
1169+
# TODO: Can this be stashed and reconstructed automatically somehow?
1170+
state_names.pop(0)
1171+
k_states = season_length - 1
11681172

11691173
super().__init__(
11701174
name=name,

0 commit comments

Comments
 (0)