I am developing model-based clustering.

First, I developed model-based clustering in R using "mclust." Next, I wanted to take 75% of the sample, re-run model-based clustering and compare the results with the results from the entire dataset using variation of information or rand index. However, I am getting stuck with the codes.

Here are the codes made available for variation of information on CRAN.

cl1 <-sample(1:30, 10, replace=TRUE)
cl2 <- c(cl1[1:5], sample(1:3, 5, replace=TRUE))
vi.dist(cl1,cl2, parts=TRUE)

Here is how I developed my clustering solutions:

model <-Mclust(data[,18:22])

model based clustering solution using entire dataset and data is the name of my dataset using columns 18 to 22

random <- data[rbinom(nrow(data), 1,.75)==1,]

developed a random sample

randommodel <-Mclust(random[,18:22])

model-based clustering using the random sample

cl1 <- (model$classification)
cl2 <- (randommodel$classification)

my attempt at variation of information using R codes, result failed because cl1 and cl2 are not the same length.

So, how do I make the two solutions the same length given that the two solutions have a different number of observations? Or, am I trying to use variation of information incorrectly?


1 Answer 1


clustering with entire database

modela <-Mclust(data[,18:22])
summary(modela, parameters = TRUE)

clustering using 75% of data

subsample <- sample(1:nrow(data), 530, replace=FALSE)
mysample <-data[subsample,]
modelb <-Mclust(mysample[,18:22])
summary(modelb, parameters = TRUE)

adjusted rand index


variation of information

  • $\begingroup$ Can someone check to see if these codes for comparing the results of clustering when including the entire dataset and when including just 75% of the dataset (i.e., 530 is 75% of the dataset in this case)? $\endgroup$ Commented Dec 4, 2014 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.