library(GUniFrac)
library(quantreg)
library(PearsonDS)
library(MiRKAT)
data(throat.tree)
data(throat.otu.tab)
## Create UniFrac and Bray-Curtis distance matrices
unifracs = GUniFrac(throat.otu.tab, throat.tree, alpha = c(1))$unifracs
if (requireNamespace("vegan")) {
library(vegan)
BC= as.matrix(vegdist(throat.otu.tab, method="bray"))
Ds = list(w = unifracs[,,"d_1"], uw = unifracs[,,"d_UW"], BC = BC)
} else {
Ds = list(w = unifracs[,,"d_1"], uw = unifracs[,,"d_UW"])
}
## Convert to kernels
Ks = lapply(Ds, FUN = function(d) D2K(d))
covar = cbind(throat.meta$Age, as.numeric(throat.meta$Sex == "Male"))
n = nrow(throat.meta)
y = rnorm(n)
result = MiRKAT.iQ(y, X = covar, K = Ks)
Run the code above in your browser using DataLab