(obj <- MW.nm10) # "the Claw" -- m = 6 components
length(pp <- nM2par(obj)) # 17 == (3*6) - 1
par2norMix(pp)
## really the same as the initial \code{obj} (see below)
## Log likelihood (of very artificial data):
llnorMix(pp, x = seq(-2, 2, length=1000))
## of more realistic data:
x <- rnorMix(1000, obj)
llnorMix(pp, x)
## Consistency check :
stopifnot(all.equal(pp, nM2par(par2norMix(pp)), tol= 1e-15),
all.equal(obj, par2norMix(nM2par(obj)),
check.attributes=FALSE, tol=1e-15),
## Direct computation of log-likelihood:
all.equal(sum(dnorMix(x, obj, log=TRUE)),
llnorMix(pp, x), tol= 1e-15) )
Run the code above in your browser using DataLab