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 acf.