R/pcc.R

Defines functions pcc

Documented in pcc

pcc <- function(x) {
  s <- cov( log(x) )
  d <- dim(s)[1]
  down <- diag(s)
  denom <- Rfast::colsums( Rfast::comb_n(down, 2) )
  denom <- Rfast::squareform(denom)
  pcc <- 2 * s / denom
  diag(pcc) <- 1
  pcc
}

Try the Compositional package in your browser

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

Compositional documentation built on Oct. 23, 2023, 5:09 p.m.