Giter Site home page Giter Site logo

Comments (5)

tk-yoshimura avatar tk-yoshimura commented on June 11, 2024 1

I am not familiar with the PR rules of this repository, so may I ask you to do this on my behalf?
It is already midnight in Japan and I am going to bed.

Thank you so much.

from scipy.

mdhaber avatar mdhaber commented on June 11, 2024

Yes, according to Wikipdia,
image
our implementation is missing that factor of 11.

It's probably missed by our generic tests because the generic calculation is inaccurate.

To generate your reference in Mathematica, are you using Kurtosis or ExcessKurtosis? I'm a surprised to see an explicit +3 in the formula if it's really the excess kurtosis.
image

Would you like to submit a PR @tk-yoshimura?

from scipy.

mdhaber avatar mdhaber commented on June 11, 2024

Just out of curiousity, I checked whether scipy.integrate._tanhsinh._nsum would have provided a better generic implementation here. There are probably acceleration methods that would achieve great accuracy with fewer function evaluations, but the integral approximation is nice since it will work for pretty much any monotonically decreasing sequence.

import scipy.stats as stats
stats.yulesimon._munp(4, 5)  # 51.50194329138698 and warning that sum doesn't converge
stats.yulesimon.moment(4, 5)  # 52.083333333333336 (after this correction)

import numpy as np
from scipy.integrate._tanhsinh import _nsum
from scipy._lib._util import _lazywhere

def f(x):
    return _lazywhere(np.isfinite(x), (x,), 
                      lambda x: stats.yulesimon._pmf(x, 5)*x**4, 
                      fillvalue=0)
    
_nsum(f, 1, np.inf)
#  success: True
#   status: 0
#      sum: 52.083333333330906
#    error: 2.792518871722942e-07
#     nfev: 33181

(actual relative error 5e-14)

from scipy.

tk-yoshimura avatar tk-yoshimura commented on June 11, 2024

I am glad my code correction was correct.
Many thanks.

If you are interested in the stable distribution of half-integer shape parameter numbers not yet implemented in scipy, I have a C# implementation in my repository below.
https://github.com/tk-yoshimura/DoubleDoubleStatistic

from scipy.

mdhaber avatar mdhaber commented on June 11, 2024

Thanks @tk-yoshimura. I'll pass the link to the stable distribution to the right people. In the meantime, would you like to submit a PR to fix the kurtosis implementation, or would you like me to take care of it? If you do it, I can review and get it merged. If I do it, I'll need to wait for another maintainer to review and merge.

from scipy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.