Skip to content

BUG/ENH: Kendall’s tau of FrankCopula wrong for small theta #8657

Closed

Description

@Tobi0

For the Frank Copula, if the theta parameter tends to 0, Kendall's tau should also approach 0 as this is the limit case for independence.

However, I get:

from statsmodels.distributions.copula.archimedean import FrankCopula
c=FrankCopula()
[c.tau(th) for th in [1, 0.5, 0.1, 0.05, 0.01, 1e-3, 1e-4, 1e-5]]
[0.110018, 0.05541, 0.01106, 0.00536, -0.003657, -0.4767260, -47.6837, -4768.3714]

tau is defined to
grafik
where
grafik
is the Debye function of order one.

It seems that the result for small theta depends critically on the numeric precision of the Debye value which is calculated like this:

debye_value = integrate.quad(integrand, EPSILON, alpha)[0] / alpha

So, I am asking why np.float32 is used which has a value of "just" 1.1920929e-07 for me.

It seems even possible to set the left value to 0, even if it is 0/0 there. (without warnings)
This will keep results positive until 1e-5 after all.

Maybe there are more accurate implementations. Also, it seems that debye function is somehow related to the polylogarithm.

Activity

  1. josef-pkt commented on Feb 7, 2023

    @josef-pkt
    Member

    I don't know (or remember) where the epsilon comes from, most likely copied from somewhere.
    It looks appropriate if the integrated values are in the range of 1.0

    We never checked cases that go close to a boundary of the parameter space, AFAIR

    Putting the alpha inside the integrand might help for small alpha

    It looks like that goes to 1

    integral_0^0.000001 t/(e^t - 1) / 0.000001 dt
    -> 1

    https://www.wolframalpha.com/input?i=integral_0%5E0.000001+++t%2F%28e%5Et+-+1%29+%2F+0.000001+dt+

  2. josef-pkt commented on Feb 7, 2023

    @josef-pkt
    Member

    graph using debye in the form the special function
    plot shows it increases to 1 as alpha -> 0

    https://www.wolframalpha.com/input?i=%28-1%2F2x%5E2%2Bln%281-e%5Ex%29x%2BLi_2%28e%5Ex%29-zeta%282%29%29+%2F+x

    assuming I copy pasted correctly

  3. josef-pkt commented on Feb 9, 2023

    @josef-pkt
    Member

    I got the Taylor series expansion around 0 for both Debye and tau.
    I still need to make a clean function, but should be able to fix this soon.

  4. changed the title [-]Kendall’s tau of FrankCopula wrong for small theta[/-] [+]BUG/ENH: Kendall’s tau of FrankCopula wrong for small theta[/+] on Feb 9, 2023
  5. added a commit that references this issue on Feb 9, 2023
    e375d65
  6. josef-pkt commented on Feb 9, 2023

    @josef-pkt
    Member

    fix is in #8662

  7. added a commit that references this issue on Feb 9, 2023
    37ce364
  8. added this to the 0.14 milestone on Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions