#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np # In[3]: treat = 330.8 treat_se = 99.7 placebo = 188.1 placebo_se = 55.5 n = 15 # Formula for SE of difference: # # $$SE = \sqrt{\frac{SD_T^2}{n_T} + \frac{SD_C^2}{n_C}}$$ # # and $SE = SD/\sqrt{n}$, so for this example: # # $$SE = \sqrt{SE_T^2 + SE_C^2}$$ # In[6]: SE_diff = np.sqrt(99.7**2 + 55.5**2) SE_diff # Hence, a 95% confidence interval for the difference would be: # In[7]: d = treat-placebo d - 2*SE_diff, d + 2*SE_diff # Which, given n=15 and the variability, is pretty unccertain.