Select Page

# Central Limit Theorem

This model demonstrates Nova’s ability to process statistical data and create a histogram, and its use of plug-ins. The first submodel ‘coin’ represents a coin being flipped. There is a term ‘flip’ that models the result of a coin toss. Double click the flip term to view the formula flip=(Math.random() < wt) ? 0 : 1, where wt is input from the top-level model. This means that if the random number generated between 0 and 1 is less than wt, flip=0, and otherwise flip=1. If, for example, wt = .5, then roughly half the time flip=0, and roughly half the time flip=1. The stocks ‘heads’ and ‘tails’ accumulate flip totals. If you run 100 flips with a weight of .5, you will get a heads/tails total of around 50/50. Of course the actual outcome cannot be predicted. We now wish to repeat the 100-flip experiment 1000 times, and plot a histogram showing the total number of heads. Clicking Capture, Load, then Exec produces 1000 runs of the 100-flips; at the end of each 100-flip run the total number of heads is recorded in the histogram and displayed in Graph1. With a fair coin, this histogram assumes a Gaussian shape (The Totals table also shows the histogram data). The difference in the two versions is in the technique used to model the histogram.

Version 1
The first version uses second submodel ‘bucket’ to represent each frequency range. A bucket contains a single ‘Bucket’ stock, and its input flow tests whether the input ‘value’ is in the range between ‘lo’ and ‘hi’ before adding 1 to the that stock. In the top-level mode there are 7 buckets centered on 50, each with a 2-integer range: 43-45, 45-47, 47-49, 49-51, 51-53, 53-55, 55-57.

Central Limit Theorem Applet (opens in new tab)