Learn R Programming

ICSNP (version 1.1-2)

ind.ctest: Test of Independece based on Marginal Ranks

Description

Performs the test that a group of variables is independent of an other based on marginal ranks. Three different score functions are available.

Usage

ind.ctest(X, index1, index2 = NULL, scores = "rank", 
          na.action = na.fail)

Value

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

statistic

the value of the W-statistic.

parameter

the degrees of freedom for the W-statistic.

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.

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 rank test is performed or if 'normal' a normal score test is performed.

na.action

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

Author

Klaus Nordhausen

Details

The test tests if X[ , index1] is independent of X[ , index2] and is described in great detail in Puri and Sen (1971).

References

Puri , M.L. and Sen, P.K. (1971), Nonparametric Methods in Multivariate Analysis, New York: Wiley.

Examples

Run this code
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(rmvnorm(100, c(-1, 0, 1), A1), rmvnorm(100, c(0, 0), A2))
ind.ctest(X,1:3)
ind.ctest(X, c(1, 5), c(2, 3), scores = "normal")

Run the code above in your browser using DataLab