How does randomization testing for correlating two variables work? I was going through OpenIntro Statistics and came across two case studies in the first chapter


*

*Discrimination against women during promotion - Page 42

*Stanford Heart Transplant study - Page 65


How can shuffling of cards determine independence. In the first example, I can understand that when simulated with people for 100 times, the overall randomisation will take care of chance based promotion. Or, am I getting this wrong and just cards are shuffled? However, in the second example there are people who are dead of alive. How can cards be shuffled and create randomisation? 
How is randomisation performed to determine the independence or correlation of variables? 
 A: Judging from the examples, I like the way this is explained in the book. I hadn't seen it before.
Let me explain the second case in some detail.
The point here is to assess whether there is more association in the table between treatment group and outcome that cannot be explained as merely ordinary random variation.
If it is ordinary random variation, the difference in the proportion with the dead outcome should look reasonably like the sorts of difference in proportions you get from randomly generated proportions with the same characteristics.
That is, they fix the table margins (the first by writing one set of cards with the same numbers of alive and dead and the second by splitting the cards at random into two piles for control and treatment that are of the same size as the original groups).
By shuffling the deck before splitting into control and treatment they achieve random assignment to the control and treatment groups in the simulation.
They then simply look at the cards each time to find the difference in the simulated proportions of dead. This shuffling and calculation of difference in proportions tells you what the 'no treatment effect' differences in proportions can look like by chance.
Because the Alive/Dead marking on the cards is unrelated to control or treatment (any association is random) we see how big a difference in proportion can reasonably occur 'by chance'. Then if the difference in proportion for the actual data is pretty typical of the random ones, it easily could be explained as just being another random one. If, however, it's really extreme (in this case, low) for a random one, then we conclude that it wasn't just randomness that was the cause of the association, but instead was the treatment.
