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. 9, 2024, 5:10 p.m.