R/multipheno.R

multipheno.T2 <- function(z) {
  z <- as.matrix(z)
  ic <- solve(cor(z, method = "spearman"))
  zic <- z %*% ic
  t2 <- sapply(1:nrow(z), function(idx) return(sum(zic[idx, , drop = TRUE] * z[idx, , drop = TRUE])))
  pval <- pchisq(t2, df = ncol(z), lower.tail = FALSE)
  return(list(T2 = t2, pval = pval))
}

Try the gtx package in your browser

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

gtx documentation built on May 2, 2019, 5:08 a.m.