lab_switching | R Documentation |
This function can be used to perturb a clustering vector in order to randomly associate certain individuals with another cluster.
lab_switching(Z, p_out = 0.1)
Z |
a clustering vector |
p_out |
a probability of perturbation for the clustering |
a perturbed clustering vector
Z <- sample(1:4,100,replace=TRUE)
p = 0.1
Z_pert <- lab_switching(Z,p)
table("Initial clustering" = Z,"Perturbed clustering" = Z_pert)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.