Statistics101 executes programs written in an enhanced version
of the easy-to-learn Resampling Stats language. Resampling Stats is a
statistical simulation language. You write a program in the language,
describing the process behind a probability or statistics problem. Statistics101 then executes that program, computing probability and statistics answers without using mysterious formulas. Statistics101
runs your Resampling Stats model thousands of times, each time with
different random numbers or samples, keeping track of the results. When
the program completes, you have your answer.
As a very simple example, say you wanted to know the probability of
getting exactly two heads in a toss of three coins. You could toss
three coins many times, counting the number of times you got exactly
two heads and dividing by the number of tosses. That would take
considerable effort and time. You could also calculate it precisely if
you knew the correct formula. Instead, with Statistics101, you could model that process as follows:
URN (0 1) coin
REPEAT 1000
SAMPLE 3 coin toss
COUNT toss =1 heads
SCORE heads results
END
COUNT results =2 successes
DIVIDE successes 1000 probability
PRINT probability
The program simulates 1000 tosses of three coins and prints out the resulting probability. The output looks like this:
probability: 0.368
Here's what the above program is doing:
Put the numbers 0 and 1, representing tails and heads, into an "urn" named "coin".
Repeat the following three commands 1000 times:
Take three samples at random, with replacement, from the "urn". This is equivalent to three tosses of a coin.
Count how many of the tosses were equal to 1 (i.e., heads).
Record the number of heads in the "results" vector or list.
Count how many of the 1000 results in the results vector were equal to two, i.e., two heads.
Calculate the probability by dividing the number of successes by the number of trials (1000).
Print the probability.
For much more on how to apply Statistics101 to probability and statistics problems, see the links in the right column of this page.
|