AutocorTest | R Documentation |
Ljung-Box test for autocorrelation
AutocorTest(x, lag = ceiling(log(length(x))),
type = c("Ljung-Box", "Box-Pierce", "rank"),
df = lag )
x |
a numeric vector or a univariate time series |
lag |
the statistic will be based on 'lag' autocorrelation coefficients. Tsay (p. 27-28) says, 'Simulation studies suggest that the choice of [lag = log(length(x))] provides better power performance. This general rule needs modification in analysis of seasonal time series for which autocorrelations with lags at multiples of the seasonality are more important.' |
type |
which Box.test 'type' should be used? Partial matching is used. The 'rank' alternative computes 'Ljung-Box' on rank(x); see Burns (2002) and references therein. NOTE: The default 'Ljung-Box' type generally seems to be more accurate and popular than the earlier 'Box-Pierce', which is however the default for 'Box.test'. |
df |
a positive number giving the degrees of freedom for the reference chi-squre distribution used to compute the p-value for the statistic. This makes it easy to call AutocorTest with the residuals from a fit
and have the p-value computed with reference to a chi-square with
degrees of freedom different from "lag". See the discussion
of degrees of freedom for 'Box.test in |
This is provided for compatibility with 'autocorTest' in the S-Plus
script in Tsay (p. 30). It is a wrapper for the R function
Box.test
.
a list of class 'htest' containing the following components:
statistic |
a number giving the value of the test statistic. |
paramter |
a number giving the degrees of freedom of the approximate chi-squared distribution of the test statistic used to compute the p.value. |
p.value |
the p-value of the test. |
method |
a character string indicating which type of test was performed. If(df != lag), this character string ends with paste("(lag = ", lag, ")", sep=""). |
https://faculty.chicagobooth.edu/ruey-s-tsay/teaching
Ruey Tsay (2005) Analysis of Financial Time Series, 2nd ed. (Wiley)
Patrick Burns (2002) 'Robustness of the Ljung-Box Test and its Rank Equivalent', https://www.burns-stat.com/pages/Working/ljungbox.pdf, accessed 2007.12.29.
Box.test
ARIMA
data(m.ibm2697)
AutocorTest(m.ibm2697, 5)
AT4 <- AutocorTest(m.ibm2697, 5, df=4)
str(AT4) # $method = "Box-Ljung test (lag = 5)"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.