Fitting empirical distribution to theoretical ones with Scipy (Python)?

前端 未结 9 816
醉话见心
醉话见心 2020-11-22 05:28

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47,47,47,...]<

9条回答
  •  遇见更好的自我
    2020-11-22 05:49

    It sounds like probability density estimation problem to me.

    from scipy.stats import gaussian_kde
    occurences = [0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47]
    values = range(0,48)
    kde = gaussian_kde(map(float, occurences))
    p = kde(values)
    p = p/sum(p)
    print "P(x>=1) = %f" % sum(p[1:])
    

    Also see http://jpktd.blogspot.com/2009/03/using-gaussian-kernel-density.html.

提交回复
热议问题