rococo.test-methods {rococo} | R Documentation |
Robust Gamma Rank Correlation Test
Description
Methods performing a robust gamma rank correlation test
Usage
## S4 method for signature 'numeric,numeric'
rococo.test(x, y,
similarity=c("linear", "exp", "gauss",
"epstol", "classical"),
tnorm="min", r=0, numtests=1000, storeValues=FALSE,
exact=FALSE, alternative=c("two.sided", "less", "greater"),
noVarReturnZero=TRUE)
## S4 method for signature 'formula,data.frame'
rococo.test(x, y, na.action, ...)
Arguments
x |
a numeric vector or a formula; compulsory argument |
y |
compulsory argument; if |
similarity |
a character string or a character vector identifying
which type of similarity measure to use; see |
tnorm |
t-norm used for aggregating results; see |
r |
numeric vector defining the tolerances to be used;
see |
numtests |
number of random shuffles to perform; see details below. |
storeValues |
logical indicating whether the vector of test
statistics should be stored in the output object (in slot
|
exact |
logical indicating whether exact p-value should be computed; see details below. |
alternative |
indicates the alternative hypothesis and must be one of
|
noVarReturnZero |
if |
na.action |
a function which indicates what should happen when the data
contain |
... |
all parameters specified are forwarded internally to the
method |
Details
If called for numeric vectors, rococo.test
computes the
robust gamma rank correlation coefficient of x
and y
according to the specified parameters (see rococo
) and
then performs a permutation test to compute a p-value.
If exact=TRUE
, rococo.test
attempts to compute an exact
p-value and ignores the numtests
argument. This is done by
considering all possible permutations and computing the ratio of
permutations for which the test statistic is at least as large/small
as the test statistic for unshuffled data. This works only for 10 or
less samples. Otherwise exact=TRUE
is ignored, a warning is
issued and random shuffles are considered to estimate the p-value (as
follows next).
If exact=FALSE
, numtests
random shuffles of y
are
performed and the empirical standard deviation of the robust gamma
correlation values for these shuffled data sets is computed.
Under the assumption that these values are normally distributed around
mean zero, the p-value is then computed from this distribution in the
usual way.
Note that a too small choice of the number of shuffles (parameter
numtests
) leads to unreliable p-values.
If rococo.test
is called for a formula x
and a data
frame y
, then the method checks whether the formula x
correctly
extracts two columns from y
(see examples below). If so, the
two columns are extracted and the robust gamma rank correlation test
is applied to them according to the specified parameters.
Note that exact=TRUE
may result in long computation times for
user-defined t-norms.
Value
Upon successful completion, the function returns an object of class
RococoTestResults
containing the results.
Author(s)
Martin Krone and Ulrich Bodenhofer
References
https://github.com/UBod/rococo
U. Bodenhofer, M. Krone, and F. Klawonn (2013). Testing noisy numerical data for monotonic association. Inform. Sci. 245:21-37. DOI: doi:10.1016/j.ins.2012.11.026.
U. Bodenhofer and F. Klawonn (2008). Robust rank correlation coefficients on the basis of fuzzy orderings: initial steps. Mathware Soft Comput. 15(1):5-20.
See Also
Examples
## create data
f <- function(x) ifelse(x > 0.9, x - 0.9, ifelse(x < -0.9, x + 0.9, 0))
x <- rnorm(25)
y <- f(x) + rnorm(25, sd=0.1)
## perform correlation tests
rococo.test(x, y, similarity="classical", alternative="greater")
rococo.test(x, y, similarity="linear", alternative="greater")
rococo.test(x, y, similarity=c("classical", "gauss"), r=c(0, 0.1),
alternative="greater", numtests=10000)
## the formula variant
require(datasets)
data(iris)
rococo.test(~ Petal.Width + Petal.Length, iris, similarity="linear",
alternative="two.sided")