na ja
na ja

Reputation: 45

getting error in mclust-package while working on univariate fit

While working on a univariate fit using Mclust I am getting following error:

Error in mstepE(data = as.matrix(data)[initialization$subset, ], z = z,  : 
  row dimension of z should equal data length

I am using the code mentioned in: https://cran.r-project.org/web/packages/mclust/vignettes/mclust.html#initialisation

This is the code section where I am getting error:

df1 <- dataSample
BIC <- NULL
for(j in 1:20){
  rBIC <- mclustBIC(df1, verbose = T,
                    initialization = list(hcPairs = randomPairs(df1)))
  BIC <- mclustBICupdate(BIC, rBIC)
}
summary(BIC)

Following link contains data to be passed to variable 'df1' (file name:dataSample.csv) https://drive.google.com/open?id=0Bzau9RsRnQreYk9XOWVBSm91b2o4NTQ4RlA2UFdWbDBVOVpR

Upvotes: 0

Views: 297

Answers (1)

na ja
na ja

Reputation: 45

This is the solution I get from one of the Authors (Prof. Luca Scrucca) for 'mclust' library:

"there was a bug due to the use of automatic subset that clash when hcPairs are provided. I have fixed it in the current dev version of mclust. Since submission to CRAN won't happen shortly, you may use the following code to avoid the error with the current release of mclust:

rBIC <- mclustBIC(df1, verbose = T,
                  initialization = list(hcPairs = randomPairs(df1),
                                        subset = 1:NROW(df1)))

When the bug fix will be released, the subset argument could be omitted as it is redundant."

Now, the code is working fine.

Upvotes: 2

Related Questions