Dear All, I haven't found a solution to the "variance" problem. However, I could solve the plotting problem by plotting the data myself. I think that the problem is due to a change in the data structure returned by the function Mclust.
The web-page: http://www.childrensmercy.org/stats/weblog2006/UnivariateClustering.asp has been extremely helpful. I paste the code below for people's future reference. par(mfcol=c(1,2),mar=c(2.1,0.1,0.1,0.1)) v <- Mclust(my.data) x0 <- seq(min(my.data),max(my.data),length.out=100) nt <- rep(0,100) plot(range(my.data),c(0,0.15),type="n",xlab=" ",ylab=" ",axes=F, ylim=c(0,0.4) ) axis(side=1) for (i in 1:2) { ni <- v$parameters$pro[i]*dnorm(x0, mean=as.numeric(v$parameters$mean[i]),sd=1) lines(x0,ni,col=1) nt <- nt+ni } lines(x0,nt,lwd=3) segments(my.data,0,my.data,0.02) Best, Emmanuel 2008/10/21 Emmanuel Levy <[EMAIL PROTECTED]>: > After playing with the data, I figured out what the problem is: > I've got many zeros in the dataset, which probably induces the > algorithm to determine a gaussian with variance=0. > > If I remove the zeros it works, but then the decomposition is not as > it should be .... > > Any idea on how to solve this would be great; is it possible to > somehow force the parameters (e.g variance) to be > greater than a particular threshold? > > Thanks, > > Emmanuel > > > > 2008/10/20 Emmanuel Levy <[EMAIL PROTECTED]>: >> Dear list members, >> >> I am using Mclust in order to deconvolute a distribution that I >> believe is a sum of two gaussians. >> >> First I can make a model: >>> my.data.model = Mclust(my.data, modelNames=c("E"), warn=T, G=1:3) >> >> But then, when I try to plot the result, I get the following error: >> >>> mclust1Dplot(my.data.model, parameters = my.data.model$parameters, what = >>> "density") >> Error in to - from : non-numeric argument to binary operator >> >> Also, I'd like to allow for each gaussian to have a different variance >> (modelNmaes=c("V")) , but then I get another error message: >> >>> my.data.model = Mclust(my.data, modelNames=c("V"), warn=T, G=1:3) >> Warning messages: >> 1: In meV(data = data, z = z, prior = prior, control = control, warn = warn) >> : >> sigma-squared falls below threshold >> 2: In meV(data = data, z = z, prior = prior, control = control, warn = warn) >> : >> sigma-squared falls below threshold >> 3: In summary.mclustBIC(Bic, data, G = G, modelNames = modelNames) : >> best model occurs at the min or max # of components considered >> 4: In Mclust(my.data, modelNames = c("V"), warn = T, G = 1:3) : >> optimal number of clusters occurs at min choice >> >> Many thanks in advance for your help, >> >> Best wishes, >> >> Emmanuel >> >> >> If you would like to reproduce the above, the dataset is: >> >> my.data=c( 0.0000,0.0052,0.0000,-0.2136,0.4625,0.6047,0.0000,0.7370,0.5059 >> ,-0.8060,-1.0790,0.0000,-1.5397,-0.0720,-3.2180,-1.6980,0.0000,2.2845 >> ,-1.0741,0.0000,0.1020,-0.6010,0.2210,-0.0120,1.0785,0.0000,-0.4536 >> ,-0.1127,-0.2032,-0.0421,-1.6818,-0.9935,-2.2105,-0.7963,-0.1820,-2.0468 >> ,0.6161,-1.7663,-0.6800,-2.1290,-0.0167,0.0000,0.0000,0.0000,0.5427 >> ,-0.0170,0.0000,0.0000,-0.6576,0.9055,0.1409,-0.1409,0.0000,0.3730 >> ,-0.1800,-1.3141,0.6786,-0.2480,-2.5110,-0.1340,0.3000,-1.7350,0.0000 >> ,-0.5464,0.0000,-0.7513,-1.9056,-1.4823,-0.5376,-0.4516,-1.1391,0.0000 >> ,-2.2560,1.3770,0.3390,-2.6023,-1.0880,-0.1444,0.0000,-0.1459,0.1740 >> ,0.0000,0.3310,0.0749,1.0360,-0.8345,-0.6843,-3.5171,-1.9482,-0.4972 >> ,-0.0130,-2.0290,-0.2812,0.0000,0.0000,-0.0164,0.0000,-1.9220,-1.5941 >> ,-1.0840,0.0000,0.0459,-2.2121,-1.1485,-1.1485,0.0000,-0.4449,-0.5001 >> ,0.3520,1.9980,-3.8385,1.7160,1.0020,-0.2250,-0.8265,-0.2032) >> > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.