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. Hallgren, A. K. (2013). Conducting simulation studies in the R programming environment. Tutorials in Quantitative Methods for Psychology, 9(2), 43–60, contains accompanying R scripts and CSV data files which you can peruse in the Hallgren2013 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:
Johnson, P. C. D., Barry, S. J. E., Ferguson, H. M., & Müller, P. (2015). Power analysis for generalized linear mixed models in ecology and evolution. Methods in Ecology and Evolution, 6(2), 133–142. https://doi.org/10.1111/2041-210X.12306
Blanco, D., Schroter, S., Aldcroft, A., Moher, D., Boutron, I., Kirkham, J. J., & Cobo, E. (2020). Effect of an editorial intervention to improve the completeness of reporting of randomised trials: a randomised controlled trial. BMJ Open, 10(5), e036799. https://doi.org/10.1136/bmjopen-2020-036799
- 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.
Privé, F., Aschard, H., Ziyatdinov, A., & Blum, M. G. B. (2018). Efficient analysis of large-scale genome-wide data with two R packages: bigstatsr and bigsnpr. Bioinformatics, 34(16), 2781–2787. https://doi.org/10.1093/bioinformatics/bty185
Rönnegård, L., McFarlane, S. E., Husby, A., Kawakami, T., Ellegren, H., & Qvarnström, A. (2016). Increasing the power of genome wide association studies in natural populations using repeated measures – evaluation and implementation. Methods in Ecology and Evolution, 7(7), 792–799. https://doi.org/10.1111/2041-210X.12535
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