Last data update: 2014.03.03

R: Test of Independence based on Marginal Ranks in a Symmetric...
ind.ictestR Documentation

Test of Independence based on Marginal Ranks in a Symmetric IC Model

Description

Performs the test that a group of variables is independent of an other based on marginal ranks. It is assumed that the data follows a symmetric IC model. Three different score functions are available.

Usage

ind.ictest(X, index1, index2 = NULL, scores = "rank", 
           method = "approximation", n.simu = 1000, 
           ..., na.action = na.fail)

Arguments

X

a data frame or matrix.

index1

integer vector that selects the columns of X that form group one. Only numeric columns can be selected.

index2

integer vector that selects the columns of X that form group two. Only numeric columns can be selected. If NULL, all remaining columns of X will be selected.

scores

if 'sign', a sign test is performed, if 'rank' a signed rank test is performed or if 'normal' a normal score test is performed.

method

defines the method used for the computation of the p-value. The possobilites are "approximation" (default), "simulation" or "permutation". Details below.

n.simu

if 'method = "simulation"' or 'method = "permutation"' this specifies the number of replications used in the simulation or permutation procedure.

...

further arguments to be passed to the function ics

na.action

a function which indicates what should happen when the data contain 'NA's. Default is to fail.

Details

Assumed is here that X[ , index1] comes from a symmetric independent component model which in turn is independent from X[ , index2] which has also an underlying symmetric independent component model. This function recovers the independent components using the function ics, centers them by a marginal loaction estimate based on the same scores that will be used in the actual test. The test is described in Oja, Paindaveine and Taskinen (2009). The asymptotic chi-square distibution is however even for large sample sizes inadequat and therefore p-values can be simulated by resampling the test statistic under the null hypothesis or by permuting the rows of the independent components of X[ , index2]. Both alternatives are also described in Oja, Paindaveine and Taskinen (2009).

Value

A list with class 'htest' containing the following components:

statistic

the value of the Q-statistic.

parameter

the degrees of freedom for the Q-statistic or the number of replications depending on the chosen method.

p.value

the p-value for the test.

method

a character string indicating what type of test was performed.

data.name

a character string giving the name of the data.

Author(s)

Klaus Nordhausen, klaus.nordhausen@uta.fi

References

Oja, H. and Paindaveine, D. and Taskinen, S. (2009), Parametric and Nonparametric Test for Multivariate Independence in IC Models, Manuscript, 1, 1–47.

Examples

Z1<-cbind(rt(500,5),rnorm(500),runif(500))
Z2<-cbind(rt(500,8),rbeta(500,2,2))
A1 <- matrix(c(4, 4, 5, 4, 6, 6, 5, 6, 7), ncol = 3)
A2 <- matrix(c(0.5, -0.3, -0.3, 0.7), ncol = 2)

X <- cbind(Z1 %*% t(A1), Z2 %*% t(A2))

ind.ictest(X,1:3)
ind.ictest(X,1:3,method="simu")

ind.ictest(X,1:2,3:5,method="perm", S1=tyler.shape,S2=cov)

Results


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(ICSNP)
Loading required package: mvtnorm
Loading required package: ICS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ICSNP/ind.ictest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ind.ictest
> ### Title: Test of Independence based on Marginal Ranks in a Symmetric IC
> ###   Model
> ### Aliases: ind.ictest
> ### Keywords: htest multivariate nonparametric
> 
> ### ** Examples
> 
> Z1<-cbind(rt(500,5),rnorm(500),runif(500))
> Z2<-cbind(rt(500,8),rbeta(500,2,2))
> A1 <- matrix(c(4, 4, 5, 4, 6, 6, 5, 6, 7), ncol = 3)
> A2 <- matrix(c(0.5, -0.3, -0.3, 0.7), ncol = 2)
> 
> X <- cbind(Z1 %*% t(A1), Z2 %*% t(A2))
> 
> ind.ictest(X,1:3)

	Test of Independence Based on Marginal Ranks in an IC model

data:  X[,(1:3)] and X[,-(1:3)]
Q = 3.3383, df = 6, p-value = 0.7653

> ind.ictest(X,1:3,method="simu")

	Test of Independence Based on Marginal Ranks in an IC model

data:  X[,(1:3)] and X[,-(1:3)]
Q = 3.3383, replications = 1000, p-value = 0.26

> 
> ind.ictest(X,1:2,3:5,method="perm", S1=tyler.shape,S2=cov)

	Test of Independence Based on Marginal Ranks in an IC model

data:  X[,(1:2)] and X[,(3:5)]
Q = 472.43, replications = 1000, p-value < 2.2e-16

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>