MoE_clust | R Documentation |
Fits MoEClust models: Gaussian Mixture of Experts models with GPCM/mclust-family covariance structures. In other words, performs model-based clustering via the EM/CEM algorithm where covariates are allowed to enter neither, either, or both the mixing proportions (gating network) and/or component densities (expert network) of a Gaussian Parsimonious Clustering Model, with or without an additional noise component. Additional arguments are available via the function MoE_control
, including the specification of a noise component, controls on the initialisation of the algorithm, and more.
MoE_clust(data,
G = 1:9,
modelNames = NULL,
gating = ~1,
expert = ~1,
control = MoE_control(...),
network.data = NULL,
...)
## S3 method for class 'MoEClust'
print(x,
digits = 3L,
...)
## S3 method for class 'MoEClust'
summary(object,
classification = TRUE,
parameters = FALSE,
networks = FALSE,
...)
data |
A numeric vector, matrix, or data frame of observations. Categorical variables are not allowed. If a matrix or data frame, rows correspond to observations and columns correspond to variables. | ||||||||||||
G |
An integer vector specifying the number(s) of mixture components (clusters) to fit. Defaults to | ||||||||||||
modelNames |
A vector of character strings indicating the models to be fitted in the EM/CEM phase of clustering. With
For single-component models these options reduce to:
For zero-component models with a noise component only the | ||||||||||||
gating |
A | ||||||||||||
expert |
A | ||||||||||||
control |
A list of control parameters for the EM/CEM and other aspects of the algorithm. The defaults are set by a call to | ||||||||||||
network.data |
An optional data frame (or a matrix with named columns) in which to look for the covariates in the | ||||||||||||
... |
An alternative means of passing control parameters directly via the named arguments of | ||||||||||||
x , object , digits , classification , parameters , networks |
Arguments required for the |
The function effectively allows 6 different types of Gaussian Mixture of Experts model (as well as the different models in the GPCM/mclust family, for each): i) the standard finite Gaussian mixture with no covariates, ii) fixed covariates only in the gating network, iii) fixed covariates only in the expert network, iv) the full Mixture of Experts model with fixed covariates entering both the mixing proportions and component densities. By constraining the mixing proportions to be equal (see equalPro
in MoE_control
) two extra special cases are facilitated when gating covariates are excluded.
Note that having the same covariates in both networks is allowed. So too are interactions, transformations, and higher order terms (see formula
): the latter must be specified explicitly using the AsIs
operator (I
). Covariates can be continuous, categorical, logical, or ordinal, but the response must always be continuous.
While model selection in terms of choosing the optimal number of components and the GPCM/mclust model type is performed within MoE_clust
, using one of the criterion
options within MoE_control
, choosing between multiple fits with different combinations of covariates or different initialisation settings can be done by supplying objects of class "MoEClust"
to MoE_compare
.
A list (of class "MoEClust"
) with the following named entries, mostly corresponding to the chosen optimal model (as determined by the criterion
within MoE_control
):
call |
The matched call. |
data |
The input data, as a |
modelName |
A character string denoting the GPCM/mclust model type at which the optimal |
n |
The number of observations in the |
d |
The dimension of the |
G |
The optimal number of mixture components according to |
BIC |
A matrix of all BIC values with |
ICL |
A matrix of all ICL values with |
AIC |
A matrix of all AIC values with |
bic |
The BIC value corresponding to the optimal model. May not necessarily be the optimal BIC. |
icl |
The ICL value corresponding to the optimal model. May not necessarily be the optimal ICL. |
aic |
The AIC value corresponding to the optimal model. May not necessarily be the optimal AIC. |
gating |
An object of class |
expert |
An object of class |
LOGLIK |
A matrix of all maximal log-likelihood values with |
loglik |
The vector of increasing log-likelihood values for every EM/CEM iteration under the optimal model. The last element of this vector is the maximum log-likelihood achieved by the parameters returned at convergence. |
linf |
An asymptotic estimate of the final converged maximised log-likelihood. Returned when |
df |
The number of estimated parameters in the optimal model (i.e. the number of 'used' degrees of freedom). Subtract this number from |
iters |
The total number of EM/CEM iterations for the optimal model. |
hypvol |
The hypervolume parameter for the noise component if required, otherwise set to |
parameters |
A list with the following named components:
|
z |
The final responsibility matrix whose |
classification |
The vector of cluster labels for the chosen model corresponding to |
uncertainty |
The uncertainty associated with the |
net.covs |
A data frame gathering the unique set of covariates used in the |
resid.data |
In the presence of expert network covariates, this is the augmented data actually used in the clustering at convergence, as a list of |
DF |
A matrix giving the numbers of estimated parameters (i.e. the number of 'used' degrees of freedom) for all visited models, with |
ITERS |
A matrix giving the total number of EM/CEM iterations for all visited models, with |
Dedicated plot
, predict
, print
, and summary
functions exist for objects of class "MoEClust"
. The results can be coerced to the "Mclust"
class to access other functions from the mclust package via as.Mclust
.
Where BIC
, ICL
, AIC
, LOGLIK
, DF
and ITERS
contain NA
entries, this corresponds to a model which was not run; for instance a VVV model is never run for single-component models as it is equivalent to EEE. As such, one can consider the value as not really missing, but equivalent to the EEE value. BIC
, ICL
, AIC
, LOGLIK
, DF
and ITERS
all inherit the classes "MoECriterion"
and "mclustBIC", "mclustICL", etc.
, for which dedicated print
, summary
, and plot
methods exist, respectively.
Keefe Murphy - <keefe.murphy@mu.ie>
Murphy, K. and Murphy, T. B. (2020). Gaussian parsimonious clustering models with covariates and a noise component. Advances in Data Analysis and Classification, 14(2): 293-325. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11634-019-00373-8")}>.
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.
See MoE_stepwise
for identifying the optimal model and its covariates via greedy forward stepwise selection.
MoE_control
, MoE_compare
, plot.MoEClust
, predict.MoEClust
, predict.MoE_gating
, predict.MoE_expert
, as.Mclust
, MoE_crit
, MoE_estep
, MoE_cstep
, MoE_dens
, mclustModelNames
, mclustVariance
, expert_covar
, aitken
, I
data(ais)
hema <- ais[,3:7]
sex <- ais$sex
BMI <- ais$BMI
# Fit a standard finite mixture model
m1 <- MoE_clust(hema, G=2:3)
# Allow covariates to enter the mixing proportions
m2 <- MoE_clust(hema, G=2:3, gating= ~ sex + BMI)
# Allow covariates to enter the component densities
m3 <- MoE_clust(hema, G=2:3, expert= ~ sex)
# Allow covariates to enter both the gating & expert network
m4 <- MoE_clust(hema, G=2:3, gating= ~ BMI, expert= ~ sex)
# Fit an equal mixing proportion model with an expert network covariate
m5 <- MoE_clust(hema, G=2:3, expert= ~ sex + BMI, equalPro=TRUE)
# Fit models with gating covariates & an additional noise component
m6 <- MoE_clust(hema, G=2:3, tau0=0.1, gating= ~ BMI, network.data=ais)
# Extract the model with highest BIC
(comp <- MoE_compare(m1, m2, m3, m4, m5, m6, criterion="bic"))
# See if a better model can be found using greedy forward stepwise selection
(step <- MoE_stepwise(ais[,3:7], ais))
(comp <- MoE_compare(comp, step, optimal.only=TRUE))
(best <- comp$optimal)
(summ <- summary(best, classification=TRUE, parameters=TRUE, networks=TRUE))
# Examine the expert network in greater detail
# (but refrain from inferring statistical significance!)
summary(best$expert)
# Visualise the results, incl. the gating network and log-likelihood
plot(best, what="gpairs")
plot(best, what="gating") # equal mixing proportions!
plot(best, what="loglik")
# Visualise the results using the 'lattice' library
z <- factor(best$classification, labels=paste0("Cluster", seq_len(best$G)))
lattice::splom(~ hema | sex, groups=z)
lattice::splom(~ hema | z, groups=sex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.