initz: Initialization of the EM Algorithm

Description Usage Arguments Details Value Examples

View source: R/initz.R

Description

This function returns the mean and standard deviation of each component by using K-means clustering or hierarchical clustering.

Usage

1
initz(x, ncomp, init.method = c("kmeans", "hclust"))

Arguments

x

a numeric vector of the raw data or a three-column matrix of the binned data

ncomp

a positive integer specifying the number of components for a mixture model

init.method

the method used for providing initial values, which can be one of kmeans or hclust.

Details

The function initz returns the mean and standard deviation of each component of a mixture model by using K-means clustering algorithm, or hierarchical clustering method. It is used for automatically selecting initial values for the EM algorithm, so as to enable mixture model selection by bootstrapping likelihood ratio test or using information criteria.

Value

initz returns a list with three items

pi

a numeric vector of component proportions

mu

a numeric vector of component means

sd

a numeric vector of component standard deviations

Examples

1
2
3
4
x <- rmixnormal(500, c(0.5, 0.5), c(2, 5), c(1, 0.7))
data <- bin(x, seq(-2, 8, 0.25))
par1 <- initz(x, 2)
par2 <- initz(data, 2)

mixR documentation built on June 1, 2021, 5:07 p.m.