# HG changeset patch # User Nicolas Saunier # Date 1399658942 14400 # Node ID 0a93afea8243123b3bacec499b59b421ec3017f5 # Parent b96ff16b1c81e570d5069e12f3d52e95e233bfa5 alternative confidence interval diff -r b96ff16b1c81 -r 0a93afea8243 python/utils.py --- a/python/utils.py Thu May 01 11:08:41 2014 -0400 +++ b/python/utils.py Fri May 09 14:09:02 2014 -0400 @@ -36,7 +36,12 @@ return (k*stdev/tolerance)**2 def confidenceInterval(mean, stdev, nSamples, percentConfidence, trueStd = True, printLatex = False): - 'if trueStd, use normal distribution, otherwise, Student' + '''if trueStd, use normal distribution, otherwise, Student + + Use otherwise t.interval or norm.interval + ex: norm.interval(0.95, loc = 0., scale = 2.3/sqrt(11)) + t.interval(0.95, 10, loc=1.2, scale = 2.3/sqrt(nSamples)) + loc is mean, scale is sigma/sqrt(n) (for Student, 10 is df)''' from math import sqrt from scipy.stats.distributions import norm, t if trueStd: