###################################
# Generate data
library(GUniFrac)
# Throat microbiome data
data(throat.tree)
data(throat.otu.tab)
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"])
}
Ks = lapply(Ds, FUN = function(d) D2K(d))
# Covariates and outcomes
covar <- matrix(rnorm(120), nrow=60)
S <- rexp(60, 3)   # survival time 
C <- rexp(60, 1)   # censoring time 
D <- (S<=C)        # event indicator
U <- pmin(S, C)    # observed follow-up time
MiRKATS(obstime = U, delta = D, X = covar, Ks = Ks, beta = NULL)
Run the code above in your browser using DataLab