1

When running mclustICL (R package mclust 5.3) on data an error occurs:

data <- c(-0.485152666666667, -0.457841666666667, -0.457841666666667, 
-0.457841666666667, -0.457841666666667, -0.457841666666667, -0.457841666666667, 
-0.457841666666667) 
> mclustICL(data, modelNames = "V")
fitting ...
  |=======================================================================================================| 100%
Error in if (sum((out$parameters$pro - colMeans(out$z))^2) > sqrt(.Machine$double.eps)) { : 
  missing value where TRUE/FALSE needed

Rounding solves it:

> mclustICL(round(data,5), modelNames = "V") # no error

But I need to use function mclustICL on other data examples, and then rounding not only doesnt help, but the function works only when I do not use round and throws the same error when i do:

data <- c(-0.241992333333333, -0.287035333333333, -0.33378, -0.272269333333333, 
-0.241992333333333, -0.287035333333333, -0.241992333333333, -0.241992333333333, 
-0.241992333333333, -0.287311, -0.287311, -0.287035333333333)

> mclustICL(data, modelNames = "V")# no error

> mclustICL(round(data,5), modelNames = "V")fitting ...
  |=======================================================================================================| 100%
Error in if (sum((out$parameters$pro - colMeans(out$z))^2) > sqrt(.Machine$double.eps)) { : 
  missing value where TRUE/FALSE needed

What should I do to use the function on both data and why this behaviour happens? Thanks in advance!

Marie
  • 11
  • 3

2 Answers2

0

I don't have your problems, as you can see in the code below.
Do you have the latest version of the package?
Have you look at your data?
Can you guess why only the single mixture component can be fitted?

> library(mclust)
    __  ___________    __  _____________
   /  |/  / ____/ /   / / / / ___/_  __/
  / /|_/ / /   / /   / / / /\__ \ / /   
 / /  / / /___/ /___/ /_/ /___/ // /    
/_/  /_/\____/_____/\____//____//_/    version 5.3
Type 'citation("mclust")' for citing this R package in publications.

> data <- c(-0.485152666666667, -0.457841666666667, -0.457841666666667, 
+ -0.457841666666667, -0.457841666666667, -0.457841666666667, -0.457841666666667, 
+ -0.457841666666667)
> summary(data)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-0.4852 -0.4578 -0.4578 -0.4613 -0.4578 -0.4578 
> dotchart(data)

> mclustBIC(data, modelNames = "V")

Bayesian Information Criterion (BIC):
         V
1 48.44934
2       NA
3       NA
4       NA
5       NA
6       NA
7       NA
8       NA

Top 3 models based on the BIC criterion:
     V,1                   
48.44934       NA       NA 

> mclustICL(data, modelNames = "V")

Integrated Complete-data Likelihood (ICL) criterion:
         V
1 48.44934
2       NA
3       NA
4       NA
5       NA
6       NA
7       NA
8       NA

Top 3 models based on the ICL criterion:
     V,1                   
48.44934       NA       NA 

> data <- c(-0.241992333333333, -0.287035333333333, -0.33378, -0.272269333333333, 
+ -0.241992333333333, -0.287035333333333, -0.241992333333333, -0.241992333333333, 
+ -0.241992333333333, -0.287311, -0.287311, -0.287035333333333)
> summary(data)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-0.3338 -0.2871 -0.2797 -0.2710 -0.2420 -0.2420 
> dotchart(data)

> mclustBIC(data, modelNames = "V")

Bayesian Information Criterion (BIC):
         V
1 46.73079
2       NA
3       NA
4       NA
5       NA
6       NA
7       NA
8       NA
9       NA

Top 3 models based on the BIC criterion:
     V,1                   
46.73079       NA       NA 

> mclustICL(data, modelNames = "V")

Integrated Complete-data Likelihood (ICL) criterion:
         V
1 46.73079
2       NA
3       NA
4       NA
5       NA
6       NA
7       NA
8       NA
9       NA

Top 3 models based on the ICL criterion:
     V,1                   
46.73079       NA       NA 

> mclustICL(round(data,5), modelNames = "V")
Integrated Complete-data Likelihood (ICL) criterion:
         V
1 46.72944
2       NA
3       NA
4       NA
5       NA
6       NA
7       NA
8       NA
9       NA

Top 3 models based on the ICL criterion:
     V,1                   
46.72944       NA       NA 
  • I have just tried it on Windows and your output was reproduced (no errors). But I am usig Ubuntu 14.04 and there still have I the same errors. Version of mclust is 5.3. Sorry, what did you mean with the last question about single component? – Marie Sep 08 '17 at 11:15
  • Sorry but your install of mclust seems to have problems. Maybe the compiler is old, or you linux box is old (more than 3 years). Check also the R release. Question about the single component: if you look carefully you will see that only the model with a single Gaussian component can be fitted. And this depends on your data. Have you look at the graph? – Luca Scrucca Sep 08 '17 at 14:16
0

Upgrading to R 3.4.1. solved the issue. Thanks a lot to Luca Scrucca!

Marie
  • 11
  • 3