好的,我有两部分CDF
def cdfH1a(x):
return 0.189497583190681*np.sqrt(2 * np.pi)*sp.erf(np.sqrt(2)* (x/2))
def cdfH1b(x):
return 0.0141047395886939*np.sqrt(np.pi)*sp.erf(7.07106781186547*x - 14.1421356237309)
我这样做是为了找到经验CDF
sorted = np.sort(sampleH1)
yVals = np.arange(len(sorted))/float(len(sorted))
plt.plot(sorted, yVals)
plt.show()
但是我不知道如何从我的CDF中生成10000个随机样本(这样的样本会放入sampleH1)
目前,我正在这样做,但我不认为这是正确的
sampleH1 = []
for x in sampleH0:
sampleH1.append(x + (cdfH1a(x) + cdfH1b(x)))
其中,sampleH0是来自正态分布CDF的10000个样本
如果有人能透露一些信息那就太好了谢谢
如果您使用的是numpy,则可以放弃循环:
sampleH1 = sampleH0 + cdfH1a(sampleH0) + cdfH1b(sampleH0)
相关问题 更多 >
编程相关推荐