
    >hq                     >   S r SSKJr  SSKrSSKrSSKrSSKJ	r	  SSK
Jr  SSKJrJrJr  S r  SS
 jr\" SS5        SSS	SSSSS	SS	SS.
S jj5       r        SS jrSSSSS	SSSSSS.
S jrSSSS	SS	SSSS	SSSS.S jrSS jrSS jrSS jr     S S jrg)!zCorrelation plot functions.    )deprecate_kwargN)utils)
array_like)acfpacfccfc           
          [        U5      nU(       a  SOSnUcr  U R                  S   n[        [        [        R
                  " S[        R                  " U5      -  5      5      US-  5      n[        R                  " U(       + US-   5      nOo[        R                  " U5      (       a)  [        R                  " U(       + [        U5      S-   5      nO+Sn[        R                  " U5      R                  [        5      nUR                  S5      nXU4$ )NFTr   
         )boolshapeminintnpceillog10arangeisscalar
asanyarrayastypemax)xlagszero	irregularnobslimnlagss          pC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\statsmodels/graphics/tsaplots.py_prepare_data_corr_plotr!      s    :D4I|wwqz#bggb288D>123TQY?yyT37+	T		yyT3t9q=1	}}T"))#.HHQKE	!!    FTc
                    U(       a  X$   nUb  X4   nU(       a(  U R                   " US/U40 UD6  U R                  " S0 U
D6  U
R                  SS5        U
R                  SS5        SU
;  a  U
R                  SS5        U R                  S	5        U R                  " XB40 U
D6  U R                  U5        U R                  S
S5        U(       az  U R                  S[        R                  " [        U5      [        US S 2S4   U-
  5      5      -  S[        R                  " [        U5      [        US S 2S4   U-
  5      5      -  5        Ub  U	(       a  US   S:X  a  USS  nUSS  nUSS  nUR                  [        5      nU[        R                  " U5      ==   S-  ss'   U[        R                  " U5      ==   S-  ss'   U R!                  XCS S 2S4   U-
  US S 2S4   U-
  SS9  g g )Nr   markero
markersize   ls	linestyleNone皙?r   g      ?      ?g      ?)alpha )vlinesaxhline
setdefaultmarginsplot	set_titleset_ylimr   minimumr   maximumr   r   floatargminargmaxfill_between)axtitleacf_xconfintr   r   
use_vlinesvlines_kwargs
auto_ylimsskip_lag0_confintkwargss              r    
_plot_corrrF       s    mG
		$U4m4


V
h$
lA&6+v.JJtGGD"6"LLKKA
2::c%j#gadme.C*DEE2::c%j#gadme.C*DEE	

 aA8DabkG!"IE{{5!RYYt_$RYYt_$
!Q$-%'A)>d 	 	
 r"   unbiasedadjustedr+   noneAutocorrelation)
r.   rA   rH   fftmissingr>   r   rC   bartlett_confintrB   c       
   
          [         R                  " U5      u  p[        XU	5      u  p/nUc  0 OUnSn[        U UUUUUUS9nUb  USS u  nn[	        UUUUUUUU4SU
0UD6  U$ )a]  
Plot the autocorrelation function

Plots lags on the horizontal and the correlations on vertical axis.

Parameters
----------
x : array_like
    Array of time-series values
ax : AxesSubplot, optional
    If given, this subplot is used to plot in instead of a new figure being
    created.
lags : {int, array_like}, optional
    An int or array of lag values, used on horizontal axis. Uses
    np.arange(lags) when lags is an int.  If not provided,
    ``lags=np.arange(len(corr))`` is used.
alpha : scalar, optional
    If a number is given, the confidence intervals for the given level are
    returned. For instance if alpha=.05, 95 % confidence intervals are
    returned where the standard deviation is computed according to
    Bartlett's formula. If None, no confidence intervals are plotted.
use_vlines : bool, optional
    If True, vertical lines and markers are plotted.
    If False, only markers are plotted.  The default marker is 'o'; it can
    be overridden with a ``marker`` kwarg.
adjusted : bool
    If True, then denominators for autocovariance are n-k, otherwise n
fft : bool, optional
    If True, computes the ACF via FFT.
missing : str, optional
    A string in ['none', 'raise', 'conservative', 'drop'] specifying how
    the NaNs are to be treated.
title : str, optional
    Title to place on plot.  Default is 'Autocorrelation'
zero : bool, optional
    Flag indicating whether to include the 0-lag autocorrelation.
    Default is True.
auto_ylims : bool, optional
    If True, adjusts automatically the y-axis limits to ACF values.
bartlett_confint : bool, default True
    Confidence intervals for ACF values are generally placed at 2
    standard errors around r_k. The formula used for standard error
    depends upon the situation. If the autocorrelations are being used
    to test for randomness of residuals as part of the ARIMA routine,
    the standard errors are determined assuming the residuals are white
    noise. The approximate formula for any lag is that standard error
    of each r_k = 1/sqrt(N). See section 9.4 of [1] for more details on
    the 1/sqrt(N) result. For more elementary discussion, see section
    5.3.2 in [2].
    For the ACF of raw data, the standard error at a lag k is
    found as if the right model was an MA(k-1). This allows the
    possible interpretation that if all autocorrelations past a
    certain lag are within the limits, the model might be an MA of
    order defined by the last significant autocorrelation. In this
    case, a moving average model is assumed for the data and the
    standard errors for the confidence intervals should be
    generated using Bartlett's formula. For more details on
    Bartlett formula result, see section 7.2 in [1].
vlines_kwargs : dict, optional
    Optional dictionary of keyword arguments that are passed to vlines.
**kwargs : kwargs, optional
    Optional keyword arguments that are directly passed on to the
    Matplotlib ``plot`` and ``axhline`` functions.

Returns
-------
Figure
    If `ax` is None, the created figure.  Otherwise the figure to which
    `ax` is connected.

See Also
--------
matplotlib.pyplot.xcorr
matplotlib.pyplot.acorr

Notes
-----
Adapted from matplotlib's `xcorr`.

Data are plotted as ``plot(lags, corr, **kwargs)``

kwargs is used to pass matplotlib optional arguments to both the line
tracing the autocorrelations and for the horizontal line at 0. These
options must be valid for a Line2D object.

vlines_kwargs is used to pass additional optional arguments to the
vertical lines connecting each autocorrelation to the axis.  These options
must be valid for a LineCollection object.

References
----------
[1] Brockwell and Davis, 1987. Time Series Theory and Methods
[2] Brockwell and Davis, 2010. Introduction to Time Series and
Forecasting, 2nd edition.

Examples
--------
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import statsmodels.api as sm

>>> dta = sm.datasets.sunspots.load_pandas().data
>>> dta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))
>>> del dta["YEAR"]
>>> sm.graphics.tsa.plot_acf(dta.values.squeeze(), lags=40)
>>> plt.show()

.. plot:: plots/graphics_tsa_plot_acf.py
N)r   r.   rK   rM   rH   rL   r   rC   )r   create_mpl_axr!   r   rF   )r   r=   r   r.   rA   rH   rK   rL   r>   r   rC   rM   rB   rE   figr   r   r@   r?   s                      r    plot_acfrQ   S   s    ~ !!"%GC4QdCD'/B]MG	)E rw
   Jr"   c	           
          [         R                  " U5      u  pUc  0 OUn[        XU5      u  p+nSnUc  [        XX4S9nO[        XX4S9u  p[	        UUUUUUUU40 U	D6  U
$ )aM  
Plot the partial autocorrelation function

Parameters
----------
x : array_like
    Array of time-series values
ax : AxesSubplot, optional
    If given, this subplot is used to plot in instead of a new figure being
    created.
lags : {int, array_like}, optional
    An int or array of lag values, used on horizontal axis. Uses
    np.arange(lags) when lags is an int.  If not provided,
    ``lags=np.arange(len(corr))`` is used.
alpha : float, optional
    If a number is given, the confidence intervals for the given level are
    returned. For instance if alpha=.05, 95 % confidence intervals are
    returned where the standard deviation is computed according to
    1/sqrt(len(x))
method : str
    Specifies which method for the calculations to use:

    - "ywm" or "ywmle" : Yule-Walker without adjustment. Default.
    - "yw" or "ywadjusted" : Yule-Walker with sample-size adjustment in
      denominator for acovf. Default.
    - "ols" : regression of time series on lags of it and on constant.
    - "ols-inefficient" : regression of time series on lags using a single
      common sample to estimate all pacf coefficients.
    - "ols-adjusted" : regression of time series on lags with a bias
      adjustment.
    - "ld" or "ldadjusted" : Levinson-Durbin recursion with bias
      correction.
    - "ldb" or "ldbiased" : Levinson-Durbin recursion without bias
      correction.

use_vlines : bool, optional
    If True, vertical lines and markers are plotted.
    If False, only markers are plotted.  The default marker is 'o'; it can
    be overridden with a ``marker`` kwarg.
title : str, optional
    Title to place on plot.  Default is 'Partial Autocorrelation'
zero : bool, optional
    Flag indicating whether to include the 0-lag autocorrelation.
    Default is True.
vlines_kwargs : dict, optional
    Optional dictionary of keyword arguments that are passed to vlines.
**kwargs : kwargs, optional
    Optional keyword arguments that are directly passed on to the
    Matplotlib ``plot`` and ``axhline`` functions.

Returns
-------
Figure
    If `ax` is None, the created figure.  Otherwise the figure to which
    `ax` is connected.

See Also
--------
matplotlib.pyplot.xcorr
matplotlib.pyplot.acorr

Notes
-----
Plots lags on the horizontal and the correlations on vertical axis.
Adapted from matplotlib's `xcorr`.

Data are plotted as ``plot(lags, corr, **kwargs)``

kwargs is used to pass matplotlib optional arguments to both the line
tracing the autocorrelations and for the horizontal line at 0. These
options must be valid for a Line2D object.

vlines_kwargs is used to pass additional optional arguments to the
vertical lines connecting each autocorrelation to the axis.  These options
must be valid for a LineCollection object.

Examples
--------
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import statsmodels.api as sm

>>> dta = sm.datasets.sunspots.load_pandas().data
>>> dta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))
>>> del dta["YEAR"]
>>> sm.graphics.tsa.plot_pacf(dta.values.squeeze(), lags=40, method="ywm")
>>> plt.show()

.. plot:: plots/graphics_tsa_plot_pacf.py
N)r   r.   method)r   rO   r!   r   rF   )r   r=   r   r.   rS   rA   r>   r   rB   rE   rP   r   r   r@   r?   s                  r    	plot_pacfrT      s    L !!"%GC'/B]M4QdCDG}Q5@aEI

 
 Jr"   zCross-correlation)
