Simulation-Based Hypothesis Test for a Difference in Proportions – Learn It 3

  • Complete a randomization test involving a difference in proportions

Simulation-based Hypothesis Tests

All simulation-based hypothesis tests follow the same general steps:

  1. Set up the null and alternative hypotheses based on the research question.
  2. Simulate a large number of samples (usually [latex]1,000[/latex] or more) under the assumption of the null hypothesis, calculating a sample statistic for each simulated sample.
  3. Plot the simulated sample statistics with a histogram and compare the original observed statistic to the plot.
  4. The proportion of simulated statistics as or more extreme than observed is the estimated P-value.

Let’s simulate a large number of samples under the assumption of the null hypothesis using the statistical tool below.

Step 1: Under “Data Entry & Descriptive Statistics:”

    • Select “Contingency Table” under “Enter Data.”
    • Type “Peanut” for the row variable, with “Avoiders” and “Eaters” for the category labels.
    • Type “Conditions” for the column variable, with “Allergic” and “Not allergic” as the category labels.
    • Enter the table below:
  Allergic Not allergic
Peanut avoiders 35 220
Peanut eaters 5 240

Step 2: Now select “Permutation Distribution” in the top right. You should see the contingency table you entered as the “Observed Contingency Table.” Check “Conditions” under “Permutate Labels of” and then generate a [latex]1000[/latex] permutation of the data.

Step 3: The plot of the simulated differences in proportion can be found at the bottom of the “Permutation Distribution” tab. This plot is called a simulated null distribution of differences in sample proportions.

Optional: You may use the “Change binwidth of histogram” and adjust the sliders to create a more detailed histogram by selecting a smaller binwidth.


[Trouble viewing? Click to open in a new tab.]