mxnormal {lazy.cluster}R Documentation

Fitting Finite Mixture of Normal Distributions

Description

Fitting Finite Mixture of Normal Distributions

Usage

mxnormal(X, ncl, rho, mu, Sigma, maxiter = 100, eps = 1e-05, print = 0,
  debug = 0)

Arguments

X

Input data matrix: nobs x nvar

ncl

# of components to be mixed

rho

vector of mixing proportions

mu

ncl x nvar matrix of means

Sigma

nvar x nvar x ncl array of Dispersion matrices

maxiter

max # of iterations

eps

criterion for the relative improvement of lmlh

print

= 1 to print the result

debug

= 1 to print the intermediate result

Details

This function uses EM algorithm to estimate the parameters of a finite mixture of ncl normal distribtuions.
The parameters, namely, rho, mu and Sigma, must have the initial values.

Value

A list of
rho: vector of mixing proportions
mu: ncl x nvar matrix of means
Sigma: nvar x nvar x ncl array of Dispersion matrices
lmlh: log marginal likelihood maximized
cluster: classification vector of observations
H: posterior probability matrix

Examples

# initial by kmeans
ncl=2
# data=as.matrix(circle2[,1,drop=0])
data=circle2
resk=kmeans( data, ncl )
rho=resk$size/sum(resk$size)
mu=resk$centers
var=resk$tot.withinss/sum(resk$size)
Disp=var*diag(ncol(mu))
Sigma=t(repmat(t(Disp),ncl))
dim(Sigma)=c(ncol(mu),ncol(mu),ncl)
resm=mxnormal( data, ncl, rho, mu, Sigma, print=1 )


[Package lazy.cluster version 0.1.4 Index]