One day, my boss asked me to check if the data has a certain number of events to perform an efficacy analysis. I was curious how did he come up with the number, later I know he must have done the Sample Size Calculation.Today we will go over the basics and R applications for sample size calculation.
Sample Size: N
Type I error rate: α- level (2-sided 0.05)
Mean under the null and alternative: μ0 and μa
Variance: σ²
Power: 1-β
We can use any four of these five factors to calculate the fifth one.
Hypothesis testing: a specific null and alternative hypothesis
Confidence interval: an estimated interest
Hypothesis testing approach:
State the null and the alternative hypothesis
Specify standard deviation
Decide the power and alpha level
State the test
R/ SAS program
##
## One-sample t test power calculation
##
## n = 33.36713
## d = 0.5
## sig.level = 0.05
## power = 0.8
## alternative = two.sided
Two Sample T-test Comparison of proportions
##
## Two-sample t test power calculation
##
## n = 26.26343
## d = 0.7882
## sig.level = 0.05
## power = 0.8
## alternative = two.sided
##
## NOTE: n is number in *each* group
Variance σ² increase, the sample size N increase
Difference between groups increases (μ1-μ2), sample size N decrease
Type I error rate (α) increase, sample size N decrease
Power (1-ß) increases sample size N increase.
Thanks 77 for sharing the Havard Catalyst class material!
Happy Studying!