?power.t.test
#H not: is the mean of asprin A is equal to the mean of asprin B
#H alternative is that the mean of asprin B is l.5% less then Asprin A
#
#
#
power.t.test(n = NULL, delta = .015, sd = .03, sig.level = 0.05,
             power = .75,
             type = c("paired"),
             alternative = c("one.sided"))
## 
##      Paired t test power calculation 
## 
##               n = 22.92961
##           delta = 0.015
##              sd = 0.03
##       sig.level = 0.05
##           power = 0.75
##     alternative = one.sided
## 
## NOTE: n is number of *pairs*, sd is std.dev. of *differences* within pairs
#We need to collect 23 samples so that there will be 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

library(pwr)

?pwr.t.test


#H not: is that there is no difference in the mean amount of time to walk independently between the treatment and nontreatment groups
#H not: mean of treatment group equals mean of non treatment group
#
#H Alternative is that the mean of the Treatment group is less then the mean of the that of the non treatment group
#


pwr.t.test(n = NULL, d = -.5 , sig.level = 0.1, power = .85, 
           type = c("two.sample"),
           alternative = c("less"))
## 
##      Two-sample t test power calculation 
## 
##               n = 43.40568
##               d = -0.5
##       sig.level = 0.1
##           power = 0.85
##     alternative = less
## 
## NOTE: n is number in *each* group
#We need 44 infants in each group for a total of 88 infants to be in the experiment.