Simulation: Independent variables

This page shows how the χ2 distribution is used to find the p-value for testing independence. The p-value is the probability of getting a value of the test statistic as large as the one recorded (assuming independence).

The simulation is for independent variables (null hypothesis). Explain how the p-value is the blue tail area of the χ2 distribution.

Take a few samples. Mention that:


An 'unlucky sample' might mislead you into erroneously concluding that the variables are dependent.