#--- EXAMPLE 1 ------------------------------------------
# \donttest{
data(geyser2)
(out <- tclustIC(geyser2, whichIC="MIXMIX", alpha=0.1))
summary(out)
## Find the smallest value inside the table and write the corresponding
## values of k (number of groups) and c (restriction factor)
inds <- which(out$MIXMIX == min(out$MIXMIX), arr.ind=TRUE)
vals <- out$MIXMIX[inds]
cat("\nThe smallest value of the IC is ", vals,
" and takes place for k=", out$kk[inds[1]], " and c=",
out$cc[inds[2]], "\n")
# }
#--- EXAMPLE 2 ------------------------------------------
# \donttest{
data(flea)
Y <- as.matrix(flea[, 1:(ncol(flea)-1)]) # select only the numeric variables
rownames(Y) <- 1:nrow(Y)
head(Y)
(out <- tclustIC(Y, whichIC="CLACLA", alpha=0.1))
summary(out)
## Find the smallest value inside the table and write the corresponding
## values of k (number of groups) and c (restriction factor)
inds <- which(out$CLACLA == min(out$CLACLA), arr.ind=TRUE)
vals <- out$CLACLA[inds]
cat("\nThe Smallest value of the IC is ", vals,
" and takes place for k=", out$kk[inds[1]], " and c=",
out$cc[inds[2]], "\n")
# }
#--- EXAMPLE 3 ------------------------------------------
# \donttest{
data(swissbank)
(out <- tclustIC(swissbank, whichIC="ALL"))
plot(out) ## --> selecting k=3, c=128
## the selected model
plot(tclust(swissbank, k = 3, alpha = 0.1, restr.fact = 128))
# }
Run the code above in your browser using DataLab