norMmixMLE {norMmix} | R Documentation |
Maximum Likelihood Estimation for Multivariate Normal Mixtures
Description
Direct Maximum Likelihood Estimation (MLE) for multivariate normal
mixture models "norMmix"
. Starting from a
clara
(package cluster) clustering plus
one M-step by default, or alternatively from the default start of (package)
mclust, perform direct likelihood maximization via optim()
.
Usage
norMmixMLE(x, k,
model = c("EII", "VII", "EEI", "VEI", "EVI",
"VVI", "EEE", "VEE", "EVV", "VVV"),
initFUN = claraInit,
ll = c("nmm", "mvt"),
keep.optr = TRUE, keep.data = keep.optr,
method = "BFGS", maxit = 100, trace = 2,
optREPORT = 10, reltol = sqrt(.Machine$double.eps),
...)
claraInit(x, k, samples = 128,
sampsize = ssClara2kL, trace)
mclVVVinit(x, k, ...)
ssClara2kL(n, k, p)
Arguments
x |
numeric [n x p] matrix |
k |
positive number of components |
model |
a |
initFUN |
a |
ll |
a string specifying the method to be used for the likelihood
computation; the default, |
keep.optr , keep.data |
|
method , maxit , optREPORT , reltol |
arguments for tuning the
optimizer |
trace |
|
... |
|
samples |
the number of subsamples to take in
|
sampsize |
the sample size to take in
|
n , p |
Details
By default, initFUN=claraInit
, uses clara()
and one M-step from EM-algorithm to initialize parameters
after that uses general optimizer optim()
to calculate the MLE.
Value
norMmixMLE
returns an object of class
"norMmixMLE"
which is a list
with components
norMmix |
the |
optr |
(if |
npar |
the number of free parameters, a function of |
n |
the sample size, i.e., the number of observations or rows of |
cond |
the result of (the hidden function) |
x |
(if |
Examples
MW214
set.seed(105)
x <- rnorMmix(1000, MW214)
## Fitting, assuming to know the true model (k=6, "VII")
fm1 <- norMmixMLE(x, k = 6, model = "VII", initFUN=claraInit)
fm1 # {using print.norMmixMLE() method}
fm1M <- norMmixMLE(x, k = 6, model = "VII", initFUN=mclVVVinit)
## Fitting "wrong" overparametrized model: typically need more iterations:
fmW <- norMmixMLE(x, k = 7, model = "VVV", maxit = 200, initFUN=claraInit)
## default maxit=100 is often too small ^^^^^^^^^^^
x <- rnorMmix(2^12, MW51)
fM5 <- norMmixMLE(x, k = 4) # k = 3 is sufficient
fM5
c(logLik = logLik(fM5), AIC = AIC(fM5), BIC = BIC(fM5))
plot(fM5, show.x=FALSE)
plot(fM5, lwd=3, pch.data=".")
# this takes several seconds
fM5big <- norMmixMLE(x, model = "VVV", k = 4, maxit = 300) # k = 3 is sufficient
summary(warnings())
fM5big ; c(logLik = logLik(fM5big), AIC = AIC(fM5big), BIC = BIC(fM5big))
plot(fM5big, show.x=FALSE)