Learn R Programming

batchmix

Downloads from CRAN in the past month:

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) for details of the model.

Advice on using the package

The main functions a user should be aware of are runMCMCChains, plotLikelihoods, plotAcceptanceRates, continueChains and processChains.

Parameters are sampled using Metropolis-Hastings so checking that the acceptance rate is important. We recommend aiming for acceptance rates between 0.1 and 0.5 for the class and batch means and batch scales ($\mu_k$, $m_b$ and $S_b$ respectively). In our testing, an acceptance rate of at least 0.4 for the class covariance matrices tended to suggest the sampler is exploring well, but smaller values were frequently associated with poor behaviour. The degrees of freedom tend to have very high acceptance rates in our testing regardless of the sampling window.

We recommend running a small number of chains for a small number of iterations to assess the acceptance rates before committing the computational resourcces to run a full analysis.

For an example of a workflow please see the short vignette.

Copy Link

Version

Install

install.packages('batchmix')

Monthly Downloads

295

Version

2.2.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Stephen Coleman

Last Published

May 21st, 2024

Functions in batchmix (2.2.1)

plotSampledBatchMeans

Plot sampled batch means
getSampledClusterMeans

Get sampled cluster means
generateInitialLabels

Generate initial labels
createSimilarityMat

Create Similarity Matrix
getLikelihood

Get likelihood
minVI

Minimium VI
runBatchMix

Run Batch Mixture Model
generateBatchDataLogPoisson

Generate batch data
prepareInitialParameters

Prepare initial values
plotSampledClusterMeans

Plot sampled cluster means
predictFromMultipleChains

Predict from multiple MCMC chains
predictClass

Predict class
plotSampledParameter

Plot sampled vector parameter
generateBatchDataMVT

Generate batch data from a multivariate t distribution
invGammaLogLikelihood

Inverse gamma log-likelihood
runMCMCChains

Run MCMC Chains
plotSampledBatchScales

Plot sampled batch scales
sampleMVN

Sample mixture of multivariate normal distributions with batch effects
sampleSemisupervisedMVN

Sample semi-supervised MVN Mixture model
sampleMVT

Sample mixture of multivariate t-distributions with batch effects
samplePriorLabels

Sample prior labels
processMCMCChain

Process MCMC chain
processMCMCChains

Process MCMC chains
rStickBreakingPrior

Random Draw From Stick Breaking Prior
wishartLogLikelihood

Wishart log-likelihood
sampleSemisupervisedMVT

Sample semi-supervised MVT Mixture model
collectAcceptanceRates

Collect acceptance rate
continueChains

Continue chains
calcAllocProb

Calculate allocation probabilities
batchmix-package

Bayesian Mixture Modelling for Joint Model-Based Clustering/Classification and Batch Correction
VI.lb

Minimum VI lower bound
checkDataGenerationInputs

Check data generation inputs
batchSemiSupervisedMixtureModel

Batch semisupervised mixture model
checkProposalWindows

Check proposal windows
continueChain

Continue chain
generateGroupIDsInSimulator

Generate group IDs
generateBatchData

Generate batch data
generateBatchDataVaryingRepresentation

Generate batch data
gammaLogLikelihood

Gamma log-likelihood
getSampledBatchShift

Get sampled batch shift
getSampledBatchScale

Get sampled batch shift
invWishartLogLikelihood

Inverse-Wishart log-likelihood
plotLikelihoods

Plot likelihoods
plotAcceptanceRates

Plot acceptance rates