Learn R Programming

norMmix (version 0.2-0)

nMm2par: Multivariate Normal Mixture Model to parameter for MLE

Description

From a "norMmix"(-like) object, return the numeric parameter vector in our MLE parametrization.

Usage

nMm2par(obj,
        model = c("EII", "VII", "EEI", "VEI", "EVI",
                  "VVI", "EEE", "VEE", "EVV", "VVV"),
        meanFUN = mean.default,
        checkX = FALSE)

Value

vector containing encoded parameters of the mixture. first, the centered log ratio of the weights, then the means, and then the model specific encoding of the covariances.

Arguments

obj

a list containing

sig:

covariance matrix array,

mu:

mean vector matrix,

w:

= weights,

k:

= number of components,

p:

= dimension

model

a character string specifying the (Sigma) model, one of those listed above.

meanFUN

a function to compute a mean (of variances typically).

checkX

a boolean. check for positive definiteness of covariance matrix.

Details

This transformation forms a vector from the parameters of a normal mixture. These consist of weights, means and covariance matrices.

Covariance matrices are given as D and L from the LDLt decomposition

See Also

the inverse function of nMm2par() is par2nMm().

Examples

Run this code
A <- MW24
nMm2par(A, model = A$model)
# [1] -0.3465736  0.0000000  0.0000000  0.0000000  0.0000000  0.0000000
# [7] -2.3025851

## All MW* models in {norMmix} pkg:
pkg <- "package:norMmix"
lMW <- mget(ls(pattern = "^MW", pkg), envir=as.environment(pkg))
lM.par <- lapply(lMW, nMm2par)
## but these *do* differ  ___ FIXME __ 
modMW <- vapply(lMW, `[[`, "model", FUN.VALUE = "XYZ")
cbind(modMW, lengths(lM.par),  npar = sapply(lMW, npar))[order(modMW),]

Run the code above in your browser using DataLab