Learn R Programming

OjaNP (version 1.0-0)

ojaCsampleTest: 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, …)

# S3 method for default ojaCsampleTest(X, Y, mu = NULL, scores = "sign", p = 1, method = "approximation", n.simu = 1000, center = "ojaMedian", na.action = na.fail, ...)

# S3 method for 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.

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.

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.

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<U+00F6>tt<U+00F6>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<U+00F6>tt<U+00F6>nen, J. and Oja, H. (2003), Affine equivariant multivariat rank methods, Journal of Statistical Planning and Inference, 114, 161--185.

Fischer D, Mosler K, M<U+00F6>tt<U+00F6>nen J, Nordhausen K, Pokotylo O and Vogel D (2020). <U+201C>Computing the Oja Median in R: The Package OjaNP.<U+201D> Journal of Statistical Software, 92(8), pp. 1-36. doi: 10.18637/jss.v092.i08 (URL: http://doi.org/10.18637/jss.v092.i08).

See Also

ojaSign, ojaRank, oja1sampleTest

Examples

Run this code
# NOT RUN {
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")
ojaCsampleTest(X,Y, method="p", alg="exact")
ojaCsampleTest(cbind(comp.1, comp.2) ~ group, score="r", data=biochem)
# }

Run the code above in your browser using DataLab