Skip to content

MAINT: cauchy moments are undefined #4809

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

Merged
merged 1 commit into from
Aug 25, 2015
Merged

Conversation

argriffing
Copy link
Contributor

See #2055 (comment).

This PR could weaken some tests by not failing moment calculations that mistakenly return nan.

@argriffing
Copy link
Contributor Author

I'm not sure what this comment is about:
# this did not work, skipped silently by nose

@rgommers rgommers added the maintenance Items related to regular maintenance tasks label May 10, 2015
@ev-br
Copy link
Member

ev-br commented Aug 25, 2015

I'm not sure I understand the reasoning in the Wikipedia article linked in #2055 (comment). Using the principal value for the mean looks sensible, and using anything but Cauchy principal value looks strange (to me, FWIW). Anyway, I do not think it's worth worrying about too much, so I'm merging this as is. Thanks Alex and sorry this PR received no attention for this long.

ev-br added a commit that referenced this pull request Aug 25, 2015
MAINT: cauchy moments are undefined
@ev-br ev-br merged commit 7fe3d47 into scipy:master Aug 25, 2015
@ev-br ev-br added this to the 0.17.0 milestone Aug 25, 2015
@argriffing
Copy link
Contributor Author

Using the principle value for the mean looks sensible, and using anything but Cauchy principal value looks strange (to me, FWIW).

Just to make sure I understand, you are suggesting that for any symmetric distribution using the point of symmetry for the mean looks sensible and anything else looks strange?

@josef-pkt
Copy link
Member

It might be sensible, but that's the median and not the mean (expected value).

IIRC I have seen also "centrality parameter" for estimates of the center of location for heavy tailed distribution estimation, which is more vague and can be estimated by truncating the sample by ignoring or clipping large absolute values.

@ev-br
Copy link
Member

ev-br commented Sep 9, 2015

Essentially, yes.
Infinite limits of integration imply some limiting procedure, and if an integrand is symmetric, using $\lim_{A\to\infty}\int_{-A}^{A} (...) dx seems natural, and I fail to see a reason for anything else other than rigor for the sake of rigor. (And it's clear from above that I don't really have a proper math culture :-), so FWIW).

@argriffing
Copy link
Contributor Author

I fail to see a reason for anything else other than rigor for the sake of rigor.

Here's an imperfect analogy with the definition of prime numbers. It could be possible to redo definitions and theorems in number theory so that 1 is a prime number, but it would require adding nitpicky caveats to the existing theorems like 'every positive integer has unique prime factorization'. Similarly I think that definitions and theorems in probability theory could be redone so that the mean is the principal value mean, but this would requiring adding nitpicky caveats to theorems like the laws of large numbers. I'm not sure if this is correct, but if it is then it could be a better reason than rigor for the sake of rigor.

@josef-pkt
Copy link
Member

It's not math or engineering, it's statistics and probability theory

Wikipedia mentions that the law of large numbers doesn't hold in this case

>>> rvs = np.random.standard_t(2, 1000000)
>>> rvs.mean()
0.0015866917880266631
>>> rvs = np.random.standard_t(5, 1000000)
>>> rvs.mean()
0.00059190547465306641
>>> rvs = np.random.standard_t(50, 1000000)
>>> rvs.mean()
0.00078361448965023927

>>> rvs = np.random.standard_t(1, 1000000)
>>> rvs.mean()
-2.4484819996823868

use case:

Theorem

Assume the first 4 moments exist and are finite, then the following holds

blabla

@josef-pkt
Copy link
Member

And as practical consequence

The unit tests exclude some checks, or excluded them, when a moment is inf or nan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants