Learn R Programming

mimiSBM (version 0.0.1.3)

lab_switching: 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)

Value

a perturbed clustering vector

Arguments

Z

a clustering vector

p_out

a probability of perturbation for the clustering

Examples

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

Run the code above in your browser using DataLab