tsa.stattools.q_stat()

statsmodels.tsa.stattools.q_stat statsmodels.tsa.stattools.q_stat(x, nobs, type='ljungbox') [source] Return?s Ljung-Box Q Statistic x : array-like Array of autocorrelation coefficients. Can be obtained from acf. nobs : int Number of observations in the entire sample (ie., not just the length of the autocorrelation function results. Returns: q-stat : array Ljung-Box Q-statistic for autocorrelation parameters p-value : array P-value of the Q statistic Notes Written to be used with ac

tsa.tsatools.add_constant()

statsmodels.tsa.tsatools.add_constant statsmodels.tsa.tsatools.add_constant(data, prepend=True, has_constant='skip') This appends a column of ones to an array if prepend==False. Parameters: data : array-like data is the column-ordered design matrix prepend : bool True and the constant is prepended rather than appended. has_constant : str {?raise?, ?add?, ?skip?} Behavior if ``data?? already has a constant. The default will return data without adding another constant. If ?raise?, will r

tsa.stattools.periodogram()

statsmodels.tsa.stattools.periodogram statsmodels.tsa.stattools.periodogram(X) [source] Returns the periodogram for the natural frequency of X Parameters: X : array-like Array for which the periodogram is desired. Returns: pgram : array 1./len(X) * np.abs(np.fft.fft(X))**2 References Brockwell and Davis.

tsa.stattools.pacf_yw()

statsmodels.tsa.stattools.pacf_yw statsmodels.tsa.stattools.pacf_yw(x, nlags=40, method='unbiased') [source] Partial autocorrelation estimated with non-recursive yule_walker Parameters: x : 1d array observations of time series for which pacf is calculated nlags : int largest lag for which pacf is returned method : ?unbiased? (default) or ?mle? method for the autocovariance calculations in yule walker Returns: pacf : 1d array partial autocorrelations, maxlag+1 elements Notes This

tsa.stattools.pacf_ols()

statsmodels.tsa.stattools.pacf_ols statsmodels.tsa.stattools.pacf_ols(x, nlags=40) [source] Calculate partial autocorrelations Parameters: x : 1d array observations of time series for which pacf is calculated nlags : int Number of lags for which pacf is returned. Lag 0 is not returned. Returns: pacf : 1d array partial autocorrelations, maxlag+1 elements Notes This solves a separate OLS estimation for each desired lag.

tsa.stattools.pacf()

statsmodels.tsa.stattools.pacf statsmodels.tsa.stattools.pacf(x, nlags=40, method='ywunbiased', alpha=None) [source] Partial autocorrelation estimated Parameters: x : 1d array observations of time series for which pacf is calculated nlags : int largest lag for which pacf is returned method : ?ywunbiased? (default) or ?ywmle? or ?ols? specifies which method for the calculations to use: yw or ywunbiased : yule walker with bias correction in denominator for acovf ywm or ywmle : yule walke

tsa.stattools.levinson_durbin()

statsmodels.tsa.stattools.levinson_durbin statsmodels.tsa.stattools.levinson_durbin(s, nlags=10, isacov=False) [source] Levinson-Durbin recursion for autoregressive processes Parameters: s : array_like If isacov is False, then this is the time series. If iasacov is true then this is interpreted as autocovariance starting with lag 0 nlags : integer largest lag to include in recursion or order of the autoregressive process isacov : boolean flag to indicate whether the first argument, s,

tsa.stattools.ccovf()

statsmodels.tsa.stattools.ccovf statsmodels.tsa.stattools.ccovf(x, y, unbiased=True, demean=True) [source] crosscovariance for 1D Parameters: x, y : arrays time series data unbiased : boolean if True, then denominators is n-k, otherwise n Returns: ccovf : array autocovariance function Notes This uses np.correlate which does full convolution. For very long time series it is recommended to use fft convolution instead.

tsa.stattools.grangercausalitytests()

statsmodels.tsa.stattools.grangercausalitytests statsmodels.tsa.stattools.grangercausalitytests(x, maxlag, addconst=True, verbose=True) [source] four tests for granger non causality of 2 timeseries all four tests give similar results params_ftest and ssr_ftest are equivalent based on F test which is identical to lmtest:grangertest in R Parameters: x : array, 2d, (nobs,2) data for test whether the time series in the second column Granger causes the time series in the first column maxlag :

tsa.stattools.ccf()

statsmodels.tsa.stattools.ccf statsmodels.tsa.stattools.ccf(x, y, unbiased=True) [source] cross-correlation function for 1d Parameters: x, y : arrays time series data unbiased : boolean if True, then denominators for autocovariance is n-k, otherwise n Returns: ccf : array cross-correlation function of x and y Notes This is based np.correlate which does full convolution. For very long time series it is recommended to use fft convolution instead. If unbiased is true, the denominator