The {squidSim} R package

The {squidSim} R package is designed to simplify data simulation from a highly flexible set of models, including:

  • Correlated and interacting predictor variables
  • Non-Gaussian response variables (Poisson and binomial)
  • Crossed and nested hierarchical structures
  • Random intercepts and slopes
  • Univariate and multivariate data
  • Within level-specific residual variance (DHGLMs)
  • Additive genetic effects (animal models)
  • Phylogenetic effects with different models of evolution
  • Temporal and spatial autocorrelation
  • Missing data (MNAR, MAR and MCAR)
  • Temporal sampling

The main idea is that anything you can model using a linear mixed effect model framework (assuming underlying multivariate normality) you can simulate using the {squidSim} package.

Why use {squidSim}?

Starting with simulations can seem like a daunting task. The {squidSim} R package is designed to facilitate that transition, and to focus attention on the data structure and parameters needed for simulation, rather than programming knowledge.

{squidSim} also provides a useful tool for experienced programmers. One problematic aspect of collaborative coding (or reviewing someone else’s code) is that many people have very contrasting programming styles. A major motivation for the {squidSim} package is that it provides a consistent framework for simulations, which can be interpreted by many people rather than having to decipher someone’s personal code.

Using the vignette

If you are new to using the {squidSim} package, we recommend that you read Sections 1 and 2 to familiarise yourself with the {squidSim} package before moving onto the more advanced topics. The later sections assume an certain level of understanding of how the functions work.

The vignette assumes that you have a working knowledge of R, in particular being comfortable using vectors, matrices and lists.

Installation

The {squidSim} package is currently only available on github:

devtools::install_github("squidgroup/squidSim")
library(squidSim)

Issues and bugs

It would be great if you could report any suggestions, issues or bugs; here for issues relating to the package, and here for issues relating to this vignette. It is worth checking to see if anyone else has a similar problem first, and adding comments to their issue, before starting a new one.