How to visualize 95% confidence interval in matplotlib?

后端 未结 2 834
渐次进展
渐次进展 2021-02-04 14:01

I have learned how to find the 95% confidence interval with scipy.stats.t like so

In [1]: from scipy.stats import t
In [2]: t.interval(0.95, 10, loc         


        
2条回答
  •  萌比男神i
    2021-02-04 14:17

    you need to divide by standard deviation, and, second, if your data is two-sided (as plot suggests), you need to allow 2.5% of misses on each side of Gaussian, that is:

    ss.t.ppf(0.975, data_df)/np.sqrt(data_df)
    

    Since you miss 2.5% on both sides, you get total 5% miss.

提交回复
热议问题