Parallelize automatic model selection using glmulti and Rmpi

glmulti is a Java-based package for automated model selection and model-averaging. It provides a wrapper to select optimized glm’s and other model functions with specified response and explanatory variables based on an information criterion (AIC, AICc or BIC). With an increasing number of potential explanatory variables the number of candidate models increases exponentially making an exhaustive screening of the candidates computationally intensive and time-consuming. The package-related article by Calcagno & de Mazancourt (2010) in the Journal of Statistical Software gives a general overview about model selection and the way how this can be achieved using the package glmulti.

To speed up this process the function glmulti already provides two variables (chunk and chunks) to split the model selection process into subprocesses. The results of the subprocesses can be stored as objects of the S4 class glmulti to join the results and select the overall “best” models using the function consenus. The parallelization of the computations can be achived through a variety of methods, but here I want to present a possibility using the R-package Rmpi, an interface to MPI (Message-Passing Interface). The Acadia Centre for Mathematical Modelling and Computation provides a very nice tutorial about the use of Rmpi, describing three different methods including example scripts. I applied the Task Pull method to a working example from the original article by Calcagno & de Mazancourt (2010) based on the birth weight dataset provided by the MASS package. In the following script you will find the outcome of a combination of the task pull approach from the Rmpi tutorial and the real data example, given in chapter 3.3 of the research article by Calcagno & de Mazancourt (2010). I hope you are able to re-use it for your personal needs and speed up your computations, too.

These scripts were developed as part of my employment at the Federal Institute of Hydrology (BfG) in Koblenz, Germany.


Leave a Reply

Your email address will not be published. Required fields are marked *