locationtests: Spatial sign and rank tests of multivariate location

Location testsR Documentation

Spatial sign and rank tests of multivariate location

Description

Multivariate tests of location of one or more samples based on spatial signs and (signed) ranks. In case of one sample the null hypothesis about a given location is tested. In case of several samples the null hypothesis is that all samples have the same location.

Usage

 sr.loc.test(X, Y = NULL, g = NULL, score = c("sign", "rank"),
nullvalue = NULL, 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 groups (may contain just one level)

score

a character string indicating which transformation of the observations should be used

nullvalue

location to be tested in the one sample case (ignored if there is more than one sample)

cond

logical. Should the conditionally distribution free test be used? (Ignored if score is "rank")

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.

...

further arguments to be passed to other functions

Details

X should contain the the whole data set and g should describe the groups, or, if there is only one group, g may be missing. Alternatively, if there are two samples X may contain only the first sample while the second sample is given in Y and g is ignored. Note that in the one sample case when rank is chosen as score the function in fact uses signed ranks.

Note that the conditionally distribution free p-value is only provided for the sign based version of the test.

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 (common) location

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

Oja, H., Randles R. (2004) Multivariate Nonparametric Tests. Statistical Science 19, 598-605.

See Also

Spatial signs and ranks

Examples

A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3)
X<-rbind(matrix(rnorm(1500),ncol=3),matrix(rnorm(750)+1,ncol=3))%*%t(A)
sr.loc.test(X,cond=TRUE)
X[1:250,]<-X[1:250,]+1
g<-factor(rep(c(1,2,3),each=250))
sr.loc.test(X,g=g,score="rank")

SpatialNP documentation built on March 18, 2022, 8:02 p.m.