Function to test for equality of location in the C sample case using Oja signs and ranks.
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,...)
a numeric data frame or matrix in the two sample case.
a numeric data frame or matrix in the two sample case.
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.
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.
options are “rank” for the Oja rank test, “sign” for the Oja sign test. The sign test is the default.
defines the method used for the computation of the p-value. The possibilities are “approximation” (default) or “permutation”.
if “method
= permutation” specifies this the number of replications used in the
permutation procedure.
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)”.
an optional vector specifying a subset of observations to be used for the testing.
a function which indicates what should happen when the data contain 'NA's. Default is to fail.
A list with class 'htest' containing the following components:
the value of the Q-statistic.
the degrees of freedom for the Q-statistic or the number of replications in the permutation procedure.
the p-value for the test.
the specified hypothesized value of the difference in location. (only in the two sample case)
a character string with the value 'two.sided'. (only in the two sample case)
a character string indicating what type of test was performed.
a character string giving the name of the data.
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.
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).
# 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