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)
}

Try the CovCombR package in your browser

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

CovCombR documentation built on March 26, 2020, 7:15 p.m.