我想为scipy.stats.powerlaw例程提供负指数,例如a = -1.5,以便绘制随机样本:
"""
powerlaw.pdf(x, a) = a * x**(a-1)
"""
from scipy.stats import powerlaw
R = powerlaw.rvs(a, size=100)
Run Code Online (Sandbox Code Playgroud)
为什么需要> 0,如何提供负a以生成随机样本,以及如何提供归一化系数/变换,即
PDF(x,C,a) = C * x**a
Run Code Online (Sandbox Code Playgroud)
文档在这里
http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.powerlaw.html
谢谢!
编辑:我应该补充一点,我正在尝试复制IDL的RANDOMP函数: