# Our new R package

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As part of the work she’s doing for her PhD, Christina has done some (fairly major, I’d say!) review of the literature about prevalence studies on PCOS $-$ that’s a rather serious, albeit probably fair to say quite under-researched area. **Gianluca Baio's blog**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

When it came to analysing the data she had collected, naturally I directed her towards doing some Bayesian modelling. In many cases, these are not too complicated $-$ often the outcome is binary and so “fixed” or “random” effect models are fairly simple to structure and run. One interesting point was that, because there often wasn’t very good or comprehensive evidence, setting up the model using some reasonable (and, crucially, fairly easy to elicit from clinicians) prior information did help in obtaining more stable estimates.

So, because we (she) have spent quite a lot of time working on this, I thought it would be good to structure all this into a R package. All of our models are actually run using JAGS as interfaced using the package R2jags and, I think, the nice idea is that in R the user can specify the kind of model they want to use. Our package, which incidentally is called bmeta, then builds a suitable model file for the assumptions selected in terms of outcome data and priors and then runs it via R2jags. The model file that is generated is automatically saved on the user’s computer and can then be re-used as a template or modified as necessary (eg to include different priors or more complex structures).

Currently, Christina has implemented 22 models (ie combinations of data model and prior, including variations of fixed vs random effects) and in the package we have also implemented several graphical diagnostics, including:

- forest plots to visualise the level of pooling of the data
- funnel plots to examine publication bias
- diagnostics plots to examine convergence of the underlying MCMC algorithm

The package will be on CRAN in the next couple of days, but it’s already downloadable from this webpage. We’ll also put some more structured manual/guide shortly.

To

**leave a comment**for the author, please follow the link and comment on their blog:**Gianluca Baio's blog**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.