phicoef {GenomicRanges} | R Documentation |
Calculate the "phi coefficient" between two binary variables
Description
The phicoef
function calculates the "phi coefficient" between
two binary variables.
Usage
phicoef(x, y=NULL)
Arguments
x , y |
Two logical vectors of the same length.
If |
Value
The "phi coefficient" between the two binary variables. This is a single numeric value ranging from -1 to +1.
Author(s)
H. Pagès
References
http://en.wikipedia.org/wiki/Phi_coefficient
Examples
set.seed(33)
x <- sample(c(TRUE, FALSE), 100, replace=TRUE)
y <- sample(c(TRUE, FALSE), 100, replace=TRUE)
phicoef(x, y)
phicoef(rep(x, 10), c(rep(x, 9), y))
stopifnot(phicoef(table(x, y)) == phicoef(x, y))
stopifnot(phicoef(y, x) == phicoef(x, y))
stopifnot(phicoef(x, !y) == - phicoef(x, y))
stopifnot(phicoef(x, x) == 1)
[Package GenomicRanges version 1.48.0 Index]