python - How do I return range from normal distribution? -


let's have 2 array of numbers follows:

4.2 6.2 10.7 8.8 3.8 4.1 

and

4.5 7.7 14.6 8.7 4.8 4.6 

also generated standart deviation first array:

0.010164 0.012286 0.013412 0.016488 0.00661 0.007426 

now example on first element of array:

mean, sigma = 4.2, 0.010164  

what i'm trying know whether each element of second array in range between std of each element of first array. in other words:

whether 4.5 within range of np.random.normal(mean, sigma)

any appreciated. thanks!

i found answer. seems looking cumulative distribution function scipy has library it.

import scipy.stats ss  def f(x):   return ss.norm.cdf(x, loc = 4.2, scale=0.010164 )  print f(4.5) 

will return probability of 4.5 in normal distribution of 4.2 given standard deviation.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -