R/DisttoKcent.R

Defines functions DisttoKcent

DisttoKcent <- function(D) {
    D <- as.matrix(D^2)
    Pmat <- diag(ncol(D)) - (1/(ncol(D))) * tcrossprod(rep(1, ncol(D)))
    Kcent <- -0.5 * (Pmat %*% (D) %*% Pmat)
    rownames(Kcent) <- colnames(Kcent) <- rownames(D)
    return(Kcent)
}
denizakdemir/CovCombR documentation built on Jan. 15, 2020, 2:03 p.m.