Skip to content

Commit 7319012

Browse files
authored
Fix bug in state covariance matrix construction in State Space Frequency Component (#648)
* updated frequency component to trim unidentifiable parameter * Revert "updated frequency component to trim unidentifiable parameter" This reverts commit a2e7041. reverting back to injecting frequency componont unidentifiable parameter during graph build * fixed construction of state covariance Q matrix * removed dangling k_posdef variable
1 parent cc0e061 commit 7319012

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ def make_symbolic_graph(self) -> None:
631631
k_endog_effective = 1 if self.share_states else k_endog
632632

633633
k_states = self.k_states // k_endog_effective
634-
k_posdef = self.k_posdef // k_endog_effective
635634
n_coefs = self.n_coefs
636635

637636
Z = pt.zeros((1, k_states))[0, slice(0, k_states, 2)].set(1.0)
@@ -660,7 +659,6 @@ def make_symbolic_graph(self) -> None:
660659
sigma_season = self.make_and_register_variable(
661660
f"sigma_{self.name}", shape=() if k_endog_effective == 1 else (k_endog_effective,)
662661
)
662+
sigma_vec = pt.repeat(sigma_season**2, k_states)
663663
self.ssm["selection", :, :] = pt.eye(self.k_states)
664-
self.ssm["state_cov", :, :] = pt.eye(self.k_posdef) * pt.repeat(
665-
sigma_season**2, k_posdef
666-
)
664+
self.ssm["state_cov", :, :] = pt.diag(sigma_vec)

0 commit comments

Comments
 (0)