Module Expr Str ImportFrom alias Import alias identifier Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str If NameLoad body Return SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad NameLoad Call AttributeLoad NameLoad attr BinOpSub NameLoad Call NameLoad NameLoad orelse Return SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad Call AttributeLoad NameLoad attr BinOpSub NameLoad Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpSub NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpSub NameLoad AttributeLoad NameLoad attr Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Return BinOpDiv Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore BinOpMult BinOpMult Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Num AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Return TupleLoad BinOpDiv BinOpMult AttributeLoad BinOpMult NameLoad Call AttributeLoad NameLoad attr attr Num AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMult BinOpMult Call AttributeLoad NameLoad attr NameLoad Num AttributeLoad NameLoad attr Assign NameStore Call NameLoad BinOpSub BinOpFloorDiv NameLoad Num Num NameLoad NameLoad Return TupleLoad AttributeLoad BinOpMult NameLoad Call AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMult BinOpMult Call AttributeLoad NameLoad attr NameLoad Num AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad BinOpFloorDiv NameLoad Num NameLoad Return TupleLoad BinOpDiv BinOpMult BinOpPow Call AttributeLoad NameLoad attr NameLoad Num Num AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num AttributeLoad NameLoad attr NameLoad Return BinOpMult NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpDiv Num NameLoad Assign NameStore BinOpDiv Num NameLoad Assign NameStore BinOpSub BinOpAdd Num BinOpPow NameLoad Num BinOpMult BinOpMult Num NameLoad NameLoad Assign NameStore BinOpSub BinOpAdd Num BinOpPow NameLoad Num BinOpMult BinOpMult Num NameLoad NameLoad Assign NameStore BinOpDiv BinOpMult BinOpDiv Num AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num Return TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpMult Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpDiv BinOpMult BinOpMult NameLoad Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num If CompareEq NameLoad AttributeLoad NameLoad attr body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore BinOpDiv Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMult NameLoad Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str ImportFrom alias If UnaryOpNot NameLoad body Pass orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpAdd SubscriptLoad AttributeLoad NameLoad attr Index Num BinOpMult Num BinOpAdd AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpAdd SubscriptLoad AttributeLoad NameLoad attr Index Num Call NameLoad NameLoad keyword NameLoad Return Call NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad ExtSlice Slice Index NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpMult BinOpDiv Num AttributeLoad NameLoad attr BinOpAdd SubscriptLoad NameLoad Index Num BinOpMult Num Call AttributeLoad BinOpMult SubscriptLoad NameLoad Slice Num Call AttributeLoad NameLoad attr BinOpMult NameLoad Call AttributeLoad NameLoad attr Num NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return SubscriptLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad Call AttributeLoad NameLoad attr keyword Num Slice NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad Return BinOpMult BinOpDiv Num AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpMult NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num Num Num body Assign NameStore Call AttributeLoad NameLoad attr keyword Num keyword Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Slice NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Import alias identifier Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq Call AttributeLoad NameLoad attr NameLoad Num body Assign NameStore NameLoad orelse Assign NameStore UnaryOpUSub SubscriptLoad NameLoad Index Num Return BinOpDiv BinOpDiv Num AttributeLoad NameLoad attr BinOpSub BinOpAdd Num BinOpMult NameLoad NameLoad BinOpMult BinOpMult Num NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list If CompareEq NameLoad Str body FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad decorator_list Assign NameStore Num Assign NameStore ListLoad Num Num Assign NameStore ListLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice Num ListLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call NameLoad SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpMult NameLoad NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Slice Num Num SubscriptLoad NameLoad Slice Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad Num NameLoad NameLoad Expr Call NameLoad SubscriptLoad NameLoad Slice Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr BinOpMult NameLoad NameLoad attr Expr Call NameLoad SubscriptLoad NameLoad Slice Num Expr Call NameLoad SubscriptLoad NameLoad Slice Num Expr Call NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index TupleLoad SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Slice Num Num SubscriptLoad NameLoad Slice Num keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpMult BinOpDiv NameLoad NameLoad NameLoad Expr Call NameLoad SubscriptLoad NameLoad Slice Num Expr Call NameLoad SubscriptLoad NameLoad Slice Num Expr Call NameLoad Call NameLoad NameLoad NameLoad Assign NameStore ListLoad Num Num Assign NameStore ListLoad Num Num Assign NameStore Call NameLoad ListLoad Num Num Num Num Num Num Num Num ListLoad Num Num NameLoad Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num BinOpMult Num AttributeLoad NameLoad attr NameLoad Import alias identifier Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr BinOpPow Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr BinOpPow Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr BinOpPow Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpPow Num Num Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Assign NameStore Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr BinOpAdd NameLoad Num Slice NameLoad Import alias identifier Expr Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str ImportFrom alias Assign TupleStore NameStore NameStore Call NameLoad NameLoad Num Num Expr Call AttributeLoad NameLoad attr Expr Call NameLoad Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call NameLoad SubscriptLoad NameLoad Slice Num Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad
N/A N/A 
Created on Mon Dec 14 19:53:25 2009

