Npmlreg and Flexmix

July 18, 2010

(This article was first published on Shige's Research Blog, and kindly contributed to R-bloggers)

In my attempt to estimate a mixture regression model for the long-term impact of prenatal famine exposure, I compared results obtained from NPMLREG and Flexmix using the “rainfall” data set came with the package “forward” and was able to achieve identical results from: <- allvc(cbind(Cases, Total-Cases) ~ Rain, random= ~1|ID, data=rainfall, k=2, family=binomial(logit))
m.mix <- stepFlexmix(cbind(Cases, Total-Cases) ~ 1|ID, model=FLXMRglmfix(family=”binomial”, fixed=~Rain), k=2, nrep=5, data=rainfall)
To test the random effect model, I created the new variable ID by:
rainfall$ID <- seq(from=1, to=34, by=1)
With Flexmix, it is possible to go a step further and let the treatment variable to vary between latent groups by: 
m.mix <- stepFlexmix(cbind(Cases, Total-Cases) ~ Rain|ID, model=FLXMRglmfix(family=”binomial”), k=2, nrep=5, data=rainfall)

To leave a comment for the author, please follow the link and comment on their blog: Shige's Research Blog. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)