NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Curricular Models/ProbLab

(back to the library)

Histo Blocks

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model is a part of the ProbLab curriculum. The ProbLab Curriculum is currently under development at the Embodied Design Research Laboratory (EDRL), University of California, Berkeley. For more information about the ProbLab Curriculum please refer to

Histo-Blocks is a model for exploring the binomial function. The random generator is a "4-Block," a 2-by-2 matrix, in which each of the four squares independently can be either green or blue. The 4-Block is thus just like four coins that each can land either on heads or tails, only that here you can easily adjust the collective chance of these four independent singleton events. For instance, you could adjust the model so that it will behave like four coins that each has a .6 chance of landing on heads. The model shows connections between the random generator's sample space, probabilities of its singleton events, its expected outcome distribution, and the binomial function.

(This model is on theoretical probability only -- not empirical probability -- so there is no simulated experiment here.)


The View displays the 16 unique elemental events of the green/blue 4-Block, arranged in five columns by the number of green squares in each permutation (0 through 4). Labels on each of the singleton green squares show the current p value, and labels on the blue blocks show the complementary (1 - p) value. The p value can be changed using a slider that is below the View. When you click and hold the mouse button over a column in the View, three monitors to the left of the View display information: the number of blocks in that column (n-choose-k), the compound probability of each of the blocks in that column (the product of the probabilities of the four independent singleton events), and the product of these two latter components. This product -- the number of blocks in a column multiplied by the probability of each block in the column -- represents the chance of randomly getting any one of the blocks in that column, when you operate the random generator (that is, the chance of getting the combination regardless of the particular permutation). For example, the chance of getting any 4-Block with exactly 1 green is the same as the chance of getting exactly one heads when you toss four coins.

The plot shows a special histogram, in which each column is partitioned equally into as many parts as there are blocks in its corresponding View column, below. For example, the "2" column in the histogram in partitioned into 6 equal segments, because there are 6 unique 4-blocks that have two green squares in the block. Whereas the blocks are equal in height within the columns, they differ in height between columns (for p values other than .5). The relative heights index the compound probability. So the histogram blocks -- the "histo-blocks" -- feature both factors at play in the binomial function: the n-choose-k coefficients are represented by the number of blocks in the column, and p^k * (1 - p)^(n - k) is represented by these blocks' individual heights.


Press on SETUP, then GO. Now, grab the slider and change the p value.

Buttons: SETUP builds the "combinations tower" in the View. GO enables the functioning of clicking on the screen and of the slider.

Switch: PLOT-INDIVIDUAL-BLOCKS? toggles between having or not having the histogram partitioned. AUTO-ADJUST-Y-AXIS? when set to 'On,' the histogram will keep adjusting for new p values so that the tallest column reaches to the top. When off, the max y value is 1.

Sliders: P sets the p value.

Monitors: When you click and hold down the mouse button over a given column in the view, the NUMBER OF ITEMS IN THIS COLUMN, PROBABILITY OF EACH ITEM IN THIS COLUMN, and N-CHOOSE K * COMPOUND P monitors update to provide information about that column.


Note the probability values appearing in little labels on the squares. Also note the shape of the histogram. Both the labels and histogram change with p.


Set the p value (on the slider) to .6. Looking at the plot, what is special about this p value? Can you find other p values that give this same effect? With p set to .6, click anywhere on the middle column (2-green column). Observe the monitors. Now, with the mouse still down, drag the mouse one column to the right. What happened in the monitors?

Set the auto-adjust-y-axis? to 'Off,' and slide the p value. Look at the histogram as you do this. What is happening to the histogram? -- What is changing?; What is not changing? What does this mean, in terms of the probabilities?


Add empirical functions to the model: create another histogram that shows actual outcomes of a simulated probability experiment with a 4-block (a sample of 4 independent events that each take on one of two possible values). Place this new histogram on the interface such that it will readily compare to the histo-block histogram. You can partition this histogram, too, according to sub-groups in the outcomes.


This model uses a special procedure in order to partition the histogram columns.


Several of ProbLab's models are related to Histo Blocks, notably Sample Stalagmite.


Thanks to Dor Abrahamson for his work on the design of this model and the ProbLab curriculum. Thank you to Josh Unterman for his talent and work on producing this model.


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 2009 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit 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

(back to the NetLogo Models Library)