Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I have a data set which has 10 columns of binary data (n = 300) and I'm trying to use flexmix in R in order to explore the data by fitting a series of latent class models to it. The problem I have is that I can't cluster on 3 or more of the variables. Yet, Latent Gold, a nonfree piece of software which can be used for clustering has no problem fitting models when using all 10 columns so I cant but help think that there must be something I am doing wrong.

To give you an idea for the data, if I tabulate it for just 3 of the columns it looks like this:

as.data.frame(table(dat))
  var1 var2 var3 Freq
1    0    0    0  152
2    1    0    0   65
3    0    1    0   10
4    1    1    0   45
5    0    0    1   33
6    1    0    1    8
7    0    1    1    0
8    1    1    1   10

My code when using stepFlexmix looks like this:

sFM <- stepFlexmix(~1, data = dat, k = 1:5, nrep = 5,
  model = list(FLXMRglm(var1 ~ ., family = "binomial"),
               FLXMRglm(var2 ~ ., family = "binomial"),
               FLXMRglm(var3 ~ ., family = "binomial"))
)

which looks pretty similar to what is suggested in the flexmix intro on page 9 here (PDF warning).

The error it then kicks back is this:

*Error in model@preproc.y(model@y) : 
 for the binomial family, y must be a 2 column matrix
 where col 1 is no. successes and col 2 is no. failures

Error in stepFlexmix(~1, data = dat, k = 1:2, nrep = 5,
no convergence to a suitable mixture

Any suggestions or ideas as to how to get this working would be greatly appreciated.

share|improve this question
Are you only asking about where the error is coming from / how to get this done in R? B/c if so, this question is off-topic for CV, & belongs on Stack Overflow instead (you may want to read our FAQ). Please don't cross-post, though (SE strongly discourages this); if you want your Q migrated, flag it for moderator attention. – gung Oct 26 '12 at 18:26

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.