Robin, On Wed, Apr 24, 2013 at 11:24 AM, Robin Tviet <robintv...@outlook.com>wrote:
> > I am trying to understand how to use the flexmix package, I have read the > Leisch paper but am very unclear what is needed for the M-step driver. I > am just fitting a simple linear regression model. The documentation is far > from clear what the FLXmclust function does, but, it in principle could do > all I need, however, I do not get sentible results as if I try the > following the result is poor: > > x<-c() > for(i in > 0:99){x$y[2*i]=(0+i);x$x[2*i]=i;x$x[2*i+1]=i;x$y[2*i+1]=i+1000;x$g[2*i]=1;x$g[2*i+1]=2} > m1<-flexmix(y~x ,data=x,k=2) > table(x$g,m1@cluster) > > 1 2 > 1 25 74 > 2 67 33 > there is no correlation between x and y, nor within groups, nor between groups so not sure why your model would make sense; the following model runs just (although it also depends on starting values whether the result is the 2 expected clusters or 1 large cluster of all the data): > set.seed(1) > m1<-flexmix(y~1 ,data=x,k=2) > m1 Call: flexmix(formula = y ~ 1, data = x, k = 2) Cluster sizes: 1 2 99 100 convergence after 2 iterations hth, Ingmar > > It all depends on the randomised starting values. So I think I need a > better "driver", but, I cannot find a spec for what I have to do in the > driver. > > Where is FLXmclust documented? can anyone assist? > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.