I have been struggling with the following question and would greatly appreciate any help  :)


  Suppose we have information about the supermarket purchases of 100 million people. Each person goes to the supermarket 100 times in a year and buys 10 of the 1000 items that the supermarket sells. We believe that a pair of criminals will buy exactly the same set of 10 items at some time during the year. If we search for pairs of people who have bought the same set of items, would we expect that any such people found were truly criminals? Assume our hypothesis to be that a pair of criminals will surely buy a set of 10 items in common at some time during the year. 


This is meant to be an illustration of Bonferroni's principle. Suppose there are no criminals and that everyone behaves at random. Would we find any pairs of people who appear to be criminals?

We must initially find the expected number of pairs who buy the same 10 items per year. I'm not sure whether I do this correctly...

Here is how I've been going about solving it:

Number of possible pairs of people: $\binom{10^6}{2} = \frac{10^{12}}{2} = 5 \times 10^{11}$, using the fact that $\binom{n}{2} \approx \frac{n^2}{2}$, when $n$ is large.

Number of possible 10-item selections: $\binom{10^3}{10} \approx 2.6 \times 10^{23}$

Probability of a customer buying 10 particular items at a point in time:
$\frac{1}{2.6 \times 10^{23}}$

Probability of a customer buying 10 particular items at least once over the course of 100 periods in time: $\frac{100}{2.6 \times 10^{23}}$

Probability of a pair buying exactly the same 10 items (both at least once) over the course of 100 periods in time: $(\frac{100}{2.6 \times 10^{23}})^2 = (\frac{1}{2.6 \times 10^{21}})^2 = \frac{1}{6.76 \times 10^{42}}$

The expected number of pairs who buy the same 10 items per year is thus:

$ 5 \times 10^{11} \times \frac{1}{6.76 \times 10^{42}} = \frac{5}{6.75 \times 10^{31}}$

Because the above number is so low if we do find a pair buying the same 10 items then, under our hypothesis, they are likely to be criminals and not a false positive case. 

I am just wondering whether my solution to the above is correct?


Question: Trouble calculating areas in QGIS using field calculator
Answer: Disabling the "on-the-fly" projection setting should yield you the correct results when performing analytics via the Field Calculator:

Project > Project properties > CRS

This bug has been known in early versions of QGIS but has mostly been resolved since QGIS 2.1.