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).
## 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. |
Of course, the user is always encouraged to use the dedicated plot
function for objects of the "MoEClust"
class instead, but calling plot
after converting via as.Mclust
can be particularly useful for univariate mixtures.
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.
An object of class "Mclust"
. See methods(class="Mclust")
for a (non-exhaustive) list of functions which can be applied to this class.
Mixing proportions are averaged over observations in components in the presence of gating network covariates during the coercion.
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"
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
, expert_covar
, MoE_control
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.