Description Usage Arguments Value
The Ljung–Box test checks that data whithin the time series are independently distributed (i.e. the correlations in the population from which the sample is taken are 0, so that any observed correlations in the data result from randomness of the sampling process). Data are no independently distributed, if they exhibit serial correlation. The test statistic is:
Q = n≤ft(n+2\right)∑_{k=1}^h\frac{\hat{ρ}^2_k}{n-k}
where ”n” is the sample size, \hat{ρ}k is the sample autocorrelation at lag ”k”, and ”h” is the number of lags being tested. Under H_0 the statistic Q follows a χ^2{(h)}. For significance level α, the critical region for rejection of the hypothesis of randomness is:
Q > χ_{1-α,h}^2
where χ_{1-α,h}^2 is the α -quantile of the chi-squared distribution with ”h” degrees of freedom.
1 | LjungBox(tss, lags)
|
tss |
Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series. |
lags |
Number of lags being tested. |
Array containing the Ljung-Box statistic test.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.