Author: josef-pktd

generate arma sample using fft with all the lfilter it looks slow
to get the ma representation first

apply arma filter (in ar representation) to time series to get white noise
but seems slow to be useful for fast estimation for nobs=10000

change/check: instead of using marep, use fft-transform of ar and ma
    separately, use ratio check theory is correct and example works
    DONE : feels much faster than lfilter
    -> use for estimation of ARMA
    -> use pade (scipy.misc) approximation to get starting polynomial
       from autocorrelation (is autocorrelation of AR(p) related to marep?)
       check if pade is fast, not for larger arrays ?
       maybe pade doesn't do the right thing for this, not tried yet
       scipy.pade([ 1.    ,  0.6,  0.25, 0.125, 0.0625, 0.1],2)
       raises LinAlgError: singular matrix
       also doesn't have roots inside unit circle ??
    -> even without initialization, it might be fast for estimation
    -> how do I enforce stationarity and invertibility,
       need helper function

get function drop imag if close to zero from numpy/scipy source, where?

 __future__ print_function N/A numpy np N/A numpy.fft fft scipy signal statsmodels.sandbox.archive.linalg_decomp_1 OneTimeProperty statsmodels.tsa.arima_process ArmaProcess ArmaFft N/A ArmaProcess N/A N/A fft tools for arma processes

    This class contains several methods that are providing the same or similar
    returns to try out and test different implementations.

    Notes
    -----
    TODO:
    check whether we don't want to fix maxlags, and create new instance if
    maxlag changes. usage for different lengths of timeseries ?
    or fix frequency and length for fft

    check default frequencies w, terminology norw  n_or_w

    some ffts are currently done without padding with zeros

    returns for spectral density methods needs checking, is it always the power
    spectrum hw*hw.conj()

    normalization of the power spectrum, spectral density: not checked yet, for
    example no variance of underlying process is used

     __init__ N/A N/A self ar ma n N/A N/A N/A N/A N/A N/A super ArmaFft self __init__ ar ma N/A N/A self ar N/A N/A np asarray ar N/A N/A self ma N/A N/A np asarray ma N/A N/A self nobs n N/A N/A self arpoly N/A N/A N/A np polynomial Polynomial ar N/A N/A self mapoly N/A N/A N/A np polynomial Polynomial ma N/A N/A self nar N/A len ar N/A N/A self nma N/A len ma N/A padarr N/A N/A self arr maxlag atend N/A True N/A N/A pad 1d array with zeros at end to have length maxlag
        function that is a method, no self used

        Parameters
        ----------
        arr : array_like, 1d
            array that will be padded with zeros
        maxlag : int
            length of array after padding
        atend : boolean
            If True (default), then the zeros are added to the end, otherwise
            to the front of the array

        Returns
        -------
        arrp : ndarray
            zero-padded array

        Notes
        -----
        This is mainly written to extend coefficient arrays for the lag-polynomials.
        It returns a copy.

         N/A atend N/A N/A N/A N/A np r_ N/A N/A arr N/A N/A np zeros N/A maxlag N/A len arr N/A N/A N/A N/A np r_ N/A N/A N/A N/A np zeros N/A maxlag N/A len arr arr N/A pad N/A N/A self maxlag N/A N/A N/A construct AR and MA polynomials that are zero-padded to a common length

        Parameters
        ----------
        maxlag : int
            new length of lag-polynomials

        Returns
        -------
        ar : ndarray
            extended AR polynomial coefficients
        ma : ndarray
            extended AR polynomial coefficients

         N/A arpad N/A N/A np r_ N/A N/A N/A self ar N/A N/A np zeros N/A maxlag N/A self nar N/A mapad N/A N/A np r_ N/A N/A N/A self ma N/A N/A np zeros N/A maxlag N/A self nma N/A N/A arpad mapad N/A fftar N/A N/A self n N/A None N/A N/A Fourier transform of AR polynomial, zero-padded at end to n

        Parameters
        ----------
        n : int
            length of array after zero-padding

        Returns
        -------
        fftar : ndarray
            fft of zero-padded ar polynomial
         N/A N/A n None N/A N/A n N/A len N/A self ar N/A N/A N/A fft fft N/A N/A self padarr N/A self ar n N/A fftma N/A N/A self n N/A N/A N/A Fourier transform of MA polynomial, zero-padded at end to n

        Parameters
        ----------
        n : int
            length of array after zero-padding

        Returns
        -------
        fftar : ndarray
            fft of zero-padded ar polynomial
         N/A N/A n None N/A N/A n N/A len N/A self ar N/A N/A N/A fft fft N/A N/A self padarr N/A self ma n N/A fftarma N/A N/A self n N/A None N/A N/A Fourier transform of ARMA polynomial, zero-padded at end to n

        The Fourier transform of the ARMA process is calculated as the ratio
        of the fft of the MA polynomial divided by the fft of the AR polynomial.

        Parameters
        ----------
        n : int
            length of array after zero-padding

        Returns
        -------
        fftarma : ndarray
            fft of zero-padded arma polynomial
         N/A N/A n None N/A N/A n N/A self nobs N/A N/A N/A N/A self fftma n N/A N/A self fftar n N/A spd N/A N/A self npos N/A N/A N/A raw spectral density, returns Fourier transform

        n is number of points in positive spectrum, the actual number of points
        is twice as large. different from other spd methods with fft
         N/A n npos N/A w N/A N/A N/A N/A fft fftfreq N/A 2 n 2 N/A np pi N/A hw N/A N/A self fftarma N/A 2 n N/A N/A N/A N/A N/A N/A hw N/A N/A hw conj real 0.5 N/A np pi w N/A spdshift N/A N/A self n N/A N/A N/A power spectral density using fftshift

        currently returns two-sided according to fft frequencies, use first half
         N/A mapadded N/A N/A self padarr N/A self ma n N/A arpadded N/A N/A self padarr N/A self ar n N/A hw N/A N/A N/A fft fft N/A N/A fft fftshift mapadded N/A N/A fft fft N/A N/A fft fftshift arpadded N/A w N/A N/A N/A N/A fft fftfreq n 2 N/A np pi N/A wslice N/A slice N/A N/A n 2 1 None None N/A N/A N/A N/A hw N/A N/A hw conj real w N/A spddirect N/A N/A self n N/A N/A N/A power spectral density using padding to length n done by fft

        currently returns two-sided according to fft frequencies, use first half
         N/A hw N/A N/A N/A fft fft N/A self ma n N/A N/A fft fft N/A self ar n N/A w N/A N/A N/A N/A fft fftfreq n 2 N/A np pi N/A wslice N/A slice None N/A n 2 None N/A N/A N/A N/A N/A N/A N/A np abs hw 2 0.5 N/A np pi w N/A _spddirect2 N/A N/A self n N/A N/A N/A this looks bad, maybe with an fftshift
         N/A hw N/A N/A N/A fft fft N/A N/A np r_ N/A N/A N/A N/A self ma N/A -1 N/A self ma n N/A N/A fft fft N/A N/A np r_ N/A N/A N/A N/A self ar N/A -1 N/A self ar n N/A N/A hw N/A N/A hw conj N/A spdroots N/A N/A self w N/A N/A N/A spectral density for frequency using polynomial roots

        builds two arrays (number of roots, number of frequencies)
         N/A N/A N/A self spdroots_ N/A self arroots N/A self maroots w N/A spdroots_ N/A N/A self arroots maroots w N/A N/A N/A spectral density for frequency using polynomial roots

        builds two arrays (number of roots, number of frequencies)

        Parameters
        ----------
        arroots : ndarray
            roots of ar (denominator) lag-polynomial
        maroots : ndarray
            roots of ma (numerator) lag-polynomial
        w : array_like
            frequencies for which spd is calculated

        Notes
        -----
        this should go into a function
         N/A w N/A N/A N/A np atleast_2d w T N/A cosw N/A N/A np cos w N/A maroots N/A 1.0 maroots N/A arroots N/A 1.0 arroots N/A num N/A N/A 1 N/A maroots 2 N/A N/A 2 maroots cosw N/A den N/A N/A 1 N/A arroots 2 N/A N/A 2 arroots cosw N/A hw N/A N/A N/A 0.5 N/A np pi N/A N/A num prod -1 N/A N/A den prod -1 N/A N/A N/A N/A np squeeze hw N/A N/A w squeeze N/A spdpoly N/A N/A self w nma N/A 50 N/A N/A spectral density from MA polynomial representation for ARMA process

        References
        ----------
        Cochrane, section 8.3.3
         N/A mpoly N/A N/A N/A np polynomial Polynomial N/A N/A self arma2ma nma N/A hw N/A mpoly N/A N/A np exp N/A 1j w N/A spd N/A N/A np real_if_close N/A N/A N/A hw N/A N/A hw conj 0.5 N/A np pi N/A N/A spd w N/A filter N/A N/A self x N/A N/A N/A 
        filter a timeseries with the ARMA filter

        padding with zero is missing, in example I needed the padding to get
        initial conditions identical to direct filter

        Initial filtered observations differ from filter2 and signal.lfilter, but
        at end they are the same.

        See Also
        --------
        tsa.filters.fftconvolve

         N/A n N/A N/A x shape N/A 0 N/A N/A n N/A self fftarma N/A N/A fftarma N/A self fftarma N/A N/A fftarma N/A N/A N/A self fftma n N/A N/A self fftar n N/A tmpfft N/A fftarma N/A N/A fft fft x N/A N/A N/A fft ifft tmpfft N/A filter2 N/A N/A self x pad N/A 0 N/A N/A filter a time series using fftconvolve3 with ARMA filter

        padding of x currently works only if x is 1d
        in example it produces same observations at beginning as lfilter even
        without padding.

        TODO: this returns 1 additional observation at the end
         statsmodels.tsa.filters fftconvolve3 N/A N/A pad N/A N/A N/A N/A N/A pad auto N/A N/A x N/A N/A self padarr x N/A N/A N/A x shape N/A 0 N/A 2 N/A N/A self nma N/A self nar atend False N/A N/A x N/A N/A self padarr x N/A N/A N/A x shape N/A 0 N/A int pad atend False N/A N/A fftconvolve3 x N/A self ma N/A self ar N/A acf2spdfreq N/A N/A self acovf nfreq w N/A 100 None N/A N/A 
        not really a method
        just for comparison, not efficient for large n or long acf

        this is also similarly use in tsa.stattools.periodogram with window
         N/A N/A w None N/A N/A w N/A N/A N/A np linspace 0 N/A np pi nfreq N/A N/A N/A None N/A nac N/A len acovf N/A hw N/A N/A 0.5 N/A np pi N/A N/A acovf N/A 0 N/A 2 N/A N/A N/A N/A acovf N/A 1 N/A N/A np cos N/A w N/A N/A np arange 1 nac sum 1 N/A hw N/A invpowerspd N/A N/A self n N/A N/A N/A autocovariance from spectral density

        scaling is correct, but n needs to be large for numerical accuracy
        maybe padding with zero in fft would be faster
        without slicing it returns 2-sided autocovariance with fftshift

        >>> ArmaFft([1, -0.5], [1., 0.4], 40).invpowerspd(2**8)[:10]
        array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
                0.045   ,  0.0225  ,  0.01125 ,  0.005625])
        >>> ArmaFft([1, -0.5], [1., 0.4], 40).acovf(10)
        array([ 2.08    ,  1.44    ,  0.72    ,  0.36    ,  0.18    ,  0.09    ,
                0.045   ,  0.0225  ,  0.01125 ,  0.005625])
         N/A hw N/A N/A self fftarma n N/A N/A N/A N/A np real_if_close N/A N/A fft ifft N/A hw N/A N/A hw conj tol 200 N/A n N/A spdmapoly N/A N/A self w twosided N/A False N/A N/A ma only, need division for ar, use LagPolynomial
         N/A N/A w None N/A N/A w N/A N/A np linspace 0 N/A np pi nfreq N/A N/A N/A 0.5 N/A np pi N/A N/A self mapoly N/A N/A np exp N/A w 1j N/A plot4 N/A N/A self fig nobs nacf nfreq N/A None 100 20 100 N/A N/A rvs N/A N/A self generate_sample nsample 100 burnin 500 N/A acf N/A N/A N/A self acf nacf N/A nacf N/A pacf N/A N/A self pacf nacf N/A w N/A N/A np linspace 0 N/A np pi nfreq N/A N/A spdr wr N/A N/A self spdroots w N/A N/A fig None N/A N/A matplotlib.pyplot plt N/A fig N/A N/A plt figure N/A ax N/A N/A fig add_subplot 2 2 1 N/A N/A N/A ax plot rvs N/A N/A N/A ax set_title N/A Random Sample 
