flexmix

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

flexmix

R Project
Hi,

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

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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: flexmix

Uwe Ligges-2

Can you please stop sending mails from "R Project"? Please identify
yourself and don't call yourself "R Project".

Uwe Ligges




On 23.04.2013 22:54, R Project wrote:

> Hi,
>
> 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
>
> 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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Regression and FMMs with flexmix

Robin Tviet




I am repeating this because it seems that some people think it is important to reveal your identity I don;t understand why this is so important.   Hopefuly now this list will be helpful.

Could someone please assist with this


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

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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Regression and FMMs with flexmix

Ingmar Visser
Robin,

On Wed, Apr 24, 2013 at 11:24 AM, Robin Tviet <[hidden email]>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]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.