#NEWLINE# def plot_pacf( x , ax = None , lags = None , alpha = 0.05 , method = 'ywm' , use_vlines = True , **kwargs ) : #NEWLINE# #INDENT# "Plot the partial autocorrelation function\n\n    Plots lags on the horizontal and the correlations on vertical axis.\n\n    Parameters\n    ----------\n    x : array_like\n        Array of time-series values\n    ax : Matplotlib AxesSubplot instance, optional\n        If given, this subplot is used to plot in instead of a new figure being\n        created.\n    lags : array_like, optional\n        Array of lag values, used on horizontal axis.\n        If not given, ``lags=np.arange(len(corr))`` is used.\n    alpha : scalar, optional\n        If a number is given, the confidence intervals for the given level are\n        returned. For instance if alpha=.05, 95 % confidence intervals are\n        returned where the standard deviation is computed according to\n        1/sqrt(len(x))\n    method : 'ywunbiased' (default) or 'ywmle' or 'ols'\n        specifies which method for the calculations to use:\n\n        - yw or ywunbiased : yule walker with bias correction in denominator\n          for acovf\n        - ywm or ywmle : yule walker without bias correction\n        - ols - regression of time series on lags of it and on constant\n        - ld or ldunbiased : Levinson-Durbin recursion with bias correction\n        - ldb or ldbiased : Levinson-Durbin recursion without bias correction\n\n    use_vlines : bool, optional\n        If True, vertical lines and markers are plotted.\n        If False, only markers are plotted.  The default marker is 'o'; it can\n        be overridden with a ``marker`` kwarg.\n    **kwargs : kwargs, optional\n        Optional keyword arguments that are directly passed on to the\n        Matplotlib ``plot`` and ``axhline`` functions.\n\n    Returns\n    -------\n    fig : Matplotlib figure instance\n        If `ax` is None, the created figure.  Otherwise the figure to which\n        `ax` is connected.\n\n    See Also\n    --------\n    matplotlib.pyplot.xcorr\n    matplotlib.pyplot.acorr\n    mpl_examples/pylab_examples/xcorr_demo.py\n\n    Notes\n    -----\n    Adapted from matplotlib's `xcorr`.\n\n    Data are plotted as ``plot(lags, corr, **kwargs)``\n\n    " #NEWLINE# ( fig , ax ) = utils . create_mpl_ax ( ax ) #NEWLINE# if ( lags is None ) : #NEWLINE# #INDENT# lags = np . arange ( len ( x ) ) #NEWLINE# nlags = ( len ( lags ) - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nlags = lags #NEWLINE# lags = np . arange ( ( lags + 1 ) ) #NEWLINE# #UNINDENT# confint = None #NEWLINE# if ( alpha is None ) : #NEWLINE# #INDENT# acf_x = pacf ( alpha , nlags = nlags , alpha = alpha , method = method ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( acf_x , confint ) = pacf ( x , nlags = nlags , alpha = alpha , method = method ) #NEWLINE# #UNINDENT# if use_vlines : #NEWLINE# #INDENT# ax . vlines ( lags , [ 0 ] , acf_x , ** kwargs ) #NEWLINE# ax . axhline ( ** kwargs ) #NEWLINE# #UNINDENT# kwargs . setdefault ( 'marker' , 'o' ) #NEWLINE# kwargs . setdefault ( 'markersize' , 5 ) #NEWLINE# kwargs . setdefault ( 'linestyle' , 'None' ) #NEWLINE# ax . margins ( 0.05 ) #NEWLINE# ax . plot ( lags , acf_x , ** kwargs ) #NEWLINE# ax . set_title ( 'Partial Autocorrelation' ) #NEWLINE# if ( confint is not None ) : #NEWLINE# #INDENT# ax . fill_between ( lags , ( confint [ : , 0 ] - acf_x ) , ( confint [ : , 1 ] - acf_x ) , alpha = 0.25 ) #NEWLINE# #UNINDENT# return fig