Description Usage Arguments Details Value Methods Author(s) References See Also Examples
View source: R/autocovariances.R
Carry out tests for IID from sample autocorrelations.
1 2 3  acfIidTest(acf, n, npar = 0, nlags = npar + 1,
method = c("LiMcLeod", "LjungBox", "BoxPierce"),
interval = 0.95, expandCI = TRUE, ...)

acf 
autocorrelations. 
n 
length of the corresponding time series. 
npar 
number of df to subtract. 
nlags 
number of autocorrelations to use for the portmonteau statistic, can be a vector to request several such statistics. 
method 
a character string, one of "LiMcLeod", "LjungBox" or "BoxPierce". 
interval 
a number or NULL. 
expandCI 
logical flag, if 
... 
currently ignored. 
Performs one of several tests for IID based on sample
autocorrelations. A correction of the degerees of freedom
for residuals from fitted models can be specified with argument
npar
. nlags
specifies the number of autocorrelations to
use in the test, it can be a vector to request several tests.
The results of the test are gathered in a matrix with one row for each
element of nlags
. The test statistic is in column "ChiSQ",
degrees of freedom in "DF" and the pvalue in "pvalue". The method is
in attribute "method".
If interval
is not NULL
confidence intervals for the
autocorrelations are computed, under the null hypothesis of
independence. The coverage probability (or probabilities) is
speciified by interval
.
If argument expandCI
is TRUE
, there is one row
for each lag, up to max(nlags)
. It is best to use this feature
with a single coverage probability.
If expandCI
to FALSE
the confidence intervals are put in
a matrix with one row for each coverage probability.
a list with components "test" and (if requested) "ci", as described in Details
signature(acf = "ANY")
In this method acf
contains the autocorrelations.
signature(acf = "missing")
The autocorrelations are computed from argument x
.
signature(acf = "SampleAutocorrelations")
This is a convenience method in which argument n
is taken from
acf
and thus does not need to be specified by the user.
Georgi N. Boshnakov
Li2004diagnosticsarima
whiteNoiseTest
,
acfGarchTest
,
acfMaTest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  ts1 < rnorm(100)
a1 < drop(acf(ts1)$acf)
acfIidTest(a1, n = 100, nlags = c(5, 10, 20))
acfIidTest(a1, n = 100, nlags = c(5, 10, 20), method = "LjungBox")
acfIidTest(a1, n = 100, nlags = c(5, 10, 20), interval = NULL)
acfIidTest(a1, n = 100, method = "LjungBox", interval = c(0.95, 0.90), expandCI = FALSE)
## acfIidTest() is called behind the scenes by methods for autocorrelation objects
ts1_acrf < autocorrelations(ts1)
class(ts1_acrf) # "SampleAutocorrelations"
whiteNoiseTest(ts1_acrf, h0 = "iid", nlags = c(5,10,20), method = "LiMcLeod")
plot(ts1_acrf)
## use 10% level of significance in the plot:
plot(ts1_acrf, interval = 0.9)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.