27.1 T-Test

  • Load the power library, determine the number of samples required for a means comparison of a continous outcome.
  • (Set a random seed so we get the same answers each time.)
library ("pwr")
set.seed(1000)
pwr.t.test(n=NULL, d=0.25, sig.level=0.05,
           power=0.8, type="two.sample")
## 
##      Two-sample t test power calculation 
## 
##               n = 252
##               d = 0.25
##       sig.level = 0.05
##           power = 0.8
##     alternative = two.sided
## 
## NOTE: n is number in *each* group