MSToolkit - Mango Solutions


MSToolkit is a FREE R package that has been written to help users simulate clinical trials, evaluate designs, analysis methodology and quantify operating characteristics through the application of dose and study level decision criteria.  MSToolkit has been configured to run on a grid and to allow users to perform their analysis in SAS if desired.

  • Users can simulate parallel group, crossover and longitudinal designs.
  • Flexibility in defining data generation processes using parametric models.
  • Data generation model parameters can vary across simulation replicates; parameters can vary between subjects.
  • The data generation function specifies the linear predictor for the mean response given inputs (dose, time, covariates); inverse link functions allow generation of continuous, binary and count data. User-written inverse link functions allow data generation from a variety of other distributions.
  • Model parameters and covariates for each subject / replicate can be generated from multivariate normal distributions or sampled from external data files e.g. existing data files.

The latest formal release of MSToolkit can be downloaded from CRAN (  A development (daily build) version is maintained on R-Forge ( An MSToolkit development page with a details around package installation and usage together with easy to follow examples is maintained at RForge. The developers can be reached at

The MSToolkit package has been written in order to facilitate clinical trial simulation.  Typical usage revolves around two primary functions, generateData and analyzeData.  Most users will start with the generateData(…) function which uses several low level functions in order to specify the design, allocation to treatments, generation of parameters, functional specification for generating data and controlling dropout and missing data. The generateData(…) function creates a directory with the replicate datasets stored as individual .CSV files.

Once data has been generated, the next step is to analyse the replicate data using the analyzeData(…) function.  This function wraps together functions for performing user-specified analysis on the replicate datasets and also performing micro- and macro- level summaries of the analysis results.  Micro-analysis summarises the analytic method at the dose or treatment level, giving the estimated mean, std. error and confidence limits for each dose / treatment and for each interim analysis (if specified).  This allows the user to specify a rule for dropping doses or treatments at interim analysis.  Macro-analysis summarises the analytic method at a study level, applying a user-specified rule to determine success or failure of the trial for assessing the operating characteristics of the trial. An interim analysis can be specified in the generateData(…) function and analysed using the analyzeData(…) function.

Notes: MSToolkit was developed jointly by Mango Solutions and Pfizer Inc. Funding for the project was provided by Pfizer. MSToolkit is covered by the GNU Public License (GPL). (c) 2010. For further details about GNU General Public Licenses see