Statistical power is an increasingly important topic in times when the credibility of a field is questioned by failed replications. Power is directly related to the number of observations, therefore it is used to estimate the required sample size for a study. An increasing number of grant agencies and scientific journals now require that authors disclose an estimate of sample size based on power calculation in their proposal or manuscript. Moreover, a taget sample size have to be a part of the pre-registration, which is highly recommended (or sometimes compulsory) for any research. Consequently, power calculation is becoming a must-have skill for researchers in intervention studies.

Power calculation is possible through dedicated software, however, these are often not flexible enough to cover complex study designs and analytical approaches. On the other hand, Monte Carlo simulation is an adjustable approach which makes it possible to calculate a priori power for any study. It is based on creating several samples with given theoretical distributions, and investigating the hypothesis on each of the samples. By aggregating the proportion of succesful tests, we can learn the statistical power to detect the target effect size.

Besides learning the required sample size, using MC simulation also has some collateral adventages. For example, the simulation requires to write up the exact analytical design, which can help to create data management plan and analysis scripts, or clarify research questions.

In the workshop, we will cover the logic of power calculation and build a Monte Carlo simulation to accommodate study designs from simple group comparisons to intricate multi-level designs. We will use R tidyverese tools that make the code readable and easy to follow. Laptops (with R and RStudio installed) are necessary!