## Consider the following example taken from
## Genest and Remillard (2004), p 352:
x <- matrix(rnorm(500),100,5)
x[,1] <- abs(x[,1]) * sign(x[,2] * x[,3])
x[,5] <- x[,4]/2 + sqrt(3) * x[,5]/2
## In order to test for independence "within" x, the first step consists
## in simulating the distribution of the test statistics under
## independence for the same sample size and dimension,
## i.e. n=100 and p=5. As we are going to consider all the subsets of
## {1,...,5} whose cardinality is between 2 and 5, we set m=5.
## This may take a while...
d <- empcop.simulate(100,5,5)
## The next step consists in performing the test itself:
test <- empcop.test(x,d,5)
## Let us see the results:
test
## Display the dependogram:
dependogram(test)
## We could have tested for a weaker form of independence, for instance,
## by only computing statistics for subsets whose cardinality is between 2
## and 3:
test <- empcop.test(x,d,3)
test
dependogram(test)
## Consider now the following data:
y <- matrix(runif(500),100,5)
## and perform the test:
test <- empcop.test(y,d,3)
test
dependogram(test)
## NB: In order to save d for future use, the save function can be used.
Run the code above in your browser using DataLab