Skip to content
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

Deterministic seasonal not possible anymore in statsmodels unobserved components #9202

Open
rklees opened this issue Apr 8, 2024 · 0 comments

Comments

@rklees
Copy link

rklees commented Apr 8, 2024

In the current version of statsmodels it is not possible to choose a deterministic seasonal using 'stochastic_seasonal': False.

Example:

frequencies = [{'period': 12, 'harmonics': 1}]

model_settings = {
    'irregular': True, 
    'level': True, 
    'stochastic_level': False, 
    'trend': True, 
    'stochastic_trend': True,
    'cycle': True, 
    'damped_cycle': False, 
    'stochastic_cycle': True,
    'cycle_period_bounds': [5.1, 5.2],
    'freq_seasonal': frequencies,
    'stochastic_seasonal': False,
    'use_exact_diffuse': True}

# ssm = state space model
ssm = sm.tsa.UnobservedComponents(data['meas'], **model_settings)

Fitting the model to the data provides, among others a ML fit of the seasonal disturbance variance,

sigma2.freq_seasonal_12(1) = 0.0809

though this parameter must not be estimated using ML. Strange enough, when using

'stochastic_freq_seasonal': False,

it works. So, what is wrong with 'stochastic_seasonal' ? Moreover, if I have two seasonal terms, one deterministic, the other one stochastic, e.g.,

frequencies = [{'period': 12, 'harmonics': 1}, {'period': 5.347, 'harmonics': 1}]

stochastic_seasonal = [False, True],

gives an error message TypeError: unsupported operand type(s) for +: 'int' and 'list' whereas

stochastic_freq_seasonal = [False, True],

works fine.

@rklees rklees changed the title Deterministic seasonal not possible anymore Deterministic seasonal not possible anymore in statsmodels unobserved components Apr 8, 2024
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

No branches or pull requests

1 participant