mcc: Compute a Mathews Correlation Coefficient

Description Usage Arguments Details Value Examples

View source: R/MatthewCor.R

Description

The function computes a Matthews correlation coefficient for two factors provided to the function. It assumes each factor is a factor of class labels, and the enteries are paired in order of the vectors.

Usage

1
mcc(x, y, nperm = 1000, nthread = 1)

Arguments

x

factor of the same length with the same number of levels

y

factor of the same length with the same number of levels

nperm

numeric number of permutations for significance estimation. If 0, no permutation testing is done

nthread

numeric can parallelize permutation texting using BiocParallels bplapply

Details

Please note: we recommend you call set.seed() before using this function to ensure the reproducibility of your results. Write down the seed number or save it in a script if you intend to use the results in a publication.

Value

A list with the MCC as the $estimate, and p value as $p.value

Examples

1
2
3
x <- factor(c(1,2,1,2,3,1))
y <- factor(c(2,1,1,1,2,2))
mcc(x,y)

Example output

Warning message:
no DISPLAY variable so Tk is not available 
$estimate
[1] -0.452267

$p.value
[1] 0.8

Warning message:
In mcc(x, y) :
  The number of levels x and y was different. Taking the union of all class labels.

PharmacoGx documentation built on Feb. 28, 2021, 2 a.m.