Skip to content

Add num_steps_per_season parameter in TimeSeasonality #509

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gdeleva
Copy link

@gdeleva gdeleva commented Jun 9, 2025

No description provided.

Copy link
Member

@jessegrabowski jessegrabowski left a comment

Choose a reason for hiding this comment

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

Awesome start! You have exactly the right idea. I think we can be a bit more clever with the math is all.

For the actual implementation, I don't think we can do anything clever -- we'll need to expand the transition matrix to s * d and repeat the rows (and also repeat the starting values). The replicates should all be from the same symbolic value, so the user still just provides s inputs.

Comment on lines +1103 to +1108
.. math::
\underbrace{\gamma_0, \gamma_0, \ldots, \gamma_0}_{r\ \text{times}},
\underbrace{\gamma_1, \gamma_1, \ldots, \gamma_1}_{r\ \text{times}},
\ldots,
\underbrace{\gamma_{s-1}, \gamma_{s-1}, \ldots, \gamma_{s-1}}_{r\ \text{times}},
\ldots,
Copy link
Member

Choose a reason for hiding this comment

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

This is correct, but this can be written more nicely using a floor operator on the index:

$
\gamma_t = -\sum_{i=1}^{s-1} \gamma_{\left\lfloor \frac{t}{d} \right\rfloor - i} + \omega_{\left\lfloor \frac{t}{d} \right\rfloor}, \quad \omega_j \sim \mathcal{N}(0, \sigma_\gamma)
$

I suggest to use d for "duration" instead of r for the number of steps, but I'm fine with being overruled if you have a strong opinion.

To give interpretation to the :math:`\gamma` terms, it is helpful to work through the algebra for a simple
example. Let :math:`s=4`, and omit the shock term. Define initial conditions :math:`\gamma_0, \gamma_{-1},
example. Let :math:`s=4`, :math:`r=1`, and omit the shock term. Define initial conditions :math:`\gamma_0, \gamma_{-1},
\gamma_{-2}`. The value of the seasonal component for the first 5 timesteps will be:

.. math::
Copy link
Member

Choose a reason for hiding this comment

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

Also update this block with a second example that has s=3 and d=2. Show that the floor math works out and you get the expected pattern.

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