Skip to content

plot_predict fails to pass alpha to conf_int #9693

@xxPLxx

Description

@xxPLxx

Describe the bug

statsmodels.graphics.tsaplots.plot_predict seems to not pass parameter alpha to pred.conf_int successfully, conf_int always uses default value alpha = .05.

Code Sample, a copy-pastable example if possible

import statsmodels.tsa.statespace.sarimax as stss
import statsmodels.graphics.tsaplots as sgt
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

data = pd.DataFrame(np.random.random_integers(10,size = (100,1)))
model = stss.SARIMAX(data,order = (1,0,1))
result = model.fit()

fig, ax = plt.subplots()
sgt.plot_predict(result,len(data),len(data)+5,ax=ax)
plt.show()
plt.close()

fig, ax = plt.subplots()
sgt.plot_predict(result,len(data),len(data)+5,ax=ax,alpha = .32)
plt.show()
plt.close()

# Note that the output of both plots in the code snippet is the same, irregardless of different argument `alpha`.

Details

I have added a print to plot_predict and conf_int to verify the described behaviour is indeed what happens.

Replacing plain argument alpha with alpha = alpha when calling conf_int in plot_predict seems to alleviate the issue.

If the issue has not been resolved, please file it in the issue tracker.

Expected Output

Alpha is passed from plot_predict to conf_int.

Output of import statsmodels.api as sm; sm.show_versions()

Details

INSTALLED VERSIONS

Python: 3.13.7.final.0
OS: Linux 6.12.48-1-MANJARO #1 SMP PREEMPT_DYNAMIC Fri, 19 Sep 2025 16:11:04 +0000 x86_64
byteorder: little
LC_ALL: None
LANG: cs_CZ.UTF-8
statsmodels

Installed: 0.14.5 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/statsmodels)
Required Dependencies

cython: Not installed
numpy: 2.3.3 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/numpy)
scipy: 1.16.2 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/scipy)
pandas: 2.3.2 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/pandas)
dateutil: 2.9.0.post0 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/dateutil)
patsy: 1.0.2 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/patsy)
Optional Dependencies

matplotlib: 3.10.6 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/matplotlib)
Backend tkagg is interactive backend. Turning interactive mode on.
backend: tkagg
cvxopt: Not installed
joblib: Not installed
Developer Tools

IPython: Not installed
jinja2: 3.1.6 (/home/petr/PycharmProjects/StockPrediction/.venv/lib/python3.13/site-packages/jinja2)
sphinx: Not installed
pygments: Not installed
pytest: Not installed
virtualenv: Not installed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions