calculate confidence intervals