as.Mclust | R Documentation |
Converts an object of class "MoEClust"
generated by MoE_clust
and converts it to an object of class "Mclust"
as generated by fitting Mclust
, to facilitate use of plotting and other functions for the "Mclust"
class within the mclust package. Some caution is advised when converting models with gating &/or expert covariates (see Note below) and users are always encouraged to use the dedicated plot.MoEClust
function for objects of the "MoEClust"
class instead.
## S3 method for class 'MoEClust'
as.Mclust(x,
expert.covar = TRUE,
signif = 0L,
...)
x |
An object of class |
expert.covar |
Logical (defaults to |
signif |
Significance level for outlier removal. Must be a single number in the interval [0, 1). Corresponds to the percentage of data to be considered extreme and therefore removed (half of |
... |
Further arguments to be passed to other methods. |
Mixing proportions are averaged over observations in components in the presence of gating network covariates during the coercion. For models with expert network covariates, the means are given by the posterior means of the fitted values of the expert network.
In the presence of expert network covariates, the component-specific covariance matrices are (by default, via the argument expert.covar
) modified for plotting purposes via the function expert_covar
, in order to account for the extra variability of the means, usually resulting in bigger shapes & sizes for the MVN ellipses.
The signif
argument is intended only to aid visualisation via plot.Mclust
, as plots therein can be sensitive to outliers, particularly with regard to axis limits. However, users are always encouraged to use the dedicated plot.MoEClust
function for objects of the "MoEClust"
class instead (see Note below).
An object of class "Mclust"
. See methods(class="Mclust")
for a (non-exhaustive) list of functions which can be applied to this class.
Plots may be quite misleading in the presence of gating &/or (especially) expert network covariates when the what
argument is "density"
within plot.Mclust
; users are strongly encouraged to use MoE_gpairs
with response.type="density"
&/or show.dens=TRUE
instead.
Predictions (via predict.Mclust
) will also be misleading in the presence of covariates of any kind when newdata
is supplied; thus, users are strongly encouraged to use predict.MoEClust
instead.
The functions clustCombi
and clustCombiOptim
can be safely used (provided as.Mclust(x)
is supplied as the object
argument to clustCombi
), as they only rely on x$z
and x$G
only. See the examples below.
Users may expect MoEClust models with no covariates of any kind to be identical to models fitted via mclust, but this is not necessarily true: see the MoE_control
argument asMclust
.
Keefe Murphy - <keefe.murphy@mu.ie>
Fraley, C. and Raftery, A. E. (2002). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association, 97(458): 611-631.
Scrucca L., Fop M., Murphy T. B. and Raftery A. E. (2016). mclust 5: clustering, classification and density estimation using Gaussian finite mixture models. The R Journal, 8(1): 289-317.
Mclust
, plot.Mclust
, MoE_clust
, plot.MoEClust
, predict.MoEClust
, expert_covar
, MoE_control
, clustCombi
, clustCombiOptim
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.