Model-based clustering

You can use the mclust package.

Below is univariate example; a mixture of gaussians both with sd = 5, the first mean is 100 and the second 115.

require(mclust)

x  = c(rnorm(200,100,5),rnorm(500,115,5))
c = Mclust(x)

par(mfrow = c(2,2))
plot(c, data = x1)
par(mfrow = c(1,1))

A picture:

mclust_pic.png

We can also estimate the mean and variance components:

> me("V",x,c$z)$parameters$mean
  1   2 
102 116 
> me("V",x,c$z)$parameters$variance$sigmasq
[1] 32 21

For more info, type ?MClust and ?me

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License