Mercurial Hosting > traffic-intelligence
changeset 499:0a93afea8243
alternative confidence interval
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 09 May 2014 14:09:02 -0400 |
parents | b96ff16b1c81 |
children | 3b99d712bbee |
files | python/utils.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: