D2K | R Documentation |
Construct kernel matrix from distance matrix.
D2K(D)
D |
An n by n matrix giving pairwise distances or dissimilarites, where n is sample size. |
Converts a distance matrix (matrix of pairwise distances) into a kernel matrix for microbiome data. The kernel matrix is constructed as K = -(I-11'/n)D^2(I-11'/n)/2, where D is the pairwise distance matrix, I is the identity matrix, and 1 is a vector of ones.
D^2 represents element-wise square.
To ensure that K is positive semi-definite, a positive semi-definiteness correction is conducted
An n by n kernel or similarity matrix corresponding to the distance matrix given.
Ni Zhao
Zhao, Ni, et al. "Testing in microbiome-profiling studies with MiRKAT, the microbiome regression-based kernel association test
library(GUniFrac) #Load in data and create a distance matrix data(throat.tree) data(throat.otu.tab) unifracs <- GUniFrac(throat.otu.tab, throat.tree, alpha=c(1))$unifracs D1 <- unifracs[,,"d_1"] #Function call K <- D2K(D1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.