numpy.random.noncentral_chisquare

原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.noncentral_chisquare.html

译者:飞龙 UsyiyiCN

校对:(虚位以待)

numpy.random.noncentral_chisquare(df, nonc, size=None)

从非中心卡方分布绘制样本。

非中心\chi^2分布是\chi^2分布的一般化。

参数:

df:int

自由度,从Numpy 1.10起应该> 0,对于早期版本应该> 1。

nonc:float

非中心性,应该是非负的。

size:int或tuple的整数,可选

输出形状。如果给定形状是例如(m, n, k),则 m * n * k默认值为None,在这种情况下返回单个值。

笔记

非中心卡方分布的概率密度函数为

其中Y_{q}是具有q个自由度的卡方。

在德里(2007年),注意到非中心卡方可用于轰炸和覆盖问题,杀死由非中心卡方分布给出的点目标的概率。

参考文献

[R245]德里Holla,“关于武器系统有效性分析中的非中心卡方分布”,Metrika,第15卷,第1/1970年12月。
[R246]维基百科,“非中心卡方分布”http://en.wikipedia.org/wiki/Noncentral_chi-square_distribution

例子

从分布中绘制值并绘制直方图

>>> import matplotlib.pyplot as plt
>>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),
...                   bins=200, normed=True)
>>> plt.show()

源代码pngpdf

../../_images/numpy-random-noncentral_chisquare-1_00_00.png

从非中心chisquare绘制非常小非中心的值,并与chisquare相比。

>>> plt.figure()
>>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000),
...                   bins=np.arange(0., 25, .1), normed=True)
>>> values2 = plt.hist(np.random.chisquare(3, 100000),
...                    bins=np.arange(0., 25, .1), normed=True)
>>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')
>>> plt.show()

pngpdf

../../_images/numpy-random-noncentral_chisquare-1_01_00.png

演示非中心性的大值如何导致更对称的分布。

>>> plt.figure()
>>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),
...                   bins=200, normed=True)
>>> plt.show()

pngpdf

../../_images/numpy-random-noncentral_chisquare-1_02_00.png