【问题标题】:How do I generate data with specified mean, variance, skewness, kurtosis in Python?如何在 Python 中生成具有指定均值、方差、偏度、峰度的数据?
【发布时间】:2019-09-04 04:02:09
【问题描述】:

我想在 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,也许我可以以某种巧妙的方式使用其中一个?还是有别的办法?

【问题讨论】:

    标签: python statistics simulation


    【解决方案1】:

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

    from scipy.stats import gengamma
    

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

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2013-11-05
      • 2018-12-29
      • 2020-05-20
      • 2019-02-06
      • 2011-06-15
      • 1970-01-01
      • 2014-12-13
      • 2020-01-16
      相关资源
      最近更新 更多