[R] mixture models/latent class regression comparison
Christian Hennig
chrish at stats.ucl.ac.uk
Mon Feb 28 17:21:52 CET 2011
Dear Carson,
I have never used mmlcr for this, but quite generally when fitting such
models, the likelihood has often very many local optima. This means that
the result of the EM (or a similar) algorithm depends on the
initialisation, which in flexmix (and perhaps also in mmlcr) is done in a
random fashion. This means that results may differ even if the same method
is applied twice, and unfortunately, depending on the dataset, the result
may be quite unstable. This may explain that the two functions give you
strongly different results, not of course implying that one of them is
generally better.
Best regards,
Christian
On Mon, 28 Feb 2011, Carson Farmer wrote:
> Dear list,
>
> I have been comparing the outputs of two packages for latent class
> regression, namely 'flexmix', and 'mmlcr'. What I have noticed is that
> the flexmix package appears to come up with a much better fit than the
> mmlcr package (based on logLik, AIC, BIC, and visual inspection). Has
> anyone else observed such behaviour? Has anyone else been successful
> in using the mmlcr package? I ask because I am interested in latent
> class negative binomial regression, which the mmlcr package appears to
> support, however, the results for basic Poisson latent class
> regression appear to be inferior to the results from flexmix. Below is
> a simple reproducible example to illustrate the comparison:
>
> library(flexmix)
> library(mmlcr)
> data(NPreg) # from package flexmix
> m1 <- flexmix(yp ~ x, k=2, data=NPreg, model=FLXMRglm(family='poisson'))
> NPreg$id <- 1:200 # mmlcr requires an id column
> m2 <- mmlcr(outer=~1|id, components=list(list(formula=yp~x,
> class="poisonce")), data=NPreg, n.groups=2)
>
> # summary and coefficients for flexmix model
> summary(m1)
> summary(refit(m1))
>
> # summary and coefficients for mmlcr model
> summary(m2)
> m2
>
> Regards,
>
> Carson
>
> P.S. I have attached a copy of the mmlcr package with a modified
> mmlcr.poisonce function due to errors in the version available here:
> http://cran.r-project.org/src/contrib/Archive/mmlcr/. See also
> http://jeldi.com/Members/jthacher/tips-and-tricks/programs/r/mmlcr
> section "Bugs?" subsection "Poisson".
>
> --
> Carson J. Q. Farmer
> ISSP Doctoral Fellow
> National Centre for Geocomputation
> National University of Ireland, Maynooth,
> http://www.carsonfarmer.com/
>
*** --- ***
Christian Hennig
University College London, Department of Statistical Science
Gower St., London WC1E 6BT, phone +44 207 679 1698
chrish at stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche
More information about the R-help
mailing list