# NOT RUN {
# library(mclust)
# Fit a gating network mixture of experts model to the ais data
# data(ais)
# mod <- MoE_clust(ais[,3:7], G=1:9, gating= ~ BMI + sex, network.data=ais)
# Convert to the "Mclust" class and examine the classification
# mod2 <- as.Mclust(mod)
# plot(mod2, what="classification")
# Examine the uncertainty
# plot(mod2, what="uncertainty")
# Return the optimal number of clusters according to entropy
# combi <- mclust::clustCombi(object=mod2)
# optim <- mclust::clustCombiOptim(object=combi)
# table(mod2$classification, ais$sex)
# table(optim$cluster.combi, ais$sex)
# While we could have just used plot.MoEClust above,
# plot.Mclust is especially useful for univariate data
# data(CO2data)
# res <- MoE_clust(CO2data$CO2, G=3, equalPro=TRUE, expert = ~ GNP, network.data=CO2data)
# plot(as.Mclust(res))
# }
Run the code above in your browser using DataLab