Resampling Stats At A Glance
Here's a Resampling Stats program that solves the problem: "A drug company claims that its acne medicine is 90% effective in curing pimples. You try it on 10 pimples and it works on 7. What's the probability it could do that poorly if it is indeed 90% effective?"
This translates as follows:
- Create a vector (a list of numbers) called "hat" with nine "1's" and one "0." Then repeat the following 1000 times:
- Sample 10 values from "hat," call this vector "samp"
- Find out how many "1's" there are in samp.
- Keep score of this result in "scrboard" (a cumulative recording of each trial)
- Produce a frequency histogram of the results (the number of "1's" in each trial).
We could use the following command to find out how many of our 1000 trials had 7 or fewer "1's"
COUNT scrboard <=7 result
We would divide "result" by 1000 to get the estimated p-value. In this case it's .07 - just shy of statistical significance.
More Examples