Replace “Your Name” with your actual name.

Learning Goals:

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.

library(pwr)

Exercise 1: Independent Samples t-Test

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.

pwr.t.test(d = 0.32, power = 0.80, sig.level = 0.05, type ="two.sample")
## 
##      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

What is the minimum number of participants required per group? We need 155 per group.

Why is power important in this type of comparison? It is important because we want to have enough power to detect a meaningful difference between the two groups

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.

pwr.r.test(r = 0.3, power = 0.8, sig.level = 0.05)
## 
##      approximate correlation power calculation (arctangh transformation) 
## 
##               n = 84.07364
##               r = 0.3
##       sig.level = 0.05
##           power = 0.8
##     alternative = two.sided

How many participants are needed? We need 85 paricipants total.

Why would correlational studies require more/less people than a t-test? A correlation requires less because there are no groups to compare.

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.

pwr.chisq.test(w = 0.3, df = 3, power = 0.8, sig.level = 0.05)
## 
##      Chi squared power calculation 
## 
##               w = 0.3
##               N = 121.1396
##              df = 3
##       sig.level = 0.05
##           power = 0.8
## 
## NOTE: N is the number of observations

What is the total number of participants needed? We need a total of 122 participants. How does degrees of freedom affect the sample size? The higher your degrees of freedom, the larger you sample size needs to be.

Question 4: Multiple Regression

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

pwr.f2.test(u = 5, f2 = 0.15, power = 0.8, sig.level = 0.05)
## 
##      Multiple regression power calculation 
## 
##               u = 5
##               v = 85.21369
##              f2 = 0.15
##       sig.level = 0.05
##           power = 0.8
5+ 85.21369 + 1
## [1] 91.21369

What is the total number of participants you need? 92 is the total sample size we need.

Why do regression models require more people as you add more predictors? Because we are asking our model to make more predictions.

Wrap-Up Questions. Answer these in your own words:

Why is power analysis important before conducting a study? It is used to not waste any resources and the amount of individuals we need to have to detect the effect size of interest.

Which design required the most participants? Why do you think that is? T-test due to that we are comparing two independent groups.

Which test would be most efficient if you had limited resources? Correlation is generally the most efficient with limited resources.

Submission Instructions:

Ensure to knit your document to HTML format, checking that all content is correctly displayed before submission.