A psychologist is designing a study to detect a difference between two means. The smallest difference between the means that she wants to detect is 1.5. The variance of the quantity that she is measuring is 4. She plans to enroll an equal number of subjects in each group. What is the total number of subjects that she should enroll so that her study has 80% power at the 1% significance level? (Use R to do the calculation and give the code thanks!)
Sol:
standard deviation =sqrt(4)=2
differnce in means=d=1.5
alpha=0.01
difference between two means so two tail
use library pwr in R
Rcode:
library(pwr)
pwr.t.test(d=(1.5)/2,power=.8,sig.level=.01,type="two.sample",alternative="two.sided")
Two-sample t test power calculation
n = 43.21294
d = 0.75
sig.level = 0.01
power = 0.8
alternative = two.sided
NOTE: n is number in *each* group
total number of subjects that she should enroll to detect a difference between two means =43+43=86
Get Answers For Free
Most questions answered within 1 hours.