Sunday, January 06, 2019

[wetcelbr] Statistics of permutation inversions

The number of inversions in a random permutation of n items is normally distributed with parameters

mean = binomial(n,2)/2
variance = n(n-1)(2n+5)/72

This is from "Normal Approximations for Descents and Inversions of Permutations of Multisets" by Mark Conger and D. Viswanath, though these results are not the main subject of the paper.

Normal is only an asymptotic approximation. The bizarre paper "Permutations with Inversions" by Barbara Margolius discusses some aspects of how much the actual distribution differs from the normal approximation.  The paper is bizarre because, even though its main subject is this normal approximation, it does not explicitly give the expressions for the parameters above.  Maybe Margolius was trying to conceal the answers to a homework problem?

How computationally difficult is it to exactly compute the distribution?  Typically we want the p-value of a given number of inversions x.  Naively this would require summing from x to n! which is at least O(n!) work, too much.

What are some two-tailed confidence intervals for permutations of 52 items, at 90% 95% 99%?

Obviously, this can be used to statistically test how good your card shuffling is: are there large subsets of cards which remain in order (or reversed)?  Many common shuffling methods obviously have this problem when done too little.

What are some simple permutations which are obviously not random but don't have an unusual number of inversions? Perhaps they exactly hit the expected number of inversions given above.  I don't think the following works: cut a deck exactly in half, reverse the order of one half, then put the halves together.

No comments :