Calculating p-value

Based on Chapter 1 of the Statistical Sleuth, showing that given two lists to be compared, we can calculate all possible groupings given the same combined list of subjects.

How to calculate that?

From Online Stat Book: Permutations:

If you have three colored balls, you can order them in ``n!`` ways. (read n factorial). Ie. four balls = 24 possible sequences.

Factorial (factorial(n) in Julia): 4 = 4 * 3 * 2 * 1

3 soups, 4 dinners, 5 deserts. How many meals? 3 * 4 * 5

Permutations are when you have four colored balls, and choose two randomly, and order matters

The number of possible permutations are: `` " "_n P_r = "n!" / "(n-r)!"`` – number of permutations of n objects taken r at a time

When we don't care about the order, we are looking for combinations

Number of possible combinations ``" "_n C_r = "n!"/"(n -r)!r!"`` – number of combinations of n objects taken r at a time

In Julia

function nocomb(n, r)
    factorial(n) / ( factorial(n-r) * factorial(r) )
end

And you generate all combinations with

combinations([1,2,3,4], 2)

which returns an iterable, use collect to return, or iterate (for e in …)