Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion about.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ google-scholar: true

## Contributors

This site was authored by Malika Ihle, based on materials from Joel Pick, Hadley Wickham, and Kevin Hallgren, with contributions from James Smith.
This site was authored by Malika Ihle, based on materials from Joel Pick, Hadley Wickham, and Kevin Hallgren [@hallgren2013], with contributions from James Smith.

## Licenses

Expand Down
7 changes: 5 additions & 2 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library(xml2)
```

## About this work
This tutorial was created by [Malika Ihle](https://www.osc.uni-muenchen.de/about_us/coordinator/index.html) based on materials from [Joel Pick](https://joelpick.github.io/), [Hadley Wickham](https://www.yumpu.com/en/document/view/19077330/simulation-hadley-wickham), and [Kevin Hallgren](https://doi.org/10.20982/tqmp.09.2.p043), with contributions from [James Smith](https://github.com/worcjamessmith).
This tutorial was created by [Malika Ihle](https://www.osc.uni-muenchen.de/about_us/coordinator/index.html) based on materials from [Joel Pick](https://joelpick.github.io/), [Hadley Wickham](https://www.yumpu.com/en/document/view/19077330/simulation-hadley-wickham), and Kevin Hallgren [@hallgren2013], with contributions from [James Smith](https://github.com/worcjamessmith).
It is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).

## Prerequisites
Expand All @@ -22,7 +22,7 @@ It is licensed under a [Creative Commons Attribution-ShareAlike 4.0 Internationa
## Prior to the session: optional preparation to get familiarised with the subject
1) Watch this [30-minute introduction to credible research](https://osf.io/xtmek/), which contextualises the importance of simulations for reliable research.

2) Read [Hallgren, A. K. (2013). Conducting simulation studies in the R programming environment. *Tutorials in Quantitative Methods for Psychology*, *9*(2), 43–60](https://doi.org/10.20982/tqmp.09.2.p043).
2) Read *Conducting simulation studies in the R programming environment* [@hallgren2013].

## Self-paced workshop
### How it works
Expand Down Expand Up @@ -77,4 +77,7 @@ It is necessary that you work through the sections of the tutorial in order. Ple

::::

## References

::: {#refs}
:::
76 changes: 76 additions & 0 deletions references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,79 @@ @book{callahan2026
doi = {10.5281/zenodo.21263721},
url = {https://github.com/lmu-osc/tutorial-template}
}

@article{hallgren2013,
title = {Conducting Simulation Studies in the {R} Programming Environment},
author = {Hallgren, Kevin A.},
year = {2013},
journal = {Tutorials in Quantitative Methods for Psychology},
volume = {9},
number = {2},
pages = {43--60},
doi = {10.20982/tqmp.09.2.p043}
}

@article{ihle2019,
title = {Measuring Up to Reality: Null Models and Analysis Simulations to Study Parental Coordination Over Provisioning Offspring},
author = {Ihle, Malika and Pick, Joel L. and Winney, Isabel S. and Nakagawa, Shinichi and Burke, Terry},
year = {2019},
journal = {Frontiers in Ecology and Evolution},
volume = {7},
pages = {142},
doi = {10.3389/fevo.2019.00142}
}

@article{blanco2020,
title = {Effect of an editorial intervention to improve the completeness of reporting of randomised trials: a randomised controlled trial},
author = {Blanco, David and Schroter, Sara and Aldcroft, Adrian and Moher, David and Boutron, Isabelle and Kirkham, Jamie J. and Cobo, Erik},
year = {2020},
journal = {BMJ Open},
volume = {10},
number = {5},
pages = {e036799},
doi = {10.1136/bmjopen-2020-036799}
}

@article{johnson2015,
title = {Power analysis for generalized linear mixed models in ecology and evolution},
author = {Johnson, Paul C. D. and Barry, Sarah J. E. and Ferguson, Heather M. and Müller, Pie},
year = {2015},
journal = {Methods in Ecology and Evolution},
volume = {6},
number = {2},
pages = {133--142},
doi = {10.1111/2041-210X.12306}
}

@article{prive2018,
title = {Efficient analysis of large-scale genome-wide data with two {R} packages: {bigstatsr} and {bigsnpr}},
author = {Privé, Florian and Aschard, Hugues and Ziyatdinov, Andrey and Blum, Michael G. B.},
year = {2018},
journal = {Bioinformatics},
volume = {34},
number = {16},
pages = {2781--2787},
doi = {10.1093/bioinformatics/bty185}
}

@article{ronnegard2016,
title = {Increasing the power of genome wide association studies in natural populations using repeated measures -- evaluation and implementation},
author = {Rönnegård, Lars and McFarlane, S. Eryn and Husby, Arild and Kawakami, Takeshi and Ellegren, Hans and Qvarnström, Anna},
year = {2016},
journal = {Methods in Ecology and Evolution},
volume = {7},
number = {7},
pages = {792--799},
doi = {10.1111/2041-210X.12535}
}

@article{winsor2020,
title = {Methods for independently manipulating palatability and color in small insect prey},
author = {Winsor, Alex M. and Ihle, Malika and Taylor, Lisa A.},
year = {2020},
journal = {PLOS ONE},
volume = {15},
number = {4},
pages = {e0231205},
doi = {10.1371/journal.pone.0231205}
}
7 changes: 4 additions & 3 deletions tutorial-pages/check-alpha.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ It is important to note that, although `alpha = 0.05` is commonly used, this is

Although it isn't necessary to check that a statistical analysis as simple as a *t*-test does not yield more than 5% false-positive results, in situations where the structure of the data is complex and analysed with more advanced models (e.g., when explanatory variables are mathematically linked to each other, are combined in a mixed-effect model, or your data deviates from assumptions of the statistical model), this may allow to compare different modelling approaches and select one that does not produce more than 5% false-positive results.

Such a complex example, where simulation is the only viable approach to construct a statistical model that does not lead to spurious effects, can be found in this paper:
Such a complex example, where simulation is the only viable approach to construct a statistical model that does not lead to spurious effects, can be found in @ihle2019.

* Ihle, M., Pick, J. L., Winney, I. S., Nakagawa, S., & Burke, T. (2019). Measuring Up to Reality: Null Models and Analysis Simulations to Study Parental Coordination Over Provisioning Offspring. *Frontiers in Ecology and Evolution*, *7*, 142. <a href="https://doi.org/10.3389/fevo.2019.00142" target="_blank">https://doi.org/10.3389/fevo.2019.00142</a>

***

## References


::: {#refs}
:::
7 changes: 4 additions & 3 deletions tutorial-pages/check-power.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,16 @@ Using simulations for power analysis is not really necessary for simple examples

When analyses become complex and it is hard or impossible to determine a sample size analytically (i.e. you can't calculate it, or there's no suitable function to use), then simulations are an indispensable tool.

A simple example of a power analysis like the one you've just done can be found in the "Power analysis" section of this paper:
A simple example of a power analysis like the one you've just done can be found in the "Power analysis" section of @blanco2020.

* 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. <a href="https://doi.org/10.1136/bmjopen-2020-036799" target="_blank">https://doi.org/10.1136/bmjopen-2020-036799</a>

A complete self-paced tutorial to simulate data for power analysis of complex statistical designs can be found here:

* <a href="https://lmu-osc.github.io/Simulations-for-Advanced-Power-Analyses/" target="_blank">https://lmu-osc.github.io/Simulations-for-Advanced-Power-Analyses/</a>

***

## References


::: {#refs}
:::
5 changes: 4 additions & 1 deletion tutorial-pages/real-life-example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is a walk through one relatively simple simulation written to check whether
* A generalized linear model based on a contingency table of counts (Poisson distribution).
* A generalized linear model with one line per observation and the occurrence of the variable of interest coded as 'Yes' or 'No' (binomial distribution).

I created this code while preparing my preregistration for a simple behavioural ecology experiment about methods for independently manipulating palatability and colour in small insect prey ([article](https://doi.org/10.1371/journal.pone.0231205), [OSF preregistration](https://osf.io/f8uk9?view_only=3943e7bb9c5f4effbf119ca5b062fe80)).
I created this code while preparing my preregistration for a simple behavioural ecology experiment about methods for independently manipulating palatability and colour in small insect prey [@winsor2020] ([OSF preregistration](https://osf.io/f8uk9?view_only=3943e7bb9c5f4effbf119ca5b062fe80)).

The R script screenshot below, `glm-freq-vs-yn.R`, can be found in the folder [ihle-2020](https://github.com/lmu-osc/Introduction-Simulations-in-R/tree/main/ihle-2020).

Expand Down Expand Up @@ -60,4 +60,7 @@ This walkthrough will use the steps as defined on the page '[General structure](

***

## References

::: {#refs}
:::
14 changes: 8 additions & 6 deletions tutorial-pages/resources.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: "Resources"

## 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](https://doi.org/10.20982/tqmp.09.2.p043), contains accompanying R scripts and CSV data files which you can peruse in the [hallgren-2013](https://github.com/lmu-osc/Introduction-Simulations-in-R/tree/main/hallgren-2013) folder of this repository. It contains:
The article suggested for getting familiarised with the topic prior to the session, i.e. *Conducting simulation studies in the R programming environment* [@hallgren2013], contains accompanying R scripts and CSV data files which you can peruse in the [hallgren-2013](https://github.com/lmu-osc/Introduction-Simulations-in-R/tree/main/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`.
Expand All @@ -19,17 +19,17 @@ The article suggested for getting familiarised with the topic prior to the sessi

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. <a href="https://doi.org/10.1111/2041-210X.12306" target="_blank">https://doi.org/10.1111/2041-210X.12306</a>
* Power analysis for **generalized linear mixed models** in ecology and evolution [@johnson2015].

