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.

if (!require(pwr)) install.packages("pwr", repos = "https://cloud.r-project.org")
## Loading required package: pwr
## Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
## logical.return = TRUE, : there is no package called 'pwr'
## Installing package into 'C:/Users/rizza/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## package 'pwr' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\rizza\AppData\Local\Temp\Rtmpma0qeR\downloaded_packages
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", 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

What is the minimum number of participants required per group?
Approximately 78 participants per group.

Interpretation:
To detect a small-to-medium effect size with 80% power at α = 0.05, the researcher needs about 78 participants in each group, for a total of 156 participants.