R: C Sample Location Test Based on Oja Signs and Ranks
ojaCsampleTest
R Documentation
C Sample Location Test Based on Oja Signs and Ranks
Description
Function to test for equality of location in the C sample case using Oja signs and ranks.
Usage
ojaCsampleTest(X, ...)
## Default S3 method:
ojaCsampleTest(X, Y, mu = NULL, scores = "sign", p = 1,
method = "approximation", n.simu = 1000,
center = "ojaMedian", na.action = na.fail, ...)
## S3 method for class 'formula'
ojaCsampleTest(formula, scores="sign", p = 1,
method = "approximation", n.simu = 1000,
center = "ojaMedian", data, subset, na.action,...)
Arguments
X
a numeric data frame or matrix in the two sample case.
Y
a numeric data frame or matrix in the two sample case.
formula
a formula of the form X ~ g where X
is a numeric matrix with at least two columns giving the data values and g a factor
with at least two levels giving the corresponding groups.
mu
a vector indicating the hypothesized value of the difference
in location. NULL represents no difference between the groups.
For more than two groups mu should be 0 or not be specified at all.
scores
options are “rank” for the Oja rank test, “sign” for the Oja sign test. The sign test is the default.
p
value of “p” to be passed on to ojaSign or ojaRank. The default here is to use all hyperplanes since only then the tests are valid.
This can make the functions quite slow, however.
method
defines the method used for the computation of the p-value. The possibilities are
“approximation” (default) or “permutation”.
n.simu
if “method = permutation” specifies this the number of replications used in the
permutation procedure.
center
value of “center” to be passed on to ojaSign. Is used to center the data matrix. The default is the natural but computationally expansive
Oja median. For other options see the help for ojaSign.
data
an optional data frame, list or environment containing
the variables in the model. If not found in “data”, the
variables are taken from “environment(formula)”.
subset
an optional vector specifying a subset of observations to be
used for the testing.
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 or from methods. Mainly further arguments for ojaSign or ojaRank.
Details
In the C-sample case of the Oja sign test the covariance matrix of the signs is divided by the sample size and not by sample size - 1.
For the sign test version always the Oja median should be used from a theoretical point of view to center the data and the median should be computed using
the exact algorithm. For further details about the the Oja median see ojaMedian.
Note that no theoretical results are available when “p” is not set to 1.
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 in the permutation procedure.
p.value
the p-value for the test.
null.value
the specified hypothesized value of the difference in location. (only in the two sample case)
alternative
a character string with the value 'two.sided'. (only in the two sample case)
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
References
Hettmansperger, T. P. and Oja, H. (1994), Affine invariant multivariate multisample sign test, Journal of the Royal Statistical Society, Series B, 56, 235–249.
Hettmansperger, T. P., M<c3><83><c2><b6>tt<c3><83><c2><b6>nen, J. and Oja, H. (1999), Multivariate affine invariant rank tests for several samples, Statistica Sinica, 8, 785–800.
Visuri, S., Ollila, E., Koivunen, V., M<c3><83><c2><b6>tt<c3><83><c2><b6>nen, J. and Oja, H. (2003), Affine equivariant multivariat rank methods, Journal of Statistical Planning and Inference, 114, 161–185.
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(OjaNP)
Loading required package: ICS
Loading required package: mvtnorm
Loading required package: ICSNP
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/OjaNP/ojaCsampleTest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ojaCsampleTest
> ### Title: C Sample Location Test Based on Oja Signs and Ranks
> ### Aliases: ojaCsampleTest ojaCsampleTest.default ojaCsampleTest.formula
> ### Keywords: htest multivariate nonparametric
>
> ### ** Examples
>
> data(biochem)
> X <- subset(biochem, group=="Control", select=c("comp.1","comp.2"))
> Y <- subset(biochem, group=="Treat", select=c("comp.1","comp.2"))
> ojaCsampleTest(X,Y, alg="exact")
OJA C SAMPLE SIGN TEST
data: X and Y
Q.S = 14.975, df = 2, p-value = 0.0005601
alternative hypothesis: true location difference is not equal to c(0,0)
> ojaCsampleTest(X,Y, method="p", alg="exact")
OJA C SAMPLE SIGN TEST
data: X and Y
Q.S = 14.791, permutations = 1000, p-value < 2.2e-16
alternative hypothesis: true location difference is not equal to c(0,0)
> ojaCsampleTest(cbind(comp.1, comp.2) ~ group, score="r", data=biochem)
OJA C SAMPLE RANK TEST
data: cbind(comp.1, comp.2) by group
Q.R = 15.17, df = 2, p-value = 0.0005079
alternative hypothesis: true location difference is not equal to c(0,0)
>
>
>
>
>
> dev.off()
null device
1
>