batchmix-package | R Documentation |
Semi-supervised and unsupervised Bayesian mixture models that simultaneously infer the cluster/class structure and a batch correction. Densities available are the multivariate normal and the multivariate t. The model sampler is implemented in C++. This package is aimed at analysis of low-dimensional data generated across several batches. See (Coleman et al. (2022))[https://doi.org/10.1101/2022.01.14.476352] for details of the model.
Stephen Coleman <stcolema@tcd.ie>, Paul D.W. Kirk, Chris Wallace
Useful links:
# Data in a matrix format
X <- matrix(c(rnorm(100, 0, 1), rnorm(100, 3, 1)), ncol = 2, byrow = TRUE)
# Initial labelling
labels <- c(
rep(1, 10),
sample(c(1, 2), size = 40, replace = TRUE),
rep(2, 10),
sample(c(1, 2), size = 40, replace = TRUE)
)
# Which labels are observed
fixed <- c(rep(1, 10), rep(0, 40), rep(1, 10), rep(0, 40))
# Batch
batch_vec <- sample(seq(1, 5), replace = TRUE, size = 100)
# Sampling parameters
R <- 1000
thin <- 50
# Classification
samples <- runBatchMix(X,
R,
thin,
batch_vec,
"MVN",
initial_labels = labels,
fixed = fixed,
)
# Clustering
samples <- runBatchMix(X, R, thin, batch_vec, "MVT")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.