Skip to content

Add local level example #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

victorgarcia98
Copy link

To get familiar with the state space description, I wanted to implement the most simple SS model: the local level. Moreover, I show the StatsModels equivalent model next to it.

Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: Victor Garcia Reolid <[email protected]>
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @victorgarcia98 ! Just left a few comments in Review NB. A broader question is: what do you envision this example for? Which use-cases?
Also, be careful because you also edited pymc_extras/statespace/core/statespace.py, and it seems to be accidental as it's adding a fixed shape to parameters

Copy link

review-notebook-app bot commented May 13, 2025

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2025-05-13T20:18:39Z
----------------------------------------------------------------

Line #7.    mu = np.cumsum(rng.standard_normal(size=(100,1))*np.sqrt(true_var_nu**2), axis=0)
Line #8.    y = mu + rng.standard_normal(size=(100,1)) * np.sqrt(true_var_eta)

To follow your greek letter equations above, and since you're using the variances instead of the standard deviation, I think this should instead be:

Line #7.    mu = np.cumsum(rng.standard_normal(size=(100,1))*np.sqrt(true_var_eta), axis=0) # this is now eta, not nu, and not squared
Line #8.    y = mu + rng.standard_normal(size=(100,1)) * np.sqrt(true_var_nu) # this is now nu, not eta

Copy link

review-notebook-app bot commented May 13, 2025

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2025-05-13T20:18:40Z
----------------------------------------------------------------

Any reason you're rebuilding from scratch and not using the structural module?


Copy link

review-notebook-app bot commented May 13, 2025

View / edit / reply to this conversation on ReviewNB

AlexAndorra commented on 2025-05-13T20:18:40Z
----------------------------------------------------------------

Maybe overlay the reference value of the true params for var_eta and var_nu?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants