Search
Question: Prior Control with Mclust package
0
gravatar for mabdulsa
17 months ago by
mabdulsa0
mabdulsa0 wrote:

I've just started using R a couple of weeks ago and I'm new to programming.

I'm doing some EM algorithm clustering using the Mclust package provided in R. This seems to be exactly what I need, however the number of clusters that I get when I run it is more than I expect. I assume that my problem can be solved using prior control, but whenever I use the script

mclustBIC(mydata, prior = priorControl())

I get the following error message:

Error in chol.default(priorParams$scale) : 
  the leading minor of order 3 is not positive definite

Here's an example showing how prior control works:

treesBIC <- mclustBIC(trees) # default (no prior)
plot(treesBIC, legendArgs = list(x = "bottom", ncol = 2, cex = .75))

treesBICprior <- mclustBIC(trees, prior = priorControl()) # with prior
plot(treesBICprior, legendArgs = list(x = "bottom", ncol = 2, cex = .75))

 

ADD COMMENTlink modified 17 months ago by Aedin Culhane510 • written 17 months ago by mabdulsa0
0
gravatar for Aedin Culhane
17 months ago by
Aedin Culhane510
United States
Aedin Culhane510 wrote:

Hi 

Try specifying G. The default is 9.

 

G is an integer vector specifying the numbers of mixture components (clusters) for which the BIC is to be calculated. The default is G=1:9, unless the argument x is specified, in which case the default is taken from the values associated with x.

 

Best
Aedin

ADD COMMENTlink written 17 months ago by Aedin Culhane510
0
gravatar for Aedin Culhane
17 months ago by
Aedin Culhane510
United States
Aedin Culhane510 wrote:

Sorry mean to give example code

With 5 cluster, G=1:5

testdata<-iris[,-5]

tt<- mclustBIC(testdata, G = 1:5)

plot(tt)

 

Default is 9 clusters.. G=1:9

 plot(mclustBIC(testdata))

ADD COMMENTlink written 17 months ago by Aedin Culhane510

Hi Aedin,

Actually I wanted the code to run G from 1 to 9, and give me the optimal G from the highest BIC value.

If I execute the code without prior control, it runs fine without any errors, but the output is a large number of clusters, higher than expected. I was hoping that prior control can regularize my data, and the output will be a more accurate and lower number of clusters.

Thanks, I really appreciate your input.

 

ADD REPLYlink written 17 months ago by mabdulsa0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 308 users visited in the last hour