ar=%s, ma=%s N/A N/A self ar N/A self ma N/A ax N/A N/A fig add_subplot 2 2 2 N/A N/A N/A ax plot acf N/A N/A N/A ax set_title N/A Autocorrelation 
ar=%s, ma=%rs N/A N/A self ar N/A self ma N/A ax N/A N/A fig add_subplot 2 2 3 N/A N/A N/A ax plot wr spdr N/A N/A N/A ax set_title N/A Power Spectrum 
ar=%s, ma=%s N/A N/A self ar N/A self ma N/A ax N/A N/A fig add_subplot 2 2 4 N/A N/A N/A ax plot pacf N/A N/A N/A ax set_title N/A Partial Autocorrelation 
ar=%s, ma=%s N/A N/A self ar N/A self ma N/A fig N/A N/A spdar1 N/A N/A ar w N/A N/A N/A N/A N/A N/A np ndim ar 0 N/A N/A rho ar N/A N/A rho N/A N/A ar N/A 1 N/A N/A N/A 0.5 N/A np pi N/A N/A 1 N/A rho rho N/A N/A 2 rho N/A N/A np cos w N/A N/A N/A __name__ __main__ N/A maxabs N/A N/A x y N/A N/A N/A N/A N/A np max N/A N/A np abs N/A x y N/A N/A nobs 200 N/A ar N/A 1 0.0 N/A ma N/A 1 0.0 N/A ar2 N/A N/A np zeros nobs N/A N/A ar2 N/A 2 N/A 1 -0.9 N/A uni N/A N/A np zeros nobs N/A N/A uni N/A 0 1.0 N/A arcomb N/A N/A np convolve ar ar2 mode same N/A marep N/A N/A signal lfilter ma arcomb uni N/A N/A print N/A marep N/A 10 N/A mafr N/A N/A fft fft marep N/A rvs N/A N/A N/A np random normal size nobs N/A datafr N/A N/A fft fft rvs N/A y N/A N/A fft ifft N/A mafr datafr N/A N/A print N/A N/A np corrcoef N/A N/A np c_ N/A N/A N/A y N/A 2 N/A y N/A 1 -1 N/A y N/A -2 rowvar 0 N/A arrep N/A N/A signal lfilter N/A 1 marep uni N/A N/A print N/A arrep N/A 20 N/A arfr N/A N/A fft fft arrep N/A yfr N/A N/A fft fft y N/A x N/A N/A N/A fft ifft N/A arfr yfr real N/A N/A print N/A x N/A 5 N/A N/A print N/A rvs N/A 5 N/A N/A print N/A N/A np corrcoef N/A N/A np c_ N/A N/A N/A x N/A 2 N/A x N/A 1 -1 N/A x N/A -2 rowvar 0 N/A arcombp N/A N/A np zeros nobs N/A N/A arcombp N/A N/A len arcomb arcomb N/A map_ N/A N/A np zeros nobs N/A N/A map_ N/A N/A len ma ma N/A ar0fr N/A N/A fft fft arcombp N/A ma0fr N/A N/A fft fft map_ N/A y2 N/A N/A fft ifft N/A N/A ma0fr ar0fr datafr N/A N/A print N/A y2 N/A 10 N/A N/A print N/A y N/A 10 N/A N/A print N/A maxabs y y2 N/A ar N/A 1 -0.4 N/A ma N/A 1 0.2 N/A arma1 N/A ArmaFft N/A 1 -0.5 0 0 0 0 -0.7 0.3 N/A 1 0.8 nobs N/A nfreq nobs N/A w N/A N/A np linspace 0 N/A np pi nfreq N/A w2 N/A N/A np linspace 0 N/A 2 N/A np pi nfreq N/A matplotlib.pyplot plt N/A N/A N/A plt close all N/A N/A N/A plt figure N/A N/A spd1 w1 N/A N/A arma1 spd N/A 2 10 N/A N/A print N/A spd1 shape N/A _ N/A N/A plt plot spd1 N/A N/A N/A plt title spd fft complex N/A N/A N/A plt figure N/A N/A spd2 w2 N/A N/A arma1 spdshift N/A 2 10 N/A N/A print N/A spd2 shape N/A _ N/A N/A plt plot w2 spd2 N/A N/A N/A plt title spd fft shift N/A N/A N/A plt figure N/A N/A spd3 w3 N/A N/A arma1 spddirect N/A 2 10 N/A N/A print N/A spd3 shape N/A _ N/A N/A plt plot w3 spd3 N/A N/A N/A plt title spd fft direct N/A N/A N/A plt figure N/A spd3b N/A N/A arma1 _spddirect2 N/A 2 10 N/A N/A print N/A spd3b shape N/A _ N/A N/A plt plot spd3b N/A N/A N/A plt title spd fft direct mirrored N/A N/A N/A plt figure N/A N/A spdr wr N/A N/A arma1 spdroots w N/A N/A print N/A spdr shape N/A N/A N/A plt plot w spdr N/A N/A N/A plt title spd from roots N/A N/A N/A plt figure N/A spdar1_ N/A spdar1 N/A arma1 ar w N/A N/A print N/A spdar1_ shape N/A _ N/A N/A plt plot w spdar1_ N/A N/A N/A plt title spd ar1 N/A N/A N/A plt figure N/A N/A wper spdper N/A N/A arma1 periodogram nfreq N/A N/A print N/A spdper shape N/A _ N/A N/A plt plot w spdper N/A N/A N/A plt title periodogram N/A startup 1000 N/A rvs N/A N/A N/A arma1 generate_sample N/A startup 10000 N/A startup N/A matplotlib.mlab mlb N/A N/A N/A plt figure N/A N/A sdm wm N/A N/A mlb psd x N/A N/A print sdm.shape N/A sdm shape N/A sdm N/A N/A sdm ravel N/A N/A N/A plt plot wm sdm N/A N/A N/A plt title matplotlib nitime.algorithms LD_AR_est N/A N/A wnt spdnt N/A LD_AR_est rvs 10 512 N/A N/A N/A plt figure N/A N/A print spdnt.shape N/A spdnt shape N/A _ N/A N/A plt plot N/A N/A spdnt ravel N/A N/A print N/A spdnt N/A 10 N/A N/A N/A plt title nitime N/A fig N/A N/A plt figure N/A N/A N/A arma1 plot4 fig