lab_switching {mimiSBM}R Documentation

Label Switching

Description

This function can be used to perturb a clustering vector in order to randomly associate certain individuals with another cluster.

Usage

lab_switching(Z, p_out = 0.1)

Arguments

Z

a clustering vector

p_out

a probability of perturbation for the clustering

Value

a perturbed clustering vector

Examples

Z <- sample(1:4,100,replace=TRUE)
p = 0.1
Z_pert <- lab_switching(Z,p)
table("Initial clustering" = Z,"Perturbed clustering" = Z_pert)

[Package mimiSBM version 0.0.1.3 Index]