remap_canonical2: Canonical re-mapping of mixture component labels

View source: R/remap_canonical2.R

remap_canonical2R Documentation

Canonical re-mapping of mixture component labels

Description

Avoid label switching by re-mapping sampled mixture component labels at each iteration (Peng and Carvhalo 2016).

Usage

remap_canonical2(z)

Arguments

z

A length-n vector of discrete mixture component labels

Value

A length-n vector of mixture component labels re-mapped to a canonical sub-space

Examples

# parameters
n <- 10 # number of observations
K <- 3 # number of clusters (mixture components)
pi <- rep(1/K,K) # cluster membership probability
z <- sample(1:K, size = n, replace = TRUE, prob = pi) # cluster indicators
z <- remap_canonical2(z)

spruce documentation built on March 18, 2022, 7:01 p.m.