Threshold value in terms of standard deviation, given the cumulative probability.

http://www.johndcook.com/blog/distributions_scipy/ mentions the function scipy.stats.niorm.isf which is the Inverse survival function (Complementary CDF inverse). This is the threshold value expressed in mean plus fractions of standard deviation that will result in the correct cumulative probability function calculated from minus infinity to threshold

Definition: https://en.wikipedia.org/wiki/Error_function

$$ \Phi(x) = \frac{1}{\sqrt{2\pi}} \int_{-infty}^x \exp[-t^2/2] dt = 0.5 + 0.5 \erf(\frac{x}{\sqrt{2}}) $$

where $$\erf(x) = \frac{2}{\sqrt{\pi}} \int_0^x \exp[-t^2/2] dt$$

Table: https://homes.cs.washington.edu/~jrl/normal_cdf.pdf

Additional info: https://en.wikipedia.org/wiki/Error_function https://en.wikipedia.org/wiki/Standard_score https://en.wikipedia.org/wiki/Cumulative_distribution_function https://docs.scipy.org/doc/scipy/reference/tutorial/stats.html https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.stats.norm.html


In [2]:
from scipy.stats import norm
import numpy as np
import pyradi.ryplot as ryplot
%matplotlib inline

perc = np.array([0.005, 0.01,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.97,0.99,0.9987]).reshape(-1,1)
#not quite sure why we must negate
sigm = -norm.isf(perc)

table = np.hstack((perc,sigm))
print(table)

p = ryplot.Plotter(1,1,1,figsize=(8,4))
p.plot(1,sigm,perc)
p.plot


[[ 0.005      -2.5758293 ]
 [ 0.01       -2.32634787]
 [ 0.05       -1.64485363]
 [ 0.1        -1.28155157]
 [ 0.2        -0.84162123]
 [ 0.3        -0.52440051]
 [ 0.4        -0.2533471 ]
 [ 0.5        -0.        ]
 [ 0.6         0.2533471 ]
 [ 0.7         0.52440051]
 [ 0.8         0.84162123]
 [ 0.9         1.28155157]
 [ 0.95        1.64485363]
 [ 0.97        1.88079361]
 [ 0.99        2.32634787]
 [ 0.9987      3.01145376]]
Out[2]:
<bound method Plotter.plot of <pyradi.ryplot.Plotter instance at 0x00000000099EEA08>>

In [3]:
# store the variable in the server for another notebook to read it
%store table
del table


Stored 'table' (ndarray)

In [ ]: