我使用Mclust函数(来自mclust包)来执行混合高斯光晕。数据集由21000多行和10列组成。
我收到以下错误:
Error in svd(shape.o, nu = 0) : infinite or missing values in 'x'
奇怪的是: 1)我已经检查过NaN,Inf等,但没有 2)如果我为9个变量运行模型它运行良好,当我添加一个var我得到了错误。我试过了一组不同的附加变量,但得到了同样的错误...
你知道出了什么问题吗? 非常感谢。编辑变量
> str(data_scaled[data_subset, model_variables])
'data.frame': 21304 obs. of 12 variables:
$ PROD_ALL_OR_NOTHING_PERC: num -0.064 -0.064 -0.064 -0.064 0.141 ...
$ PROD_CASH_3_PERC : num -0.212 -0.212 -0.212 1.303 0.686 ...
$ PROD_CASH_4_PERC : num -0.18 -0.18 -0.18 1.09 8.75 ...
$ PROD_EINSTANTS_PERC : num -0.502 0.68 2.329 -0.582 -0.582 ...
$ PROD_FANTASY_5_PERC : num -0.6517 -0.5562 -0.4928 0.0267 -0.6517 ...
$ PROD_GEORGIA_5_PERC : num -0.0563 -0.0563 -0.0563 -0.0563 6.3148 ...
$ PROD_KENO_PERC : num 2.208 1.125 -0.664 0.624 -0.664 ...
$ PROD_MEGA_MILLION_PERC : num -0.687 -0.687 -0.687 -0.523 -0.687 ...
$ PROD_POWERBALL_PERC : num -0.886 -0.886 -0.514 -0.682 -0.886 ...
$ AVG_WAGER : num -0.136 -0.422 -0.416 -0.467 -0.582 ...
$ DEPOSIT_AMOUNT : num 0.3984 0.0928 -0.1745 0.8043 1.2674 ...
$ DEPOSIT_NUM : num 0.485 0.955 -0.22 1.659 3.773 ...
> summary(data_scaled[data_subset, model_variables])
PROD_ALL_OR_NOTHING_PERC PROD_CASH_3_PERC PROD_CASH_4_PERC PROD_EINSTANTS_PERC PROD_FANTASY_5_PERC
Min. :-0.06402 Min. :-0.2122 Min. :-0.1801 Min. :-0.5819 Min. :-0.6517
1st Qu.:-0.06402 1st Qu.:-0.2122 1st Qu.:-0.1801 1st Qu.:-0.5819 1st Qu.:-0.6517
Median :-0.06402 Median :-0.2122 Median :-0.1801 Median :-0.5819 Median :-0.5146
Mean : 0.00000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000
3rd Qu.:-0.06402 3rd Qu.:-0.2122 3rd Qu.:-0.1801 3rd Qu.: 0.1934 3rd Qu.: 0.3021
Max. :33.08348 Max. : 7.3222 Max. :11.5193 Max. : 2.8354 Max. : 3.6404
PROD_GEORGIA_5_PERC PROD_KENO_PERC PROD_MEGA_MILLION_PERC PROD_POWERBALL_PERC AVG_WAGER
Min. :-0.05627 Min. :-0.6644 Min. :-0.6873 Min. :-0.8861 Min. :-0.62837
1st Qu.:-0.05627 1st Qu.:-0.6644 1st Qu.:-0.6873 1st Qu.:-0.8861 1st Qu.:-0.45222
Median :-0.05627 Median :-0.6644 Median :-0.4302 Median :-0.4078 Median :-0.29270
Mean : 0.00000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.00000
3rd Qu.:-0.05627 3rd Qu.: 0.4445 3rd Qu.: 0.3513 3rd Qu.: 0.6892 3rd Qu.: 0.07956
Max. :60.46933 Max. : 2.2766 Max. : 4.3167 Max. : 2.4615 Max. :31.21876
DEPOSIT_AMOUNT DEPOSIT_NUM
Min. :-0.1746 Min. :-0.2198
1st Qu.:-0.1746 1st Qu.:-0.2198
Median :-0.1746 Median :-0.2198
Mean : 0.0000 Mean : 0.0000
3rd Qu.:-0.1746 3rd Qu.:-0.2198
Max. :36.2089 Max. :23.5029
答案 0 :(得分:-1)
r似乎不喜欢太接近零的数字。我发现,如果您将参数乘以10或更多,就可以避免错误
BICCtrSD = mclustBIC(Ipsative)
fitting ...
|========= | 18%Error in svd(shape.o, nu = 0) : infinite or missing values in 'x'
BICCtrSD = mclustBIC(Ipsative*10)
fitting ...
|=================================================| 100%
但是请不要忘记,在查看结果统计信息时您已经转换了数据。
这本身可能不是解决方案,而是更多技巧。