Learn R Programming

rococo (version 1.1.7)

rococo: Robust Gamma Rank Correlation Coefficient

Description

Compute the robust gamma rank correlation coefficient

Usage

rococo(x, y,
       similarity=c("linear", "exp", "gauss", "epstol", "classical"),
       tnorm="min", r=0, noVarReturnZero=TRUE)

Arguments

x

a numeric vector; compulsory argument

y

a numeric vector; compulsory argument; x and y need to have the same length

similarity

a character string or a character vector identifying which type of similarity measure to use; valid values are "linear" (default), "exp", "gauss", "epstol", and "classical" (abbreviations are allowed as long as they are unique). If similarity is a single string, the same similarity measure is taken for x and y. Different similarity measures can be used for x and y by supplying different similarity measures in similarity[1] and similarity[2]. Longer character vectors are allowed, but all but the first two entries are ignored.

tnorm

can be any of the following strings identifying a standard tnorm: "min" (minimum t-norm; default), "prod" (product t-norm), or lukasiewicz (Lukasiewicz t-norm); abbreviations are allowed as long as they are unique. Alternatively, tnorm can be a two-argument function defining a t-norm.

r

numeric vector defining the tolerances to be used; if a single value is supplied, the same value is used both for x and y. If a vector is supplied, r[1] is used as tolerance for x and r[2] is used as tolerance for y. If the classical crisp similarity is used, the corresponding entry/entries in r is/are ignored. Negative values are not allowed. Zeroes have a special meaning: if an entry in r is 0, then the tolerance is automatically adapted to 10 percent of the interquartile range of the data.

noVarReturnZero

if TRUE (default), a correlation of 0 is returned if there is no variation in at least one of the two observables. Otherwise, NA is returned and a warning is issued.

Value

Upon successful completion, the function returns the robust gamma rank correlation coefficient.

Details

rococo computes the robust gamma rank correlation coefficient of x and y according to the specified parameters (see literature for more details).

Note that rococo only works for x and y being numeric vectors, unlike the classical correlation measures implemented in cor which can also be computed for matrices or data frames.

References

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

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.

U. Bodenhofer, M. Krone, and F. Klawonn (2013). Testing noisy numerical data for monotonic association. Inform. Sci. 245:21-37. DOI: 10.1016/j.ins.2012.11.026.

See Also

rococo.test

Examples

Run this code
# NOT RUN {
## 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)

## compute correlation
rococo(x, y, similarity="classical")
rococo(x, y, similarity="linear")
rococo(x, y, similarity=c("classical", "gauss"), r=c(0, 0.1))
# }

Run the code above in your browser using DataLab