Home Download Help Resources Extensions FAQ References Contact Us Donate Models: Library Community Modeling Commons User Manuals: Web Printable Chinese Czech Japanese Spanish

NetLogo Models Library: 
If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.) 
This model simulates a binomial probability distribution or (in the limit) normal distribution. It works by analogizing height variations to rabbit hops.
This model was created by a student in an effort to make sense of normal distributions. In particular, he sought to understand why height is distributed normally in human populations. For a detailed account of this case, see: Wilensky, U. (1997). What is Normal Anyway? Therapy for Epistemological Anxiety. Educational Studies in Mathematics. Volume 33, No. 2. pp. 171202. http://ccl.northwestern.edu/papers/normal/.
The procedures for this model have been kept largely intact from the original code written by the student. With advances in the language, this code is no longer at all an optimal way of writing this model. We have kept the original code for research purposes  please do not use it as an example of good NetLogo coding.
A number of rabbits are placed at the center of the bottom of the world. A move pattern determines the way a rabbit moves. Each rabbit can choose to hop right or left a certain hopsize. The likelihood of a rabbit following each move pattern is given in terms of ratios. Each rabbit may have up to five different move patterns.
Method one (sliders setup): Press SETUP button. This creates the number of rabbits from the NUMBER slider and up to three hops and associated probability ratios from the six sliders above the NUMBER slider. Each time a rabbit hops, it chooses one of the three moves  hop1, hop2, or hop3  with a likelihood in the ratio of ratio1, ratio2, and ratio3 to each other. For example, if ratio1 = 2, ratio2 = 4, and ratio3 = 6, the rabbit has a 2in12 chance of making the hop1 move, a 4in12 chance of making the hop2 move, and a 6in12 chance of making the hop3 move.
Method two (manual setup): In the Command Center, type "setup [number] [list of hops [list of probability ratios]" to initialize the rabbits (e.g. "setup 4000 [1 1] [1 2]" will set up 4000 rabbits hopping either one unit to the right(1) or one unit to the left (1) with a chance of hopping to the left being twice as much as that to the right.) Up to five steps and corresponding probability ratios can be used.
The GOONEHOP button makes each rabbit hop once.
The GO button tells the rabbits to hop the number of times set by the HOPS slider. For example, if HOPS is set to 10, the GO button makes each rabbit hop 10 times. To stop the rabbits from hopping once they've started, press the GO button again.
There are two scale monitors and one scale slider in the Interface Window. XSCALING is used to magnify the width of the world to facilitate more hops. It is manually set by users with the XSCALING slider. The setting can be changed as the model runs. YSCALE is used to regulate the vertical scale  to ensure that the highest yellow distribution bar is always 80% of the height of the world. This is done at each hop.
The figure inside the "yscale" monitor is the number of rabbits a yellow line the height of the world represents. The figure inside the "xscale" monitor is the number of steps represented by a full view. (The rabbits wrap around the left and right edges, so if they get to the edge, you should increase the xscale.)
The following formulae can be used to evaluate the actual numbers of rabbits or steps hopped:
Actual Number of Rabbits for a Yellow Line = height of line * ( yscale / 100 )
Cumulative Number of Steps Hopped so far = Xcoordinate of a line * ( xscale / 100 )
To find out exactly how many rabbits are represented by a line, controlclick (Mac) or rightclick (other) anywhere on the line and choose inspect patch from the menu that appears. The inspector will have a variable "turtlebottom" which will tell you how many turtles (rabbits) are at the bottom of the line.)
The purple average line shows where an average rabbit would be. Observe the movement of this line  both its position and velocity  and try to relate these to the settings.
Play with the NUMBER slider to see if what you predict is what you see when the number of rabbits is small. For what numbers of rabbits are your predictions the most accurate?
Try different values for list of steps. What happens to the distribution?
Try different values for probability ratios. What happens to the distribution?
Is the distribution always symmetric? What would you expect?
Create a plot for 'hopping'. First decide what to plot, and then implement the proper NetLogo plot functions. Rewrite the model so rabbits take list variables. Are there now new capabilities you can give the rabbits?
The limitation on the number of turtles constrains the limits of the "number" slider. You can make the corresponding change to the number
slider  select the slider by clicking and dragging the mouse button over it. Then click on the edit button and change 'Maximum' to the new number. Having more rabbits to jump can be useful for certain statistical simulations.
You can also change the settings to have a bigger world to fit more hops or show very fine distribution diagrams.
Note that since turtles could not have list variables in earlier versions of the language, the global lists steps and ratios are used to hold the movement patterns and ratios. The turtles access these globals to know how to move. (if we were writing this model now, we would not code it this way as turtles in NetLogo can have list variables). The procedures definesteps
and 'defineratios' use the primitives first
and butfirst
. Both of these are list operators  that is, they operate on lists of things. The first
of a list is simply its first element. Likewise, the butfirst
of a list is a list of all elements except for the first.
Galton Box, Random Walk Left Right
See: Wilensky, U. (1997). What is Normal Anyway? Therapy for Epistemological Anxiety. Educational Studies in Mathematics. Volume 33, No. 2. pp. 171202. https://ccl.northwestern.edu/papers/normal/
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 1997 Uri Wilensky.
This work is licensed under the Creative Commons AttributionNonCommercialShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/byncsa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECTBASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program)  grant numbers RED #9552950 and REC #9632612.
This model was developed at the MIT Media Lab using CM StarLogo. See Wilensky, U. (1993). Thesis  Connected Mathematics: Building Concrete Relationships with Mathematical Knowledge. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project. Adapted to NetLogo, 2001, as part of the Participatory Simulations Project.
This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORKBASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs)  grant numbers REC #9814682 and REC0126227. Converted from StarLogoT to NetLogo, 2001.
(back to the NetLogo Models Library)