Learn R Programming

rococo (version 1.1.1)

rococo.test-methods: Robust Gamma Rank Correlation Test

Description

Methods performing a robust gamma rank correlation test

Usage

## S3 method for class '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"))
## S3 method for class 'formula,data.frame':
rococo.test(x, y, na.action, ...)

Arguments

x
a numeric vector or a formula; compulsory argument
y
compulsory argument; if x is a vector, y must be vector of the same length as x. If x is a formula, y must be a data frame.
similarity
a character string or a character vector identifying which type of similarity measure to use; see rococo for more details.
tnorm
t-norm used for aggregating results; see rococo for more details.
r
numeric vector defining the tolerances to be used; see rococo for more details.
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 perm.gamma, see RococoTestResults).
exact
logical indicating whether exact p-value should be computed; see details below.
alternative
indicates the alternative hypothesis and must be one of "two.sided", "greater", or "less". Abbreviations are allowed as long as they are unique. "greater" corresponds to positive associat
na.action
a function which indicates what should happen when the data contain NA's. Defaults to getOption("na.action").
...
all parameters specified are forwarded internally to the method rococo.test with signature numeric,numeric.

Value

  • Upon successful completion, the function returns an object of class RococoTestResults containing the results.

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.

References

http://www.bioinf.jku.at/software/rococo/

U. Bodenhofer, M. Krone, and F. Klawonn (2012). Testing noisy numerical data for monotonic association. Inform. Sci., 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

rococo

Examples

Run this code
## 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")

Run the code above in your browser using DataLab