Joel Correa da Rosa
April 5th, 2017
The general case for comparing two means from independent populations is the one with unequal variances and unequal sample sizes.
\( n_1=(Z_{1-\frac{\alpha}{2}}+Z_{1-\beta})^2(\sigma_1^2+\sigma_2^2/\lambda)/\delta^2 \)
\( n_2=\lambda n_1 \)
Important: The cases with equal variances and/or equal sample sizes.
Suppose as investigator wishes to design a pilot study to investigate the effect of a new medication on diastolic blood pressure in hypertensive patients by using a parallel-groups design. He plans to randomly assign patients to receive either the treatment or a placebo. Measurements will be collected at baseline and after 12 weeks' follow up. The investigator plans to use a two-sided z-test to determine whether the change in the treatment group is different from the placebo at the 5% significance level (\( \alpha = 0.05 \)). He wants 90% chance to reject the null hypothesis of equality if the true difference is \( \delta=3 \) mmHg in either direction. If past measurements suggest that the common standard deviation of the changes in both groups is \( \sigma=15 \) mmHg, what sample size does he need for each group ?
# clinically meaningful difference
delta<-3
# standard deviation
sigma1<-15
sigma2<-15
# ratio between sample sizes
lambda<-1
# significance level
alpha<-0.05
# type-II error probability
beta<-0.1
# quantile for the significance level
Zalpha<-qnorm(1-alpha/2)
# quantile for power
Zbeta<-qnorm(1-beta)
# sample size calculation
n1<-(((Zalpha+Zbeta)^2)*(sigma1^2+(sigma2^2)/lambda))/delta^2
ceiling(n1)
[1] 526
Continuing the preceding example, suppose the standard deviation in the new medication group is 16 mm Hg and the standard deviation in the placebo group is 8 mm Hg, and all other design parameters are the same. What is the sample size ?
# clinically meaningful difference
delta<-3
# standard deviation
sigma1<-16
sigma2<-8
# ratio between sample sizes
lambda<-1
# significance level
alpha<-0.05
# type-II error probability
beta<-0.1
# quantile for the significance level
Zalpha<-qnorm(1-alpha/2)
# quantile for power
Zbeta<-qnorm(1-beta)
# sample size calculation
n1<-(((Zalpha+Zbeta)^2)*(sigma1^2+(sigma2^2)/lambda))/delta^2
ceiling(n1)
[1] 374
Keeping the same parameters in the Example 01, suppose we wish to enroll twice as many subjects in the treatment group as in the placebo group. This would mean \( \lambda=0.5 \)
# clinically meaningful difference
delta<-3
# standard deviation
sigma1<-16
sigma2<-8
# ratio between sample sizes
lambda<-0.5
# significance level
alpha<-0.05
# type-II error probability
beta<-0.1
# quantile for the significance level
Zalpha<-qnorm(1-alpha/2)
# quantile for power
Zbeta<-qnorm(1-beta)
# sample size for treatment group
n1<-(((Zalpha+Zbeta)^2)*(sigma1^2+(sigma2^2)/lambda))/delta^2
ceiling(n1)
[1] 449
# sample size for placebo group
n2<-lambda*n1
ceiling(n2)
[1] 225
# total sample size
n<-ceiling(n1)+ceiling(n2)
n
[1] 674
The general case for comparing two means from independent populations is the one with unequal variances and unequal sample sizes.
\( n_1=(Z_{1-\frac{\alpha}{2}}+Z_{1-\beta})^2(p_1(1-p_1)+p_2(1-p_2)/\lambda)/\delta^2 \)
\( n_2=\lambda n_1 \)
A placebo-controlled randomized trial proposes to assess the effectiveness of Drug A in curing infants suffering from sepsis. A previous study showed that the proportion of subjects cured by Drug A is 50% and a clinically important difference of 16% as compared to placebo is acceptable. What is the sample size that provides 80% power at 5% significance to detect the clinically important difference?
# clinically meaningful difference
delta<-0.16
# standard deviation
sigma1<-sqrt(0.5*0.5)
sigma2<-sqrt(0.34*0.66)
# ratio between sample sizes
lambda<-1
# significance level
alpha<-0.05
# type-II error probability
beta<-0.2
# quantile for the significance level
Zalpha<-qnorm(1-alpha/2)
# quantile for power
Zbeta<-qnorm(1-beta)
# sample size calculation
n1<-(((Zalpha+Zbeta)^2)*(sigma1^2+(sigma2^2)/lambda))/delta^2
ceiling(n1)
[1] 146
n2<-n1*1
ceiling(n2)
[1] 146
A psychologist wishes to design a randomized parallel-groups trial to compare the impact of white noise and classical music on the performance of college students on a 200 question problem solving test. On the basis of ther knowledge of past students, she expects the white noise group to have a bell-shaped distribution with a mean of a 120 points and a standard deviation of 15 points. She plans to compare the performance of the students in each group with a two-sided z-test at the 5% significance level. She wants 90% power to detect a better performance of the classical music group by 10 points. What are the sample sizes if :
Modify the sample size calculation in Example 02 to have twice subjects in the experimental group as compared to the placebo. Keeping all parameters for sample size calculation fixed, plot a graph that shows the relationship of sample size and allocation rate. Comment this graph.