答案 0 :(得分:3)
查看EMCluster包是否符合您的需求。
install.packages("EMCluster")
# excerpt from pg 12 of the EMCluster manual.
library(EMCluster, quiet = TRUE)
set.seed(1234)
x <- da1$da
ret.em <- init.EM(x, nclass = 2, method = "em.EM")
plotem(ret.em, x)
如果没有,请在R.享受其他Model-based clustering methods。
答案 1 :(得分:2)
MClust软件包包含函数densityMclust,它生成一个对象,其中包含拟合高斯混合模型的参数估计以及密度本身。从MClust手册:
> densWaiting <- densityMclust(faithful$waiting) > summary(densWaiting, parameters = TRUE) ------------------------------------------------------- Density estimation via Gaussian finite mixture modeling ------------------------------------------------------- Mclust E (univariate, equal variance) model with 2 components: log.likelihood n df BIC -1034 272 4 -2090.4 Clustering table: 1 2 99 173 Mixing probabilities: 1 2 0.36102 0.63898 Means: 1 2 54.619 80.094 Variances: 1 2 34.439 34.439 A two-components mixture of Gaussian variables with the same variance is selected by BIC. The parameter estimates can be read from the summary output. A plot of density estimate can be obtained using the corresponding plot method: > plot(densWaiting) The density can also be plotted together with a histogram of the observed data by using the optional argument data: > plot(densWaiting, data = faithful$waiting)