G*Power Sample Size Calculator
An essential tool to calculate the required sample size for an a priori power analysis of a two-sample t-test, inspired by G*Power.
What Does it Mean to Calculate Sample Size Using G*Power?
To calculate sample size using G*Power is to perform an a priori power analysis. This is a critical step in research design that determines the minimum number of participants needed in a study to have a reasonable chance of detecting a true effect, if one exists. G*Power is a popular free software tool that helps researchers avoid two major pitfalls: collecting too little data, which leads to underpowered studies that might miss a real effect (a Type II error), or collecting too much data, which wastes resources and can be unethical. This process balances statistical power, significance level, and effect size to ensure the study is both efficient and robust.
The core purpose of this calculation is to ensure your study has adequate statistical power. Power is the probability that your test will correctly reject the null hypothesis when an alternative hypothesis is true. In simpler terms, it’s the sensitivity of your study. A common target for power is 80%, which means you have an 80% chance of finding a statistically significant result if a real effect of a certain magnitude is present. Failing to calculate sample size can lead to inconclusive results, making it an indispensable part of planning any empirical research. For more on this, see our guide on statistical power analysis.
The Formula to Calculate Sample Size
While G*Power handles various complex statistical tests, the underlying logic for a two-sample t-test can be approximated using a formula based on the Z-distribution. This formula is particularly useful for understanding the interplay between the core components. The formula for the sample size per group (assuming equal groups) is:
n ≈ 2 * [ (Zα/2 + Zβ) / d ]2
Where the total sample size N is simply 2 * n. Our calculator adapts this for unequal groups as well. This formula shows how a larger effect size (d) decreases the required sample size, while higher desired power (which lowers β and increases Zβ) increases it.
Variables Explained
| Variable | Meaning | Unit / Type | Typical Range |
|---|---|---|---|
| d | Cohen’s Effect Size | Standard Deviations | 0.2 (Small) to 0.8+ (Large) |
| α (Alpha) | Significance Level (Type I Error Rate) | Probability | 0.01, 0.05, 0.10 |
| 1-β (Power) | Statistical Power (1 – Type II Error Rate) | Probability | 0.80, 0.90, 0.95 |
| Zα/2 | Critical Z-value for alpha | Standard Deviations | 1.96 (for α=0.05, two-tailed) |
| Zβ | Critical Z-value for beta | Standard Deviations | 0.84 (for Power=0.80) |
| N | Total Sample Size | Count (Participants) | Varies based on inputs |
Practical Examples
Example 1: Medium Effect Size
A cognitive psychologist wants to test a new learning intervention. They expect a medium effect size based on prior research. They need to calculate the sample size for a study to compare the test scores of an intervention group against a control group.
- Inputs:
- Effect Size (d): 0.5 (medium)
- Alpha (α): 0.05 (two-tailed)
- Power (1-β): 0.80
- Allocation Ratio: 1 (equal groups)
- Results: To achieve 80% power, they would need a total sample size of approximately 128 participants (64 in each group). This is a standard calculation for many psychology studies. If you are starting your research journey, understanding effect size calculation is a great first step.
Example 2: Small Effect Size with Higher Power
A clinical researcher is investigating a drug with subtle expected effects on blood pressure. Because the consequences of missing a real effect are high, they want higher power.
- Inputs:
- Effect Size (d): 0.2 (small)
- Alpha (α): 0.05 (two-tailed)
- Power (1-β): 0.95
- Allocation Ratio: 1 (equal groups)
- Results: To reliably detect such a small effect with 95% power, the study would require a much larger total sample size of approximately 1302 participants (651 in each group). This demonstrates how detecting subtle effects with high confidence demands significantly more data.
How to Use This G*Power Sample Size Calculator
Using this calculator is a straightforward process to prepare for your research, often called an a priori power analysis. Follow these steps to determine the sample size you need.
- Enter Effect Size (Cohen’s d): This is the magnitude of the difference you expect to find. If you’re unsure, consult prior literature or use conventional benchmarks: 0.2 for a small effect, 0.5 for a medium effect, and 0.8 for a large effect.
- Set Alpha (α): This is your significance level, the risk you’re willing to take of finding an effect that isn’t really there. The standard is 0.05.
- Define Power (1-β): Set your desired statistical power. This is the probability of detecting an effect if it truly exists. 80% (or 0.80) is the most common choice.
- Choose Tails: Select “Two-tailed” if you’re testing for a difference in either direction. Select “One-tailed” if you have a strong, directional hypothesis (e.g., you are certain the treatment will only increase scores, not decrease them).
- Calculate and Interpret: Click “Calculate Sample Size.” The primary result is the total number of participants you need for your study. The intermediate values show the breakdown by group. The power curve chart visualizes how power increases with sample size, providing a clear justification for your calculated number. Exploring hypothesis testing concepts can further clarify this step.
Key Factors That Affect Sample Size
Several factors interact to determine the required sample size. Understanding these levers is key to planning an efficient study.
- Effect Size: This is the most critical factor. Larger effects are easier to detect and require smaller sample sizes. Smaller, more subtle effects require much larger samples to be distinguished from random noise.
- Statistical Power (1-β): Higher power means a lower risk of missing a true effect (Type II error). Increasing power from 80% to 90% or 95% will always increase the required sample size, sometimes substantially.
- Significance Level (α): A stricter (lower) alpha level (e.g., 0.01 instead of 0.05) reduces the chance of a false positive (Type I error). This makes it harder to achieve significance and thus requires a larger sample size.
- Number of Tails: A one-tailed test concentrates all of your statistical power in one direction. It is easier to find an effect and requires a smaller sample size than a two-tailed test, but it should only be used when there is a strong theoretical reason to expect an effect in only one direction.
- Sample Size Variability: Less variability (a smaller standard deviation) within your samples leads to more precise estimates and increases power, thereby reducing the required sample size for a given effect size.
- Allocation Ratio: Studies are most powerful when the groups have equal sizes (allocation ratio of 1). As the groups become more unequal, the required total sample size increases to maintain the same level of power.
For a deeper dive, our article on research methodology covers these topics in greater detail.
Frequently Asked Questions (FAQ)
What is an ‘a priori’ sample size calculation?
An a priori calculation is done before you collect data to determine the necessary sample size. This is the standard and most scientifically valid approach, as opposed to a ‘post-hoc’ analysis, which calculates power after a study is completed and is often criticized.
What if I don’t know my effect size?
If you have no prior research to guide you, you can either conduct a small pilot study to estimate it or use Cohen’s conventional benchmarks (0.2 for small, 0.5 for medium, 0.8 for large). Using a conservative (small) effect size estimate is a safe approach, as it will ensure you have enough power.
Why is 80% power the standard?
The 80% power convention is a widely accepted trade-off between the risk of a Type II error (β = 20%) and the resources required for the study. It implies that a 20% chance of missing a true effect is acceptable. In fields where missing an effect is very costly (like a life-saving drug trial), power might be set higher (e.g., 90% or 95%).
Does increasing sample size always increase power?
Yes, all else being equal, a larger sample size will always increase statistical power. However, there are diminishing returns. The power curve chart generated by our calculator shows how power increases sharply at first and then begins to level off, meaning a very large increase in sample size might only yield a tiny increase in power.
What is the difference between a one-tailed and two-tailed test?
A two-tailed test checks for a difference between groups in either direction (group A is different from group B). A one-tailed test is more specific; it checks for a difference in only one direction (e.g., group A is greater than group B). One-tailed tests are more powerful but require a strong justification.
What happens if my groups are not of equal size?
Statistical power is maximized when groups are of equal size. If you have unequal groups, you will need a larger total sample size to achieve the same power as a study with equal groups. Our calculator handles this with the “Allocation Ratio” input.
Can I calculate sample size for an ANOVA or regression in G*Power?
Yes, the full G*Power software is very versatile and can handle many other types of tests, including ANOVA, regression, and chi-squared tests. This online calculator is specifically designed for the common case of a two-sample t-test.
What should I do if the required sample size is too large to be feasible?
If the calculation suggests an unfeasibly large sample size, you may need to reconsider your study design. Options include trying to increase the effect size (e.g., by using a stronger intervention), increasing your alpha level (if acceptable in your field), or accepting a lower power level. It may also indicate that the effect you’re looking for is too small to be practically detected with your available resources.