Independence tests {SpatialNP} | R Documentation |
Multivariate test of independence based on spatial signs or ranks
Description
Test of independence between two sets of variables. Inference is based on the spatial signs of the observations, symmetrized signs of the observations or spatial signed ranks of the observations.
Usage
sr.indep.test(X, Y = NULL, g = NULL, score = c("sign",
"symmsign", "rank"), regexp = FALSE, cond = FALSE, cond.n = 1000,
na.action = na.fail)
Arguments
X |
a matrix or a data frame |
Y |
an optional matrix or a data frame |
g |
a factor giving the two sets of variables, or numeric vector or vector of column names giving the first set of variables. See details |
score |
a character string indicating which transformation of the observations should be used |
regexp |
logical. Is |
cond |
logical. Should the conditionally distribution free test be used? |
cond.n |
Number of permutations to use in the conditionally distribution free test |
na.action |
a function which indicates what should happen when the data contain 'NA's. Default is to fail. |
Details
X
should contain the first set of variables and
Y
the second with matching rows. Alternatively, X
should
contain both sets and g
should be a factor of length equal to
number of columns of X
, or, g
should be a numeric or
character vector naming the variables in the first set. If g
is
a character vector it is assumed to name all wanted columns exactly,
unless regexp
is TRUE
.
Value
A list with class 'htest' containing the following components:
statistic |
the value of the statistic |
parameter |
the degrees of freedom for the statistic or the number of replications if conditionally distribution free p-value was used |
p.value |
the p-value for the test |
null.value |
the specified hypothesized value of the measure of dependence (always 0) |
alternative |
a character string with the value 'two.sided'. |
method |
a character string indicating what type of test was performed |
data.name |
a character string giving the name of the data (and grouping vector) |
Author(s)
Seija Sirkia, seija.sirkia@iki.fi
References
Taskinen, S., Oja, H., Randles R. (2004) Multivariate Nonparametric Tests of Independence. JASA, 100, 916-925
See Also
Examples
A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3)
X<-matrix(rnorm(3000),ncol=3)%*%t(A)
Y<-cbind(X+runif(3000,-1,1),runif(1000))
sr.indep.test(X,Y)
#alternative calls:
Z<-cbind(X,Y)
colnames(Z)<-c("a1","a2","a3","b1","b2","b3","b4")
g<-factor(c(rep(1,3),rep(2,4)))
sr.indep.test(Z,g=g)
sr.indep.test(Z,g=c("b"),regexp=TRUE)
sr.indep.test(Z,g=1:3)