Calculating the minimum sample size and confidence level