EM {DEM}R Documentation

The EM algorithm is used to solve the parameter estimation of multivariate Gaussian mixture model.

Description

The EM algorithm is used to solve the parameter estimation of multivariate Gaussian mixture model.

Usage

EM(y, alpha0, mu0, sigma0, i, epsilon)

Arguments

y

is a data matrix

alpha0

is the initial value of the mixing weight

mu0

is the initial value of the mean

sigma0

is the initial value of the covariance

i

is the number of iterations

epsilon

is the threshold value

Value

EMalpha,EMmu,EMsigma,EMtime

Examples

library(mvtnorm)
alpha1= c(rep(1/4,4)) 
mu1=matrix(0,nrow=4,ncol=4) 
for (k in 1:4){
mu1[4,]=c(runif(4,(k-1)*3,k*3)) 
}
sigma1=list()
for (k in 1:4){
sigma1[[k]]= diag(4)*0.1
}
y= matrix(0,nrow=200,ncol=4) 
for(k in 1:4){
y[c(((k-1)*200/4+1):(k*200/4)),] = rmvnorm(200/4,mu1[k,],sigma1[[k]]) 
}
alpha0= alpha1
mu0=mu1
sigma0=sigma1
i=10
epsilon=0.005
EM(y,alpha0,mu0,sigma0,i,epsilon)

[Package DEM version 0.0.0.2 Index]