NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)


This is a simulation of falling marbles to illustrate certain points about statistics and modeling.


Marbles fall from the top and bounce over pegs to the left or to the right. At the bottom they are collected into bins. The distribution of marbles across bins can be observed and modified by applying a "bias" to some of the pegs.

When there are no biases, the resulting distribution approximates a Gaussian (or "Bell-shaped" or "Normal" distribution). Groups of pegs can be biased to the left or to the right by varying degrees.


=== Main Control Buttons ===
- Click "Init" to reset the entire simulation and draw the pegs and the bins
- Click "Go" to start/end the simulation.
- Click "Drop" to start/stop dropping marbles through the hole at the top.

=== Marble Settings ===
- Click "Clear Marbles" to erase all Marbles.
- Use the "max-marbles" slider to determine hoe many marbles to drop (good default is 250)
- Adjust the "drop-rate" slider to determine how quickly marbles drop from the hole.

=== Bias Settings ===
Use these controls to change some of the pegs to be biased to the left or right. Click anywhere over the pegs to bias some of them, based on the various settings.
- Use the "Bias-direction" drop-down to select Left, Right or None.
- Use the "Bias-radius" slider to determine how large of a patch will be biased around the point where you click the mouse.
- Use the "bias-strength" slider to set the bias. For example, when a marble hits a red peg (Right bias) with the slider set to 100%, the marble will always go to the right. At a 0% bias, the marble has a 50-50 chance of falling to the right. [Technically, the probability of the marble going to the right is 0.5*bias + 0.5.]

=== Distribution Settings ===
- Click "Clear Distr" to clear the red dots showing the distribution on the bins.
- Use the "Distribution" drop-down to select one of the following modes:
_* None: do not show distribution, or, if a distribution was being shown, do not change it. Once "Init" or "Clear Distr" are pressed, any remaining distribution will be erased.
_* Dynamic: For each bin, place a dot corresponding to the highest marble stacked on its left (not ideal but gets the point across). This changes dynamically as the marbles drop to match the current distribution.
_* Gaussian: Draw a Gaussian distribution based on the sliders below
_* Manual: Use the mouse to draw a distribution by clicking on individual bins. Note that you can also click-and-drag to draw the distribution.

- Use the "d-mean" "d-amp" and "d-stdev" sliders to set the mean, amplitude and standard deviation of the Gaussian distribution.

=== Additional controls ===
- The toggle "use-rseed" determines whether at initialization the random number generator uses a seed or not. If you want to replicate a run, turn this ON and select a desired seed.
- Use the "r-seed" slider to set a random number seed between 0 and 10
- The "# of marbles" box is a counter showing how many marbles have been dropped.


The main point of this demo is to illustrate the difference between statistical approaches and agent-based or "bottom-up" approaches to modeling.

When there are no biases, it can be shown mathematically that the distribution of falling marbles should approach a Gaussian distribution. In fact, if you run this with about 250 marbles and no biases, you should be able to fit the resulting distribution with a Gaussian with mean 0, amplitude 1 and standard deviation 10.

However, suppose now that someone shows you a distribution which is not Gaussian. Perhaps it is skewed to one side, or even bimodal. A statistical modeling approach would try to find a different mathematical function (perhaps a gamma or beta distribution) and adjust parameters until it minimizes the error between theoretical and empirical distributions. However, this approach doesn't really say anything about WHY the distribution should be the way it is, nor is there any relationship between the mathematical expression for the distribution and the underlying behavior.

In contrast, using a bottom-up modeling approach, we can make speculations about WHY a certain distribution arises. For instance, if you see a distribution where most marbles end up on the right, you can assume that some pegs must be biased to the right. By selecting different pegs you can make adjustments until you get close to the observed distribution.

Conversely, you can make hypotheses about the impact of different biases. For instance, what happens if all the pegs on the right are biased to the right and all the pegs on the left are biased to the left? Is there a difference between biasing the first five rows of pegs versus biasing the bottom five rows of pegs?

Now imagine the pegs representing people expressing opinions about a product. Each "person" decides whether he or she thinks the product is good (right) or bad (left). Each person then expresses that opinion to another person. Now imagine one person is biased in one direction. If that person can also influence many of its friends through word-of-mouth, a big cluster of biased individuals can cause the opinion of the entire population to shift.

Modeling these kinds of effects is nearly impossible with statistical approaches. You might even imagine a more complex situation, in which the bias of individuals is changed gradually over time by watching what other people decided. Bottom-up modeling gives you the ability to test different conditions, and to do so based on direct, intuitive terms, such as "what happens if this group is biased?" or "where is the most effective group to bias?"

By comparison, with a statistical approach you might be able to ask questions like "what if the standard deviation of the distribution increases?" or "what if I use a Gamma distribution instead of a Gaussian?"

In a nutshell, bottom-up modeling gives you the power to explore and understand causality, while statistical approaches at best can tell you about correlations between variables.


The "manual" distribution should place dots at the average between the highest marbles on the left and right sides.

It would be nice to let the bias change as a function of several other factros, such as what other patches are doing, or what information the marbles carry.


This work was created by Paolo Gaudiano and is copyright of Icosystem Corporation. This may not be used for commercial purposes without prior consent of Icosystem. For additional information please visit our web site ( or send mail to

(back to the NetLogo User Community Models)