Computes the serial independence test based on the empirical copula
process as proposed in Ghoudi et al.(2001) and Genest and Rémillard (2004).
The test, which is the serial analog of `indepTest`

, can be
seen as composed of three steps:

- (i)
a simulation step, which consists in simulating the distribution of the test statistics under serial independence for the sample size under consideration;

- (ii)
the test itself, which consists in computing the approximate p-values of the test statistics with respect to the empirical distributions obtained in step (i);

- (iii)
the display of a graphic, called a

*dependogram*, enabling to understand the type of departure from serial independence, if any.

More details can be found in the articles cited in the reference section.

1 2 | ```
serialIndepTestSim(n, lag.max, m=lag.max+1, N=1000, verbose = interactive())
serialIndepTest(x, d, alpha=0.05)
``` |

`n` |
length of the time series when simulating the distribution of the test statistics under serial independence. |

`lag.max` |
maximum lag. |

`m` |
maximum cardinality of the subsets of 'lags' for which a test
statistic is to be computed. It makes sense to consider |

`N` |
number of repetitions when simulating under serial independence. |

`verbose` |
a logical specifying if progress
should be displayed via |

`x` |
numeric vector containing the time series whose serial independence is to be tested. |

`d` |
object of class |

`alpha` |
significance level used in the computation of the critical values for the test statistics. |

See the references below for more details, especially the third and fourth ones.

The function `serialIndepTestSim()`

returns an object of S3 class
`"serialIndepTestDist"`

with list components `sample.size`

,
`lag.max`

, `max.card.subsets`

, `number.repetitons`

,
`subsets`

(list of the subsets for which test statistics have
been computed), `subsets.binary`

(subsets in binary 'integer'
notation), `dist.statistics.independence`

(a `N`

line matrix
containing the values of the test statistics for each subset and each
repetition) and `dist.global.statistic.independence`

(a vector a
length `N`

containing the values of the serial version of the
global Cramér-von Mises test statistic for each repetition — see
last reference p.175).

The function `serialIndepTest()`

returns an object of S3 class
`"indepTest"`

with list components `subsets`

,
`statistics`

, `critical.values`

, `pvalues`

,
`fisher.pvalue`

(a p-value resulting from a combination *à la*
Fisher of the subset statistic p-values), `tippett.pvalue`

(a
p-value resulting from a combination *à la* Tippett of the subset
statistic p-values), `alpha`

(global significance level of the
test), `beta`

(1 - `beta`

is the significance level per
statistic), `global.statistic`

(value of the global Cramér-von
Mises statistic derived directly from the serial independence
empirical copula process — see last reference p 175) and
`global.statistic.pvalue`

(corresponding p-value).

The former argument `print.every`

is deprecated and not
supported anymore; use `verbose`

instead.

Deheuvels, P. (1979). La fonction de dépendance empirique et ses
propriétés: un test non paramétrique d'indépendance, *Acad. Roy.
Belg. Bull. Cl. Sci.*, 5th Ser. 65:274–292.

Deheuvels, P. (1981), A non parametric test for independence,
*Publ. Inst. Statist. Univ. Paris*. 26:29–50.

Genest, C. and Rémillard, B. (2004)
Tests of independence and randomness based on the empirical copula
process.
*Test* **13**, 335–369.

Genest, C., Quessy, J.-F., and Rémillard, B. (2006)
Local efficiency of a Cramer-von Mises test of independence.
*Journal of Multivariate Analysis* **97**, 274–294.

Genest, C., Quessy, J.-F., and Rémillard, B. (2007)
Asymptotic local efficiency of Cramér-von Mises tests for multivariate
independence. *The Annals of Statistics* **35**, 166–191.

`indepTest`

,
`multIndepTest`

,
`multSerialIndepTest`

,
`dependogram`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
## AR 1 process
ar <- numeric(200)
ar[1] <- rnorm(1)
for (i in 2:200)
ar[i] <- 0.5 * ar[i-1] + rnorm(1)
x <- ar[101:200]
## In order to test for serial independence, the first step consists
## in simulating the distribution of the test statistics under
## serial independence for the same sample size, i.e. n=100.
## As we are going to consider lags up to 3, i.e., subsets of
## {1,...,4} whose cardinality is between 2 and 4 containing {1},
## we set lag.max=3. This may take a while...
d <- serialIndepTestSim(100,3)
## The next step consists in performing the test itself:
test <- serialIndepTest(x,d)
## Let us see the results:
test
## Display the dependogram:
dependogram(test,print=TRUE)
## NB: In order to save d for future use, the saveRDS() function can be used.
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.