r=   r   negative_lagsr.   rA   rH   rK   r>   rC   rB   c       
   
          [         R                  " U5      u  p[        XS5      u  p>nUc  0 OUnU(       a  U* n[        XXxX^S-   S9nUb  Uu  nnOUnSn[	        UU	UUUUUU4U
SS.UD6  U$ )a  
Plot the cross-correlation function

Correlations between ``x`` and the lags of ``y`` are calculated.

The lags are shown on the horizontal axis and the correlations
on the vertical axis.

Parameters
----------
x, y : array_like
    Arrays of time-series values.
ax : AxesSubplot, optional
    If given, this subplot is used to plot in, otherwise a new figure with
    one subplot is created.
lags : {int, array_like}, optional
    An int or array of lag values, used on the horizontal axis. Uses
    ``np.arange(lags)`` when lags is an int.  If not provided,
    ``lags=np.arange(len(corr))`` is used.
negative_lags: bool, optional
    If True, negative lags are shown on the horizontal axis.
alpha : scalar, optional
    If a number is given, the confidence intervals for the given level are
    plotted, e.g. if alpha=.05, 95 % confidence intervals are shown.
    If None, confidence intervals are not shown on the plot.
use_vlines : bool, optional
    If True, shows vertical lines and markers for the correlation values.
    If False, only shows markers.  The default marker is 'o'; it can
    be overridden with a ``marker`` kwarg.
