Skip to content

ValueError: Length of endogenous variable must be larger the the number of lags used in the model and the number of observations burned in the log-likelihood calculation #42

@Lancashire3000

Description

@Lancashire3000

Hi,

I tried to run Time Series Forecastings.ipynb both in Jupiter and python script. From Jupiter it seems fine. If I tried to run as a python file (paste sections one by one and run as whole), in

results.plot_diagnostics(figsize=(16, 8))
plt.show()

I got

Traceback (most recent call last):
  File "time-series.py", line 71, in <module>
    results.plot_diagnostics(figsize=(16, 8))
  File "/home/user/anaconda3/lib/python3.8/site-packages/statsmodels/tsa/statespace/mlemodel.py", line 4284, in plot_diagnostics
    raise ValueError(
ValueError: Length of endogenous variable must be larger the the number of lags used in the model and the number of observations burned in the log-likelihood calculation.

may I know what is the reason for it? Thanks

Activity

aniketDash7

aniketDash7 commented on Oct 5, 2023

@aniketDash7

Ensure that you have enough data points for the chosen model. The number of lags used in the model and the number of burn-in observations should be less than the length of your time series.
If you're specifying the number of lags or other parameters for your time series model, try reducing them to a level that is appropriate for your data. If you're testing your model on a small subsample of your data, consider using a larger portion of your data for testing. The problem you're facing can happen if you don't have enough data points for the chosen model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @aniketDash7@Lancashire3000

        Issue actions

          ValueError: Length of endogenous variable must be larger the the number of lags used in the model and the number of observations burned in the log-likelihood calculation · Issue #42 · susanli2016/Machine-Learning-with-Python