Same person (paired test)
\[\sigma = 0.03\]
\[\alpha = 0.05\]
Power = 75%
\[\mu _{a} - \mu _{b} = 15%\]
\[ \mu _{a} - \mu _{b} > 0 \] \[ d = \frac{\mu _{a} - \mu _{b}}{\sigma } \]
#intsalling power library
library(pwr)
#number of samples for paired t-test
d<-0.015/0.03
pwr.t.test(n=NULL,d=d,sig.level=0.05,power=.75,type="paired",alternative="greater")
##
## Paired t test power calculation
##
## n = 22.92958
## d = 0.5
## sig.level = 0.05
## power = 0.75
## alternative = greater
##
## NOTE: n is number of *pairs*
The number of samples we need to collect data such that there would be 75% chance of correctly rejecting the null hypothesis if the urine concentration of Aspirin B is 1.5% less than that of Aspirin A is 23.
Two sample test (independent)
= 10%
Power = 85%
Effect size = 50%
#intsalling power library
library(pwr)
#number of samples for 2-Sample t-test,
pwr.t.test(n=NULL,d=.5,sig.level=0.10,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
How many infants do they need to enroll in each group?
How many total??