One method for assessing the bioavailability of a drug is to note its concentration in blood and/or urine samples at certain periods of time after the drug is given. Suppose we want to compare the concentrations of two types of aspirin (types A and B) in urine specimens taken from the same person 1 hour after he/ she has taken the drug. In this study protocol, a specific dosage of either type A or type B aspirin is given and the urine concentration after 1-hour is measured. One week later, after the first aspirin has presumably been cleared from the system, the same dosage of the other aspirin is given to the same person and the urine concentration after 1-hour is noted. Because the order of giving the drugs may affect the results, a table of random numbers is used to decide which of the two types of aspirin to give first. The concentration will be measured as a percentage, and it is presumed that the standard deviation of the difference between subjects is approximately 3%. Suppose we would like to test whether the mean urine concentration for Aspirin B is less than Aspirin A at an alpha=0.05 level of significance. How many samples would we need to collect such that there would 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(n=NULL,d=(.015/.03),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*
We have calculated that we will need 23 people to perform this test accurately.
pwr.t.test(n=NULL,d=.5,sig.level=0.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
We will need about 59 people per sample group for this test. That is, 118 total.
library(pwr)
pwr.t.test(n=NULL,d=(.015/.03),sig.level=0.05,power=.75,type="paired",alternative="greater")
pwr.t.test(n=NULL,d=.5,sig.level=0.1,power=.85,type="two.sample")