如何在Python中生成具有指定均值,方差,偏度,峰度的数据?

时间:2019-04-13 16:42:41

标签: python statistics simulation

我想用Python生成行为,就像真实的股市数据一样,这意味着我需要能够指定和处理前四个时刻。不幸的是,仅能够控制偏斜或仅峰度还不够。

我在这里找到了一些答案:How to generate a distribution with a given mean, variance, skew and kurtosis in Python?,但是我似乎无法用gengamma分布来控制这些属性。

我知道这里有大量的发行版:https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions,也许我可以以某种巧妙的方式使用其中之一?还是有另一种方法?

1 个答案:

答案 0 :(得分:0)

我认为您最好在scipy中使用gengamma函数,因为您具有控制分布形状的所有参数。

from scipy.stats import gengamma

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gengamma.html

希望这会有所帮助。