python - Multiple confidence intervals -


i'm working pandas library in python. suppose have 4 random samples drawn normal distributions in following way:

np.random.seed(12345)  df = pd.dataframe([np.random.normal(32000,20000,3650),                     np.random.normal(43000,10000,3650),                     np.random.normal(43500,14000,3650),                     np.random.normal(48000,7000,3650)],                    index=[1992,1993,1994,1995]) 

i want 95% confidence intervals each of these samples calculate:

mean_value=df.mean(axis=1) std_value=df.std(axis=1,ddof=0) lower_bound=mean_value-1.96*std_value upper_bound=mean_value+1.96*std_value diff = upper_bound-lower_bound 

for each confidence interval, want cut 11 equally spaced intervals. had idea following:

low=lower_bound.values[1] high=upper_bound.values[1] diff=0.09*diff.values[1] np.arange(low,high,diff) 

this doesn't quite work, cut interval doesn't end on upper end of confidence interval. how can equally spaced intervals?

i'm not sure desiring, it's quite easy equally spaced intervals numpy's linspace function. here 11 intervals first distribution.

np.linspace(lower_bound.values[0], upper_bound.values[0], 12) array([ -7.18705879e+03,  -3.82825067e+01,   7.11049377e+03,          1.42592701e+04,   2.14080463e+04,   2.85568226e+04,          3.57055989e+04,   4.28543752e+04,   5.00031514e+04,          5.71519277e+04,   6.43007040e+04,   7.14494803e+04]) 

Comments