R/ari.R

Defines functions ari

Documented in ari

ari <-
function(x,y){
  x <- as.vector(x)
  y <- as.vector(y)
  xx <- outer(x, x, "==")
  yy <- outer(y, y, "==")
  upper <- row(xx) < col(xx)
  xx <- xx[upper]
  yy <- yy[upper]
  a <- sum(as.numeric(xx & yy))
  b <- sum(as.numeric(xx & !yy))
  c <- sum(as.numeric(!xx & yy))
  d <- sum(as.numeric(!xx & !yy))
  ni <- (b + a)
  nj <- (c + a)
  abcd <- a + b + c + d
  q <- (ni * nj)/abcd
  ari <- (a - q)/((ni + nj)/2 - q)
  ari
}

Try the funLBM package in your browser

Any scripts or data that you put into this service are public.

funLBM documentation built on April 11, 2022, 5:06 p.m.