U
    Kvfß  ã                   @   s   d Z ddlZddd„ZdS )aœ  Collection of alternative implementations for time series analysis


>>> signal.fftconvolve(x,x[::-1])[len(x)-1:len(x)+10]/x.shape[0]
array([  2.12286549e+00,   1.27450889e+00,   7.86898619e-02,
        -5.80017553e-01,  -5.74814915e-01,  -2.28006995e-01,
         9.39554926e-02,   2.00610244e-01,   1.32239575e-01,
         1.24504352e-03,  -8.81846018e-02])
>>> sm.tsa.stattools.acovf(X, fft=True)[:order+1]
array([  2.12286549e+00,   1.27450889e+00,   7.86898619e-02,
        -5.80017553e-01,  -5.74814915e-01,  -2.28006995e-01,
         9.39554926e-02,   2.00610244e-01,   1.32239575e-01,
         1.24504352e-03,  -8.81846018e-02])

>>> import nitime.utils as ut
>>> ut.autocov(s)[:order+1]
array([  2.12286549e+00,   1.27450889e+00,   7.86898619e-02,
        -5.80017553e-01,  -5.74814915e-01,  -2.28006995e-01,
         9.39554926e-02,   2.00610244e-01,   1.32239575e-01,
         1.24504352e-03,  -8.81846018e-02])
é    NTc                 C   sb   ddl m} t | ¡} |r&| |  ¡  } | | | ddd… ¡t| ƒd t| ƒd … | jd   dS )a_  autocovariance function with call to fftconvolve, biased

    Parameters
    ----------
    x : array_like
        timeseries, signal
    demean : bool
        If true, then demean time series

    Returns
    -------
    acovf : ndarray
        autocovariance for data, same length as x

    might work for nd in parallel with time along axis 0

    r   )ÚsignalNéÿÿÿÿé   é
   )Zscipyr   ÚnpZasarrayZmeanZfftconvolveÚlenÚshape)ÚxZdemeanr   © r
   úC/tmp/pip-unpacked-wheel-2v6byqio/statsmodels/sandbox/archive/tsa.pyÚ	acovf_fft   s
    
r   )T)Ú__doc__Znumpyr   r   r
   r
   r
   r   Ú<module>   s   