14/10/2026
Important
Before completing this session, please carefully read about the prerequisites.
| Prerequisite | Description | Link/Where to find it |
|---|---|---|
| R and RStudio installed | Latest versions of both R and RStudio | Download RStudio |
| R basics | e.g., how to select a value in a data frame, how to create a vector | OSC tutorial link |
| Familiarity with basic statistical concepts | e.g., hypothesis testing, descriptive statistics, data analysis | Cheatsheet Link |
How confident are you in defining what a “simulation” is in the context of scientific research?
Not confident.
Somewhat confident.
Confident.
Very confident
Simulations are often used in research to… (Select all you think apply)
Generate artificial data
Visualize complex statistical concepts
Replace all statistical analyses
Test how models perform under different scenarios
No clue
How familiar are you with the concept of “power” in statistics?
I have never heard of it
I heard the term before, but do not know what it means
I understand the basics of “power”
I am comfortable with calculating power
Power analysis is important for research because… (Select all you think apply)
It helps determine how many samples you need
It ensures studies always find significant results
It helps you design more reliable studies
It explains all statistical results
No clue
How comfortable are you with performing simulations in R?
Very uncomfortable
Somewhat uncomfortable
Neutral
Somewhat comfortable
Very comfortable
What do we see in the results?
At the end of this session, you should be able to:
Let’s flip a coin
Imagine you want to flip a coin 100 times, and see the results.
Actually flipping the coin -> Pretend to flip in mind…
And write down the results each time.
This pretending is called a simulation.
Your turn!
Get in a pair, first imagine flipping a coin 100 times and note how many heads and tails you expect. Then, discuss why doing this pretend experiment first is useful for planning a real study.
What ideas have you come up with during the previous activity?
To build “good feeling” about data (intuition)
To understand chances (probability)
To check if an experiment is strong enough (power)
To practice before the real experiment (planning)
To contribute to open research (transparency)

Your turn!
Time to apply the simulation process to your coin-flip experiment. Get in your pair, and discuss each step according to your experiment.
For example, if you flip a coin a 10 times (n = 10), your data could be H, T, H, H, T, T, H, T, H, H (random data).
At this point, you should be able to…
Let’s flip the coin again, but how many times?
Power analysis is like figuring out how many times you need to flip a coin -> to be pretty sure you can tell if the coin is fair or not.
Power = your chance of catching the coin’s true nature if it really is biased.
If power = 80% -> you have an 80% chance of spotting a bias if it’s really there.
Power depends on:
The effect size (= how biased the coin might be)
The sample size (= how many times you flip the coin)
The significance level (= how sure you want to be)
Your turn!
Get together in your pair, and discuss why conducting power analysis for your experiment could be useful.
What ideas have you come up with during the previous activity?
Prevents underpowered studies: By helping you determine the minimum sample size, it makes sure you do not do an experiment that is too weak to detect an effect that is there.
Minimizes wasting resources: Helps you figure out the most efficient experimental design, which in terms minimizes wasting time, money or human resources.
Required for transparency and publication: Represents evidence that your experimental plan is thought through, e.g., the sample size, and others can replicate your methods (i.e., in e spirit of Open Research)
Two ways:
Power analysis through a formula = method that uses a mathematical formula to estimate your sample size or effect size (see G*Power). For example, the formula could be used to quickly estimate your required sample size for your experiment. Works best for simple study designs (e.g., one-sample t-test, simple linear regression).
Power analysis through simulations = pretending to do the experiment many times on a computer before actually doing it. You input what you expect to happen (e.g., study design, means, etc.). The experiment “runs” using these parameters and you see how often the simulated experiment correctly detects an effect. Works well for complex study designs (e.g., longitudinal data) and unusual data. (This is today’s focus).

In-class Activity
Time to apply the power analysis process to your coin-flip experiment. Get in your pair, and discuss when and how you would integrate a power analysis.
In this next part, you will familiarize yourself with simulations through hands-on exercices and activities:
Introduction to Simulations in R: Hands-on practical activities
Or follow: https://lmu-osc.github.io/Introduction-Simulations-in-R/
Tip
Since this is a self-paced tutorial, take your time on navigating it; and it can be finished at home as well. We will have a check-in moment at the end of this session.
If you have not completed the tutorial yet:
Complete the rest in your own time.
At this point in time, you should be able to…
Can you imagine using simulations for your work/projects/studies?
Simulations = safe playground: You try your study many times with pretend data, so you learn how your experiment might behave before touching real data.
Power analysis = trial period: You find the “just right” study size, not too small to miss real effects, not too big to waste resources.
Together they’re your research rehearsal: first you imagine the experiment (simulate), then you check if the plan is strong enough (power), and only then you go on stage with real data.
How confident are you in defining what a “simulation” is in the context of scientific research?
Not confident.
Somewhat confident.
Confident.
Very confident
Simulations are often used in research to… (Select all you think apply)
Generate artificial data
Visualize complex statistical concepts
Replace all statistical analysis
Test how models perform under different scenarios
How familiar are you with the concept of “power” in statistics?
I’ve never heard of it
I know the term
I understand the basics
I’m comfortable with calculating power
Power analysis is important for research because… (Select all you think apply)
It helps determine how many samples you need
It ensures studies always find significant results
It helps you design more reliable studies
It explains all statistical results
No clue
How comfortable are you with running basic R code and performing simulations in R?
Very uncomfortable
Somewhat uncomfortable
Neutral
Somewhat comfortable
Very comfortable
What do we see in the results?
Creator: Sharma, Tejaswini (
0009-0000-0305-9751)
Consultant: Ihle, Malika (
0000-0002-3242-5981)
Reviewer: Von Grebmer zu Wolfsthurn, Sarah (
0000-0002-6413-3895)
This work was originally created by Malika Ihle based on materials from Joel Pick, Hadley Wickham, and Kevin Hallgren, with contributions from James Smith. This current work by Tejaswini Sharma, Malika Ihle and Sarah von Grebmer zu Wolfsthurn is licensed under a Creative Commons Attribution 4.0 International SA License (CC-BY-SA 4.0). Code snippets are dedicated to the public domain and licensed under a Creative Commons Universal License (CC0 1.0).
Please cite these materials as: Sharma, T., Ihle, M., & Von Grebmer Zu Wolfsthurn, S. (2026). Introduction to simulations and power analysis in R [Quarto slides]. LMU Open Science Center. https://lmu-osc.github.io/teaching-material-for-novices/open-research-tools/simulations

LMU Open Science Center