as.Mclust: Convert MoEClust objects to the Mclust class

as.MclustR Documentation

Convert MoEClust objects to the Mclust class

Description

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).

Usage

## S3 method for class 'MoEClust'
as.Mclust(x,
         expert.covar = TRUE,
         signif = 0L,
         ...)

Arguments

x

An object of class "MoEClust" generated by MoE_clust or an object of class "MoECompare" generated by MoE_compare. Models with a noise component are facilitated here too.

expert.covar

Logical (defaults to TRUE) governing whether the extra variability in the component means is added to the MVN ellipses corresponding to the component covariance matrices in the presence of expert network covariates. See the function expert_covar.

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 signif at each endpoint, on a column-wise basis). The default, 0, corresponds to no outlier removal. Only invoke this argument as an aid to visualisation via plot.Mclust.

...

Further arguments to be passed to other methods.

Details

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.

Value

An object of class "Mclust". See methods(class="Mclust") for a (non-exhaustive) list of functions which can be applied to this class.

Note

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.

Author(s)

Keefe Murphy - <keefe.murphy@mu.ie>

References

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.

See Also

Mclust, plot.Mclust, MoE_clust, plot.MoEClust, expert_covar, MoE_control

Examples

# 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))

MoEClust documentation built on May 29, 2024, 6:44 a.m.