打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
What is the [Sci/Num]Python equivalent to Matlabs ...
8

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…'

 | 

1 Answer

1
2

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).'

  • I don't think this is correct: Inverse Gaussian Distribution – knedlsepp Mar 31 '15 at 14:26
  • From the scipy 0.10.0 release notes: 'The deprecated name invnorm was removed from scipy.stats.distributions, this distribution is available as invgauss.' – TheBlackCat Mar 31 '15 at 14:32
  • I'm just not sure if the inverse gaussian cdf is the same as: the inverse of the gaussian cdf. I'm just cross checking this. – knedlsepp Mar 31 '15 at 14:36
  • 2
    Ok. Reason why this must be incorrect: The inverse of the normal cumulative distribution function is a function defined on the interval [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
  • 2
    OK, so assuming 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
 | 
default
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
羣星·無塵 CDF〖點擊欣賞〗
Python|判断一个5位数是不是回文数
python 每日一练
Logic and Proofs--离散数学
逆采样(Inverse Sampling)和拒绝采样(Reject Sampling)原理详解
概率图模型-蒙特卡洛抽样
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服