comparison python/utils.py @ 680:da1352b89d02 dev

classification is working
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 05 Jun 2015 02:25:30 +0200
parents ae07c7b4cf87
children cdee6a3a47b4
comparison
equal deleted inserted replaced
678:97c305108460 680:da1352b89d02
23 return result 23 return result
24 24
25 ######################### 25 #########################
26 # Simple statistics 26 # Simple statistics
27 ######################### 27 #########################
28
29 def logNormalMeanVar(loc, scale):
30 mean = exp(loc+(scale**2)/2)
31 var = (exp(loc**2)-1)*exp(2*loc+scale**2)
32 return mean, var
28 33
29 def sampleSize(stdev, tolerance, percentConfidence, printLatex = False): 34 def sampleSize(stdev, tolerance, percentConfidence, printLatex = False):
30 from scipy.stats.distributions import norm 35 from scipy.stats.distributions import norm
31 k = round(norm.ppf(0.5+percentConfidence/200., 0, 1)*100)/100. # 1.-(100-percentConfidence)/200. 36 k = round(norm.ppf(0.5+percentConfidence/200., 0, 1)*100)/100. # 1.-(100-percentConfidence)/200.
32 if printLatex: 37 if printLatex: