-
Notifications
You must be signed in to change notification settings - Fork 76
/
index.qmd
43 lines (32 loc) · 4.78 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Introduction to Simulations in R
## 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).
It is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
## Prerequisites
* Have R and RStudio installed. If you don't, follow [these instructions](https://lmu-osc.github.io/Introduction-RStudio-Git-GitHub/installing_software.html).
* Know some R basics (e.g. how to select a value in a data frame, how to create a vector). If you don't, visit the following tutorial: <a href="https://lmu-osc.github.io/introduction-to-R/" target ="_blank">https://lmu-osc.github.io/introduction-to-R/</a>.
## 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).
## Self-paced workshop
### How it works
The self-paced tutorial (pages linked below) will alternate presentation of concepts and simple exercises for you to try to apply them in R. Each time you see written **YOUR TURN**, switch to your local copy of the exercise script (you can choose between a file <a href="https://github.com/lmu-osc/Introduction-Simulations-in-R/blob/main/exercise_script_with_solutions.R" target ="_blank">with</a> or <a href="https://github.com/lmu-osc/Introduction-Simulations-in-R/blob/main/exercise_script_without_solutions.R" target ="_blank">without</a> the solutions depending on e.g. your level of familiarity with R), review the examples if needed, complete the exercise, and check out the proposed answer (which often contains additional tips). Come back to the online tutorial and after finishing one page, you can navigate to the next page linked at the bottom to continue. The exercise script contains code for all the exercises and code that generates the plots that appear in the online tutorial, all in order of appearance in the tutorial.
It is necessary that you work through the sections of the tutorial in order. Please read the blurbs of each section below to get an overview of this workshop. Then click on the first page 'Download the material' and follow along by navigating to the next page linked at the bottom of each page! You can get back to this overview at any time by clicking on the title 'Introduction-Simulations-in-R' at the top of each page.
### Tutorial
* [Download the material](./tutorial_pages/download-repo.qmd) – Get this tutorial onto your machine.
* [Definition](./tutorial_pages/definition.qmd) – What are simulations?
* [Purpose](./tutorial_pages/purpose.qmd) – What can we use simulations for?
* [Basic principles](./tutorial_pages/basic-principles.qmd) – What do we need to create a simulation?
* [Random number generators](./tutorial_pages/random-numbers-generators.qmd) – How to generate random numbers in R?
* [Repeat](./tutorial_pages/repeat.qmd) – How to repeat the generation of random numbers multiple times?
* [Setting the seed](./tutorial_pages/seed.qmd) – How can you generate the same random numbers?
* [Sample size `n`](./tutorial_pages/sample-size-n.qmd) – How many values should you generate within a simulation?
* [Number of repetitions `nrep`](./tutorial_pages/number-of-simulations-nrep.qmd) – How many repeats of a simulation should you run?
* [DRY rule](./tutorial_pages/dry-rule.qmd) – How to write your own functions?
* [Simulate to check alpha](./tutorial_pages/check-alpha.qmd) – Write your first simulation and check the rate of false-positive findings.
* [Simulate to check power](./tutorial_pages/check-power.qmd) – Simulate data to perform a power analysis.
* [Simulate to prepare a preregistration](./tutorial_pages/simulate-for-preregistration.qmd) – Simulate data to test statistical analyses before preregistering them.
* [General structure](./tutorial_pages/general-structure.qmd) – What is the general structure of a simulation?
* [Limitations](./tutorial_pages/limitations.qmd) – What are the limitations of simulations?
* [Real-life example](./tutorial_pages/real-life-example.qmd) – What are real-life examples of simulations?
* [Additional resources](./tutorial_pages/resources.qmd) – What resources can help you write your own simulation?