1. 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?
We use a paired t-test when we are interested in comparing two samples or measurements for the same participants. It is appropriate to use this test as urine aspirin concentration for Aspirin types A and B is taken from the same subject at different time intervals.
Given
- σ = 0.03
- d = 0.015/0.03 = 0.5
- α = 0.05
- power (1-β) = 0.75
library(pwr)
#number of samples for paired t-test, effect size = 0.5 (difference between the means divided by the pooled standard deviation)
?pwr.t.test
## starting httpd help server ... done
pwr.t.test(n=NULL,d=0.5,sig.level=0.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*
Solution: The sample size should be at least n = 30 samples for each aspirin formulation (60 measurements total) to achieve power = 0.75 with these assumptions.
2. Can active exercise shorten the time that it takes an infant to learn how to walk alone? Researchers would at a major university would like to design an experiment to test this hypothesis. Specifically, they would like to use one-week old male infants from white middle-class white families as test subjects and allocate into to one of two treatment groups. Those in the active exercise group will receive stimulation of the walking reflexes for four 3-minute sessions each day from the beginning of the second week through the end of the eighth week following birth; those in the other group will receive no such stimulation. Following this, the time (in months) that it takes subjects from each group to walk independently will then be measured. Since this is a preliminary project, the researchers would like to use an alpha=0.10 level of significance for this test, but would like to achieve a power of .85 at detecting a mean difference that is half of the (pooled) standard deviation of walking times. How many infants do they need to enroll in each group? How many total??
The infant populations are independent, so it is recommended to use a non-paired 2-sample t-test to compare samples of infants with exercise and without.
Given
- d = 0.5
- α = 0.10
- power (1-β) = 0.85
library(pwr)
#number of samples for paired t-test, effect=.5 (difference in population means is 50% of st. dev.)
pwr.t.test(n=NULL,d=0.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
Solution: at least ni=59 participants in each group, meaning ntotal=118 infants to achieve power = 0.85 with these assumptions
Complete Code
The complete R code used in this analysis is posted below.
library(pwr)
#number of samples for paired t-test, effect size = 0.5 (difference between the means divided by the pooled standard deviation)
?pwr.t.test
pwr.t.test(n=NULL,d=0.5,sig.level=0.05,power=.75,type="paired")
library(pwr)
#number of samples for paired t-test, effect=.5 (difference in population means is 50% of st. dev.)
pwr.t.test(n=NULL,d=0.5,sig.level=0.10,power=.85,type="two.sample")