1

library(pwr)

pwr.t.test(n=NULL,d=.5,sig.level=.05,power=.75,type="paired")
## 
##      Paired t test power calculation 
## 
##               n = 29.73548
##               d = 0.5
##       sig.level = 0.05
##           power = 0.75
##     alternative = two.sided
## 
## NOTE: n is number of *pairs*
#According to the power analysis, we should collect 30 (29.735 rounded up) samples to have a 75% chance of correctly rejecting the null hypothesis if the urine concentration of Aspirin B is 1.5% less than that of Aspirin A.

2

pwr.t.test(n=NULL,d=.5,sig.level=.1,power=.85,type="two.sample")
## 
##      Two-sample t test power calculation 
## 
##               n = 58.20169
##               d = 0.5
##       sig.level = 0.1
##           power = 0.85
##     alternative = two.sided
## 
## NOTE: n is number in *each* group
#According to the power analysis, we should collect 59 (58.202 rounded up) samples to have a 85% chance of correctly rejecting the null hypothesis. However, since this is an odd number, it should be rounded up to the next even number (60) so that the two groups of infants would have 30 subjects each and 60 subjects in total.