Calculation of confidence intervals and margin of error