adjusted : bool
    If True, then denominators for cross-correlations are n-k, otherwise n.
fft : bool, optional
    If True, computes the CCF via FFT.
title : str, optional
    Title to place on plot. Default is 'Cross-correlation'.
auto_ylims : bool, optional
    If True, adjusts automatically the vertical axis limits to CCF values.
vlines_kwargs : dict, optional
    Optional dictionary of keyword arguments that are passed to vlines.
**kwargs : kwargs, optional
    Optional keyword arguments that are directly passed on to the
    Matplotlib ``plot`` and ``axhline`` functions.

Returns
-------
Figure
    The figure where the plot is drawn. This is either an existing figure
    if the `ax` argument is provided, or a newly created figure
    if `ax` is None.

See Also
--------
statsmodels.graphics.tsaplots.plot_acf

Examples
--------
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import statsmodels.api as sm

>>> dta = sm.datasets.macrodata.load_pandas().data
>>> diffed = dta.diff().dropna()
>>> sm.graphics.tsa.plot_ccf(diffed["unemp"], diffed["infl"])
>>> plt.show()
TNr   )rH   rK   r.   r   F)rC   rD   )r   rO   r!   r   rF   )r   yr=   r   rU   r.   rA   rH   rK   r>   rC   rB   rE   rP   r   r   ccf_resccf_xyr@   s                      r    plot_ccfrZ   t  s    b !!"%GC4QdCD'/B]Mu	xQYG !
   Jr"   )varnamesrP   r   rU   r.   rA   rH   rK   rL   r   rC   rM   rB   c                  ^  SSK Jn  [        T SSS9  T R                  S   n[        R
                  " U5      nUR                  UU5      nU" T S5      (       a%  U=(       d    [        T R                  5      nU 4S jnOEU=(       d     [        U5       Vs/ s H	  nS	U S
3PM     snn[        R                  " T 5      m U 4S jn[        U5       H  n[        U5       H  nUR                  UUU4   5      nUU:X  a(  [        U" U5      4USUU    S3UUUUUU	U
UUUS.UD6  MG  [        U" U5      U" U5      4USUU    SUU    S3UU=(       a    UU:  UUUUUUS.
UD6  M     M     U$ s  snf )a  
Plot auto/cross-correlation grid

Plots lags on the horizontal axis and the correlations
on the vertical axis of each graph.

Parameters
----------
x : array_like
    2D array of time-series values: rows are observations,
    columns are variables.
varnames: sequence of str, optional
    Variable names to use in plot titles. If ``x`` is a pandas dataframe
    and ``varnames`` is provided, it overrides the column names
    of the dataframe. If ``varnames`` is not provided and ``x`` is not
    a dataframe, variable names ``x[0]``, ``x[1]``, etc. are generated.
fig : Matplotlib figure instance, optional
    If given, this figure is used to plot in, otherwise a new figure
    is created.
lags : {int, array_like}, optional
    An int or array of lag values, used on horizontal axes. Uses
    ``np.arange(lags)`` when lags is an int.  If not provided,
    ``lags=np.arange(len(corr))`` is used.
negative_lags: bool, optional
    If True, negative lags are shown on the horizontal axes of plots
    below the main diagonal.
alpha : scalar, optional
    If a number is given, the confidence intervals for the given level are
    plotted, e.g. if alpha=.05, 95 % confidence intervals are shown.
    If None, confidence intervals are not shown on the plot.
use_vlines : bool, optional
    If True, shows vertical lines and markers for the correlation values.
    If False, only shows markers.  The default marker is 'o'; it can
    be overridden with a ``marker`` kwarg.
adjusted : bool
    If True, then denominators for correlations are n-k, otherwise n.
fft : bool, optional
    If True, computes the ACF via FFT.
missing : str, optional
    A string in ['none', 'raise', 'conservative', 'drop'] specifying how
    NaNs are to be treated.
zero : bool, optional
    Flag indicating whether to include the 0-lag autocorrelations
    (which are always equal to 1). Default is True.
auto_ylims : bool, optional
    If True, adjusts automatically the vertical axis limits
    to correlation values.
bartlett_confint : bool, default False
    If True, use Bartlett's formula to calculate confidence intervals
    in auto-correlation plots. See the description of ``plot_acf`` for
    details. This argument does not affect cross-correlation plots.
vlines_kwargs : dict, optional
    Optional dictionary of keyword arguments that are passed to vlines.
**kwargs : kwargs, optional
    Optional keyword arguments that are directly passed on to the
    Matplotlib ``plot`` and ``axhline`` functions.

Returns
-------
Figure
    If `fig` is None, the created figure.  Otherwise, `fig` is returned.
    Plots on the grid show the cross-correlation of the row variable
    with the lags of the column variable.

See Also
--------
statsmodels.graphics.tsaplots

Examples
--------
>>> import pandas as pd
>>> import matplotlib.pyplot as plt
>>> import statsmodels.api as sm

>>> dta = sm.datasets.macrodata.load_pandas().data
>>> diffed = dta.diff().dropna()
>>> sm.graphics.tsa.plot_accf_grid(diffed[["unemp", "infl"]])
>>> plt.show()
r   )_is_using_pandasr   r   )ndimr   Nc                 *   > TR                   S S 2U 4   $ N)ilocir   s    r    get_varplot_accf_grid.<locals>.get_varS  s    66!Q$<r"   zx[]c                    > TS S 2U 4   $ r`   r/   rb   s    r    rd   re   Z  s    QT7Nr"   zACF())r=   r>   r   r.   rA   rH   rK   rL   r   rC   rM   rB   zCCF(z, )
r=   r>   r   rU   r.   rA   rH   rK   rC   rB   )statsmodels.tools.datar]   r   r   r   create_mpl_figadd_gridspeclistcolumnsranger   asarrayadd_subplotrQ   rZ   )r   r[   rP   r   rU   r.   rA   rH   rK   rL   r   rC   rM   rB   rE   r]   mgsrd   rc   jr=   s   `                     r    plot_accf_gridrt     s   B 8q#A	
A


s
#C			!Q	B4  .tAII	  <58<8a"QCq	8<JJqM	 1XqAAqD*BAvAJ !Q/)%#)%5"/ " AJAJ  !R}A>"/"9AE)%)"/ )  J JY  =s   E)c           	      F   [         R                  " U5      u  pCSn/ nU  H  u  pxUR                  5       nUR                  5         [	        U5      n	[
        R                  " XUU	-   5      n
UR                  U
R                  5       5        UR                  XR                  S5        UR                  UR                  R                  5       U
S   U
S   SSS9  XY-  nM     UR                  U5        UR                  U5        UR                  U5        UR                  SS5        U$ )	a  
Consider using one of month_plot or quarter_plot unless you need
irregular plotting.

Parameters
----------
grouped_x : iterable of DataFrames
    Should be a GroupBy object (or similar pair of group_names and groups
    as DataFrames) with a DatetimeIndex or PeriodIndex
xticklabels : list of str
    List of season labels, one for each group.
ylabel : str
    Lable for y axis
ax : AxesSubplot, optional
    If given, this subplot is used to plot in instead of a new figure being
    created.
r   kr,   r   )colors	linewidthg?r+   )r   rO   copy
sort_indexlenr   r   appendmeanr4   valueshlines
set_xticksset_xticklabels
set_ylabelr3   )	grouped_xxticklabelsylabelr=   rP   startticksseasondfr   x_plots              r    seasonal_plotr     s    $ !!"%GCEE
WWY
2w5$,/V[[]#
		3'
		IINNfQiC1 	 	
 	   MM%{#MM&JJsDJr"   c                     Uc  SSK Jn  U" U SS9  O([        R                  " U [        R                  " USS9S9n [        [        R                  5      SS n[        U R                  S 5      XRUS	9$ )
a&  
Seasonal plot of monthly data.

Parameters
----------
x : array_like
    Seasonal data to plot. If dates is None, x must be a pandas object
    with a PeriodIndex or DatetimeIndex with a monthly frequency.
dates : array_like, optional
    If `x` is not a pandas object, then dates must be supplied.
ylabel : str, optional
    The label for the y-axis. Will attempt to use the `name` attribute
    of the Series.
ax : Axes, optional
    Existing axes instance.

Returns
-------
Figure
   If `ax` is provided, the Figure instance attached to `ax`. Otherwise
   a new Figure instance.

Examples
--------
>>> import statsmodels.api as sm
>>> import pandas as pd

>>> dta = sm.datasets.elnino.load_pandas().data
>>> dta['YEAR'] = dta.YEAR.astype(int).astype(str)
>>> dta = dta.set_index('YEAR').T.unstack()
>>> dates = pd.to_datetime(list(map(lambda x: '-'.join(x) + '-1',
...                                 dta.index.values)))
>>> dta.index = pd.DatetimeIndex(dates, freq='MS')
>>> fig = sm.graphics.tsa.month_plot(dta)

.. plot:: plots/graphics_tsa_month_plot.py
Nr   _check_period_indexMfreqindexr   c                     U R                   $ r`   )monthrW   s    r    <lambda>month_plot.<locals>.<lambda>  s    AGGr"   r   r=   )
ri   r   pdSeriesPeriodIndexrl   calendar
month_abbrr   groupbyr   datesr   r=   r   r   s         r    
month_plotr     si    N }>AC(IIar~~e#>? x**+AB/K			#$kR r"   c                     Uc  SSK Jn  U" U SS9  O([        R                  " U [        R                  " USS9S9n / SQn[        U R                  S 5      XRUS9$ )	a(  
Seasonal plot of quarterly data

Parameters
----------
x : array_like
    Seasonal data to plot. If dates is None, x must be a pandas object
    with a PeriodIndex or DatetimeIndex with a monthly frequency.
dates : array_like, optional
    If `x` is not a pandas object, then dates must be supplied.
ylabel : str, optional
    The label for the y-axis. Will attempt to use the `name` attribute
    of the Series.
ax : matplotlib.axes, optional
    Existing axes instance.

Returns
-------
Figure
   If `ax` is provided, the Figure instance attached to `ax`. Otherwise
   a new Figure instance.

Examples
--------
>>> import statsmodels.api as sm
>>> import pandas as pd

>>> dta = sm.datasets.elnino.load_pandas().data
>>> dta['YEAR'] = dta.YEAR.astype(int).astype(str)
>>> dta = dta.set_index('YEAR').T.unstack()
>>> dates = pd.to_datetime(list(map(lambda x: '-'.join(x) + '-1',
...                                 dta.index.values)))
>>> dta.index = dates.to_period('Q')
>>> fig = sm.graphics.tsa.quarter_plot(dta)

.. plot:: plots/graphics_tsa_quarter_plot.py
r   r   Qr   r   )q1q2q3q4c                     U R                   $ r`   )quarterr   s    r    r   quarter_plot.<locals>.<lambda>  s    AIIr"   r   )ri   r   r   r   r   r   r   r   s         r    quarter_plotr     sU    N }>AC(IIar~~e#>?*K			%&r r"   c           	      L   SSK JnJn  U" 5       n	U" U5      u  pSSKJn  U R
                  " SXUS.UD6nUR                  n[        U[        R                  [        R                  45      (       a  UR                  nUR                  USS9  O3[        R                  " UR                  S   5      nUR                  XSS9  UbR  S	U-
  S
 S3nUR!                  U5      n[        R"                  " U5      nUR%                  UUSS2S4   USS2S	4   SSUS9  UR'                  SS9  U
$ )aq  

Parameters
----------
result : Result
    Any model result supporting ``get_prediction``.
start : int, str, or datetime, optional
    Zero-indexed observation number at which to start forecasting,
    i.e., the first forecast is start. Can also be a date string to
    parse or a datetime type. Default is the the zeroth observation.
end : int, str, or datetime, optional
    Zero-indexed observation number at which to end forecasting, i.e.,
    the last forecast is end. Can also be a date string to
    parse or a datetime type. However, if the dates index does not
    have a fixed frequency, end must be an integer index if you
    want out of sample prediction. Default is the last observation in
    the sample.
dynamic : bool, int, str, or datetime, optional
    Integer offset relative to `start` at which to begin dynamic
    prediction. Can also be an absolute date string to parse or a
    datetime type (these are not interpreted as offsets).
    Prior to this observation, true endogenous values will be used for
    prediction; starting with this observation and continuing through
    the end of prediction, forecasted endogenous values will be used
    instead.
alpha : {float, None}
    The tail probability not covered by the confidence interval. Must
    be in (0, 1). Confidence interval is constructed assuming normally
    distributed shocks. If None, figure will not show the confidence
    interval.
ax : AxesSubplot
    matplotlib Axes instance to use
**predict_kwargs
    Any additional keyword arguments to pass to ``result.get_prediction``.

Returns
-------
Figure
    matplotlib Figure containing the prediction plot
r   )_import_mplrO   )PredictionResults)r   enddynamicforecast)r=   label)r   Nr   z.0%z confidence intervalgrayr-   )colorr.   r   best)locr/   )statsmodels.graphics.utilsr   rO   statsmodels.tsa.base.predictionr   get_predictionpredicted_mean
isinstancer   r   	DataFramer   r4   r   r   r   conf_intro   r<   legend)resultr   r   r   r.   r=   predict_kwargsr   rO   _rP   r   predr   r   r   cir   s                     r    plot_predictr     s%   b FABGCA %33 g1?D D$BLL122JJ		Rz	*IIdjjm$
z*U73-34]]5!::b>
QTNQTN 	 	
 II&IJr"   )FT)NN)NNr+   ywmTzPartial AutocorrelationTN)NNN)NNFr+   N)__doc__statsmodels.compat.pandasr   r   numpyr   pandasr   statsmodels.graphicsr   statsmodels.tools.validationr   statsmodels.tsa.stattoolsr   r   r   r!   rF   rQ   rT   rZ   rt   r   r   r   r   r/   r"   r    <module>r      s    ! 5    & 3 4 4"6 0
f Z( 	^
 
	^ )^F 	

#	|F !pl [|%P2j1l 
Sr"   