[R] flexmix and mclust help

osazuta blosic at gmail.com
Fri Dec 4 15:08:32 CET 2009


Hello, 

I'm trying out flexmix and mclust for the first time on some univariate data
which is typically best described as lognormal, but can sometimes be gamma
distributed as well. I first tried using EM on mclust assuming the data was
lognormally distributed and could only get it to work in "E" mode, i.e. the
equal variance mode. I could never get it to work on "V" mode [ the warning
message was 

Warning message:
In meV(data, z = z, prior = prior, control = control, Vinv =
parameters$Vinv,  :
  sigma-squared falls below threshold

]

so I gave up even after trying the two suggestions I encountered on the web
(eliminating zeros in the data and changing the version of R and mclust). 
Does anyone understand what's going on here? My EM script in MATLAB has no
problem with this data, but is slow, which is why I want to use R. 

I then tried to understand and use flexmix assuming the data are actually
better described as a gamma mixture. From what I could understand of the
function call I wrote

flextest <- flexmix( Data ~ unmap(priors_from_kmeans_call$cluster),
data=Data, k = number_clusters, model = FLXMRglm(family = "Gamma" ) )

and found

Error in model.frame.default(model at fullformula, data = data, na.action =
NULL) :
  invalid type (list) for variable 'chr18_test_binned'

I think it wants a "list" (like NPreg in the examples, a "struct" in
MATLAB), but I'm so new at R that I don't really know what I'm doing. 

Can anyone give me a simple example of how take a vector of data and ask it
to perform a gamma mixture EM on it using flexmix, or even more ideally, how
to use do either lognormal or gamma mixtures? Also, are there any lists of
examples that people can use to test agglomerative hclust methods on this
same data (instead of using kmeans) as  initialization for these EM methods?

Thanks a lot for your help. 


-- 
View this message in context: http://n4.nabble.com/flexmix-and-mclust-help-tp948545p948545.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list