I am searching for a python equivalent of the norminv function in Matlab.
Or in other words (from the above description):I am searching for the 'Normal inverse cumulative distribution function' in python, or probably in the stats part of scipy (Or maybe numpy?)
I would guess that it exists in scipy, but probably under another name than in matlab, or in matlabs help page. However I am not sure of this functions other names, or exact workings, so I am having a hard time finding it. And unfortunately it's not simply the 'Inverse normal cumul…' instead of the 'Normal inverse cumul…'
It depends exactly on what you want. If you want the cdf
of a distribution that is the inverse of the normal distribution, you want invgauss, 'An inverse Gaussian continuous random variable.'. To get the cdf
, you would need to use the invgauss.cdf
method. Adapted from the documentation:
from scipy.stats import invgaussmu = 0.145462645553vals = invgauss.ppf([0.001, 0.5, 0.999], mu)res = invgauss.cdf(vals, mu)
On the other hand, if you want the inverse of the cdf
of the normal distribution, you want the ppf
method of the norm distribution, which is the 'Percent point function (inverse of cdf — percentiles).'
invnorm
was removed from scipy.stats.distributions
, this distribution is available as invgauss
.' – TheBlackCat Mar 31 '15 at 14:32 [0,1]
, whereas the distribution function of the so called inverse gaussian distribution has support (0,Inf)
as listed on wikipedia. This means those must be two different things as I suspected. The OP wants the function norm.ppf
used in the question I linked as duplicate. – knedlsepp Mar 31 '15 at 14:47 norminv
in octave is indeed the same as norminv
in matlab (Octaves documentation is quite short, and I suck at statistics) the python equivalent seems indeed to be norm.ppf
from scipy.stats
: octave-octave:9> norminv(0.9) ans = 1.2816 octave:10> norminv(0.5) ans = 0
Python-In [35]: stats.norm.ppf(0.9) Out[35]: 1.2815515655446004 In [36]: stats.norm.ppf(0.5) Out[36]: 0.0
– JC_CL Mar 31 '15 at 15:15 联系客服