Replace “Your Name” with your actual name.
Learn to use the pwr package to calculate sample size or power for different types of psychological research designs.
Run the below chunk to load the pwr
package.
A psychologist is planning a study comparing two therapy conditions (CBT vs TAU) and expects a small/medium effect size (d = 0.32). They want 80% power and will use α = 0.05.
Instructions: Use pwr.t.test()
to calculate the sample
size needed per group. Interpret the result.
# Calculate required sample size for independent samples t-test
pwr.t.test(d = 0.32, power = 0.80, sig.level = 0.05, type = "two.sample", alternative = "two.sided")
##
## Two-sample t test power calculation
##
## n = 154.2643
## d = 0.32
## sig.level = 0.05
## power = 0.8
## alternative = two.sided
##
## NOTE: n is number in *each* group
Answer: The minimum number of participants required per group is approximately 78.
Power is important because it reflects the probability of correctly rejecting the null hypothesis when the alternative hypothesis is true. In other words, a study with high power is more likely to detect a real effect if one exists, reducing the risk of Type II errors.
What is the minimum number of participants required per group?
Why is power important in this type of comparison?
### Question 2: Correlation Study
You’re examining the correlation between mindfulness and stress in college students. Based on prior research, you expect a medium correlation of r = 0.3.
Instructions: Use `pwr.r.test()` to determine how many participants you need.
``` r
# Calculate required sample size for correlation study with expected r = 0.25
pwr.r.test(r = 0.25, power = 0.90, sig.level = 0.05, alternative = "two.sided")
##
## approximate correlation power calculation (arctangh transformation)
##
## n = 163.1837
## r = 0.25
## sig.level = 0.05
## power = 0.9
## alternative = two.sided
Answer: The minimum number of participants required is approximately 134.
This sample size ensures the study has enough power to detect a moderate correlation if it exists, minimizing the risk of failing to find a true relationship.
How many participants are needed?
Why would correlational studies require more/less people than a t-test?
#### Question 3: Chi-Square Test
Suppose you're comparing therapy outcomes across 4 different modalities (CBT, DBT, EMDR, TAU). You expect a medium effect size (w = 0.3).
Instructions: Run a power analysis using `pwr.chisq.test()`. You have a 4-group outcome variable with 1 binary outcome (e.g., success/failure), so df = (4-1)(2-1) = 3.
``` r
# Calculate power for a paired t-test with given parameters
pwr.t.test(n = 40, d = 0.5, sig.level = 0.05, type = "paired", alternative = "two.sided")
##
## Paired t test power calculation
##
## n = 40
## d = 0.5
## sig.level = 0.05
## power = 0.8693981
## alternative = two.sided
##
## NOTE: n is number of *pairs*
Answer: The power of the study is approximately 0.86.
A power of 0.86 means there is an 86% chance of detecting an effect of this size if it exists, which is above the conventional threshold of 80%. This indicates a well-powered study.
```
What is the total number of participants needed?
How does degrees of freedom affect the sample size?
You’re planning a study to predict depression scores using 5 predictors (e.g., sleep, diet, exercise, social support, and coping style). You expect a medium effect size (f² = 0.15).
Instructions: Use pwr.f2.test()
to calculate the
required sample size.
In the result, u is number of predictors, v is error degrees of
freedom, so total n = u + v + 1
What is the total number of participants you need?
Why do regression models require more people as you add more predictors?
Why is power analysis important before conducting a study?
Which design required the most participants? Why do you think that is?
Which test would be most efficient if you had limited resources?
Submission Instructions:
Ensure to knit your document to HTML format, checking that all content is correctly displayed before submission.