* 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. <a href="https://doi.org/10.1136/bmjopen-2020-036799" target="_blank">https://doi.org/10.1136/bmjopen-2020-036799</a>
* Effect of an editorial intervention to improve the completeness of reporting of randomised trials: a randomised controlled trial [@blanco2020].
* 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. <a href="https://aosmith.rbind.io/2018/08/29/getting-started-simulating-data/" target="_blank">https://aosmith.rbind.io/2018/08/29/getting-started-simulating-data/</a>
* 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. <a href="https://doi.org/10.1093/bioinformatics/bty185" target="_blank">https://doi.org/10.1093/bioinformatics/bty185</a>
* Efficient analysis of **large-scale genome-wide data** with two R packages: `bigstatsr` and `bigsnpr` [@prive2018].

* 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. <a href="https://doi.org/10.1111/2041-210X.12535" target="_blank">https://doi.org/10.1111/2041-210X.12535</a>
* Increasing the **power of genome wide association** studies in natural populations using repeated measures – evaluation and implementation [@ronnegard2016].

* Dalpiaz, D. (2020). *Applied Statistics with R*, section "Simulating SLR" in the chapter "**Simple Linear Regression**". <a href="https://daviddalpiaz.github.io/appliedstats/simple-linear-regression.html#simulating-slr" target="_blank">https://daviddalpiaz.github.io/appliedstats/simple-linear-regression.html#simulating-slr</a>

Expand All @@ -51,5 +51,7 @@ Depending on the type of simulation that would be useful for you, these articles

***

## References


::: {#refs}
:::
Loading