Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Spearman correlation and Kendall tau are wrong for multivariate discrete distributions #2845

Open
regislebrun opened this issue Dec 5, 2024 · 0 comments
Labels

Comments

@regislebrun
Copy link
Member

What happened?

The following script shows the bug:

import openturns as ot

d = ot.Normal(2)
sample = d.getSample(20)
weights = d.computePDF(sample).asPoint()

ud = ot.UserDefined(sample, weights)

largeSample = ud.getSample(1000000)
print("rho spearman (ud)    =", ud.getSpearmanCorrelation()[0, 1])
print("rho spearman (sample)=", largeSample.computeSpearmanCorrelation()[0, 1])
print("tau kendall (ud)    =", ud.getKendallTau()[0, 1])
print("tau kendall (sample)=", largeSample.computeKendallTau()[0, 1])

produces

rho spearman (ud)    = 0.07647699550025457
rho spearman (sample)= 0.10473985509227776
tau kendall (ud)    = -1.0
tau kendall (sample)= 0.07939474309505923

How to reproduce the issue?

run the script

Version

1.25dev

Operating System

all

Installation media

from source

Additional Context

No response

@regislebrun regislebrun added the bug label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant