library(mclust)
# Fit a gating network mixture of experts model to the ais data
data(ais)
mod <- MoE_clust(ais[,3:7], G=3, gating= ~ BMI + sex, modelNames="EEE", 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)
# Compare plot.MoEClust and plot.Mclust for univariate mixtures
data(CO2data)
res <- MoE_clust(CO2data$CO2, G=2, expert = ~ GNP, modelNames="V", network.data=CO2data)
plot(as.Mclust(res), what="classification")
plot(as.Mclust(res), what="density")
plot(as.Mclust(res), what="uncertainty")
# Proper version of what="density" plot:
MoE_gpairs(res, show.map=FALSE, cov.ind=0, show.dens=TRUE)
# Equivalent what="uncertainty" plot:
MoE_Uncertainty(res)
Run the code above in your browser using DataLab