Learn R Programming

CNPBayes (version 1.2.2)

labelSwitching: Calculate proportion of relabeling instances

Description

When fitting an object of class MixtureModel, label switching can occur i.e. the mean of component one can be less than the mean of component two at one iteration of the MCMC sampler and at the next instance, the order is switched. Label switching should be kept at a minimum. This function returns the proportion of MCMC sample iterations where label switching has occurred.

Usage

labelSwitching(object, merge = TRUE)
"labelSwitching"(object, merge = TRUE)

Arguments

object
An object of class MarginalModel or BatchModel
merge
A logical indicating whether the components should be merged before checking for label switching

Value

A single proportion for a MarginalModel or a vector of proportions, one for each batch for a BatchModel

Examples

Run this code
     labelSwitching(MarginalModelExample)

Run the code above in your browser using DataLab