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 ARIMA.
Details
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.
Value
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="").
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(FinTS)
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FinTS/AutocorTest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: AutocorTest
> ### Title: Box-Ljung autocorrelation test
> ### Aliases: AutocorTest
> ### Keywords: ts
>
> ### ** Examples
>
> data(m.ibm2697)
> AutocorTest(m.ibm2697, 5)
Box-Ljung test
data: m.ibm2697
X-squared = 5.4474, df = 5, p-value = 0.3638
>
> AT4 <- AutocorTest(m.ibm2697, 5, df=4)
> str(AT4) # $method = "Box-Ljung test (lag = 5)"
List of 6
$ statistic : Named num 5.45
..- attr(*, "names")= chr "X-squared"
$ parameter : Named num 4
..- attr(*, "names")= chr "df"
$ p.value : Named num 0.244
..- attr(*, "names")= chr "X-squared"
$ method : chr "Box-Ljung test (lag = 5)"
$ data.name : chr "m.ibm2697"
$ Total.observ: int 864
- attr(*, "class")= chr "htest"
>
>
>
>
>
>
> dev.off()
null device
1
>