我正在尝试使用mclust包中的Mclust函数进行潜在类建模。基于糖尿病数据的小插图(https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html)中描述的示例就像一个魅力,但如果我在我自己的数据上使用它,我会得到非常奇怪的结果。 以下是我的数据:
> head(example)
HI01_01 HI01_02 HI01_03 HI01_07 HI01_08 HI01_09 HI01_10 HI01_12
1 4 3 3 2 2 1 1 1
2 7 7 7 7 6 1 1 1
3 7 7 7 7 7 7 7 7
4 7 7 5 7 4 4 5 3
5 1 4 2 5 4 1 1 1
6 2 1 1 1 1 1 1 1
> str(example)
'data.frame': 281 obs. of 8 variables:
$ HI01_01: num 4 7 7 7 1 2 5 7 6 4 ...
$ HI01_02: num 3 7 7 7 4 1 5 7 5 2 ...
$ HI01_03: num 3 7 7 5 2 1 2 7 6 3 ...
$ HI01_07: num 2 7 7 7 5 1 1 7 1 3 ...
$ HI01_08: num 2 6 7 4 4 1 1 5 1 1 ...
$ HI01_09: num 1 1 7 4 1 1 1 3 1 1 ...
$ HI01_10: num 1 1 7 5 1 1 1 3 1 5 ...
$ HI01_12: num 1 1 7 3 1 1 1 1 1 1 ...
所以这是我对mclust模型的输出 - 为什么我会为sigma获得这些疯狂的差异?
> model1<-Mclust(example)
> summary(model1, parameters = TRUE)
----------------------------------------------------
Gaussian finite mixture model fitted by EM algorithm
----------------------------------------------------
Mclust EVE (ellipsoidal, equal volume and orientation) model with 3
components:
log.likelihood n df BIC ICL
-3155.324 281 76 -6739.163 -6754.531
Clustering table:
1 2 3
160 91 30
Mixing probabilities:
1 2 3
0.5508364 0.3273966 0.1217670
Means:
[,1] [,2] [,3]
HI01_12 1.000000 3.129923 1.601780
HI01_09 1.519193 3.751240 2.171865
HI01_10 1.810760 4.080920 2.408739
HI01_02 4.577985 5.857100 5.651912
HI01_03 4.781808 6.233245 5.932055
HI01_01 4.895485 6.157288 5.796994
HI01_07 3.512875 6.664422 4.115287
HI01_08 2.243201 5.831780 2.115159
Variances:
[,,1]
[end of output deleted because the variances table was too wide and I
could not get it to look like in my output; however all values ranged
between values like -1.279519e+308 and inf]
我根据模型得到其他代码的错误消息:
> plot(model1, what = "classification")
Error in eigen(sigma, symmetric = TRUE) :
infinite or missing values in 'x'
我不知道发生了什么。谁能给我建议我在这里做错了什么?