Resources
Follow-up self-paced tutorial on simulation of data analyses for advanced power analyses
Hallgren 2013
The article suggested for getting familiarised with the topic prior to the session, i.e. Conducting simulation studies in the R programming environment (Hallgren 2013), contains accompanying R scripts and CSV data files which you can peruse in the hallgren-2013 folder of this repository. It contains:
- Annotated R syntax file for Example 1:
novel-question.R.
- Annotated R syntax file for Example 2:
power-analysis.R.
- Annotated R syntax file for Example 3:
bootstrapping.R.
- CSV dataset generated in Example 1, which is also used later in Example 2:
novel-question-output.csv.
- CSV dataset used in Example 3:
mediation-raw-data.csv.
Other articles
Depending on the type of simulation that would be useful for you, these articles may be of interest:
Power analysis for generalized linear mixed models in ecology and evolution (Johnson et al. 2015).
Effect of an editorial intervention to improve the completeness of reporting of randomised trials: a randomised controlled trial (Blanco et al. 2020).
- In the “Power analysis” section, there is a simple example of a power simulation. R code is provided in the supplementary material.
Muldoon, A. (2018). Getting started simulating data in R: some helpful functions and how to use them. https://aosmith.rbind.io/2018/08/29/getting-started-simulating-data/
- This blog gives a great overview of how to start simulating more complex datasets, including step-by-step explanations of relevant R functions.
Efficient analysis of large-scale genome-wide data with two R packages:
bigstatsrandbigsnpr(Privé et al. 2018).Increasing the power of genome wide association studies in natural populations using repeated measures – evaluation and implementation (Rönnegård et al. 2016).
Dalpiaz, D. (2020). Applied Statistics with R, section “Simulating SLR” in the chapter “Simple Linear Regression”. https://daviddalpiaz.github.io/appliedstats/simple-linear-regression.html#simulating-slr
Use of R packages to run simulations
lme4: Bolker, B. Simulation-based power analysis for mixed models inlme4. https://rpubs.com/bbolker/simpowersimstudy: Goldfeld, K., & Wujciak-Jens, J. Simulating Study Data. https://cran.r-project.org/web/packages/simstudy/vignettes/simstudy.htmlfaux: DeBruine, L. (2023). faux: Simulation for Factorial Designs. https://debruine.github.io/faux/simsem(SIMulated Structural Equation Modeling): Pornprasertmanit, S., Miller, P., Schoemann, A., & Jorgensen, T. Vignette. https://github.com/simsem/simsem/wiki/Vignettesimglm: LeBeau, B. Tidy Simulation withsimglm. https://cran.r-project.org/web/packages/simglm/vignettes/tidy_simulation.htmlpowerlmm: Magnusson, K. (2018). New paper: The consequences of ignoring therapist effects in longitudinal data analysis. https://rpsychologist.com/therapists-effects-longitudinal