Predictions, Observations, Tables, Graphs, and Statistics for the Dice-Rolling Laboratory
by Professor Stephen T. Abedon Steve Abedon, Ph.D., has taught well over 100 individual classes and ~10 individual courses (including introductory biology, microbiology, physiology, biochemistry, etc.) over his 30+ years as a college professor. He has over 150 publications, including multiple monographs, and is ranked in the top 1 or 2 percent among researchers of all disciplines worldwide. His research focuses on bacteriophage biology and phage therapy. (abedon.1@osu.edu)
phage.org | phage-therapy.org | biologyaspoetry.org | abedon.phage.org | google scholar | publications
Jump to: 🎲 Roll Some Dice | 📖 Definitions | 🧠 Theory | ➗ Practice | 📋 Enter Rolls | 📊 Tables | 🏫 Class Pool | ✏️ How to Graph | 📈 Graphs | 🧪 Statistics | ❓ Do You Understand? | 🧮 More Calculators
biologyaspoetry.org/laboratories/probability/ · Abedon’s Books
How can I improve this page? contact: probability@biologyaspoetry.org
This page could simply tell you that the chance of throwing a 4 is one in six. Instead, throw a die and watch the number appear. Everything on the tabs that follow is easier once the numbers have been seen arriving rather than announced.
There are five experiments below, and they are meant to be done in order. The first three watch one thing at a time: a chosen face on one die, then a chosen ordered pair on two, then a chosen total. The last two watch everything at once: all eleven totals as bars, then all thirty-six ordered outcomes as a grid. Each works the same way. You pick something to look for, you make the dice roll — one roll at a time by hand, by clicking the graph itself, or automatically if you would rather watch — and the graphs draw themselves as the rolls accumulate. The graphs are the point. Watch the wobbling line settle.
Nothing on this tab is saved or recorded. It is a place to play. The rolls that count toward the exercise are entered on the Enter Rolls tab.
Three recordings of this material being taught in a room, by the author of the laboratory. The first builds the theory from nothing on a blackboard; the second drives this very page and shows what every control on the tab above is for; the third is the graphing half of the same class. None is required, and the experiments above do not wait for them — but if you would rather be told than read, start here.
even if your observations are all going to be whole numbers like whole people.
use up as much of the graph real estate as you can,which is the rule the How to Graph tab states as the data filling the plotting area. Its definition of the dependent variable is sharper than this page's —
the thing that may or may not change as we change the independent variable— because an experiment where nothing happens is still an experiment.
Pick a number from 1 to 6. The question is how often a single die comes up as that number. Almost everyone can guess the answer, but guessing it and watching it are different experiences, and the second one is the useful one.
Now two dice, and a harder target: a particular number on the first die followed by a particular number on the second. A 2 and then a 3, say. Order matters here, so a 3 and then a 2 does not count as a hit — set the two selectors the other way round and you are asking a different question.
Before rolling, guess how much rarer this is than Experiment 1. Then roll and find out. Most people guess too low.
Last, the quantity the handout actually uses: the two numbers added together. Pick a total from 2 to 12 and count how often the pair comes to it.
Try 7 first, then try 2, and compare how long each takes to settle and where each line ends up. The two are not equally likely, and this is the experiment that shows it before the Theory tab explains it. If the eleven totals were equally likely, every one of them would settle at about 0.09, which is one in eleven. Watch whether they do.
The first three experiments watched one thing at a time. This one watches all eleven totals together. There are eleven empty bars, one for each total from 2 to 12, and every roll adds a brick to whichever bar matches the total it threw. Roll by hand to place bricks one at a time, or set it running and watch the shape build.
Two things to try. First, press Roll Until All Eleven Appear and notice how many rolls it takes before every bar has at least one brick — the 2 and the 12 keep you waiting a long time, and that is the whole difficulty the exercise runs into at twenty rolls. Second, change the ordering of the bars.
One more, and it is the one the whole laboratory rests on. Experiment 4 sorted the rolls into eleven bars by their totals. This one sorts the very same kind of rolls into thirty-six cells by what each die actually showed. The row is the first die, the column is the second, so a 2 then a 5 goes in a different cell from a 5 then a 2.
Roll for a while and compare the two pictures. The eleven bars were wildly unequal, with 7 towering over 2 and 12. These thirty-six cells are not unequal at all: every one of them expects exactly the same count, the number of rolls divided by 36. Whatever unevenness you see here is noise, and it is worth staring at that unevenness for a moment, because it is what honest randomness looks like.
Nothing is being taught here. It is a die tumbling in slow motion, and it is on the page because it is worth looking once at the thing the rest of this laboratory is a model of. Everything on the other tabs rests on the claim that nothing about that tumble favors one face over another.
Four things, and the rest of this page assumes all four. None of them had to be taken on trust; each one was on the screen.
With that in hand, the vocabulary on the next tab has something to attach itself to.
Probability has a vocabulary that overlaps with ordinary English without quite matching it, and most of the confusion students meet in this laboratory comes from that overlap rather than from the arithmetic. The list below is worth reading once before the exercise and once again afterward, when the words have something to attach themselves to.
Die (plural dice). A cube whose six faces carry one through six dots. A fair die is one for which every face is equally likely to end up on top. Six faces, none of them favored, means the chance of any one of them is one out of six: 1/6, or 0.1667, or about 17 rolls in every 100. A die that is not fair is loaded, whether deliberately, through a manufacturing defect, or because it is being rolled onto a surface that favors one face. Fairness is an assumption about the world, not a property of the mathematics, and the last part of this page is devoted to how one would test it.
Trial. One performance of the random procedure — here, one roll. Sample size, written n, is the number of trials. In this exercise a trial is a roll of a pair of dice, so n = 20 means twenty pairs, which is forty individual dice.
Outcome. One of the indivisible things that can happen on a trial. For two dice that can be told apart there are thirty-six outcomes, one for each pairing of a face on the first die with a face on the second: six choices for the first die, times six choices for the second, which is 6 × 6 = 36.
Sum. The number on one die added to the number on the other. If the dice show 3 and 5, the sum is 8. The sum is what most of the handout's tables are built from, and it is worth being exact about how many sums there are. The smallest is 1 + 1 = 2; the largest is 6 + 6 = 12; every whole number from 2 to 12 can be thrown. Written out, the possible sums are 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12 — eleven possible sums in all. Two things to notice. A sum of 1 is impossible, because the lowest either die can show is 1 and there are two of them. And although there are thirty-six outcomes, there are only eleven sums, because many different outcomes give the same sum: (3, 5), (5, 3), (4, 4), (2, 6), (6, 2) all come to 8. That is the whole reason the eleven sums are not equally likely.
Sample space. The complete list of outcomes. Writing it down is the single most useful thing one can do when a probability question turns confusing, and it is what the grid on the Theory tab is. Every probability question in this laboratory can be answered by counting cells in that grid, with no formula at all.
Event. Any collection of outcomes that one chooses to care about — “the sum is 8,” “the two dice differ,” “at least one 5.” An event is a region of the sample space, and its probability is the fraction of the space it covers.
Mutually exclusive. Two events are mutually exclusive when they cannot both happen on the same trial. “Sum of 7” and “sum of 8” are mutually exclusive. “Sum of 7” and “at least one 5” are not, because (2, 5) satisfies both. Mutual exclusivity is the condition the addition rule needs, and it is not the same thing as independence, which is the next entry. Keeping the two apart is worth the effort: they are the most commonly swapped pair of words in the subject.
Independent. Two events are independent when knowing that one happened tells you nothing about whether the other did. The two dice in this exercise are independent: the first die has no way to learn what the second one did. Independence is an assumption about a mechanism, and it is the assumption that fails most often in real biology — which is why the word appears so frequently in the rest of this page. Note that an independent variable, the thing plotted on a horizontal axis, is a completely unrelated use of the word; the How to Graph tab has a box on the collision.
Dependent (also conditional). The opposite: knowing that one event happened does change the probability of the other. Drawing a second card from a deck with the first one still out is the standard example, and sampling anything from a small population is the biological one. Dependence does not break the multiplication rule, it only means the general form of it is needed; the Theory tab works that out under What to Do When Independence Fails.
Conditional probability. The probability of one event given that
another has happened, written P(B | A) and read the probability of
B given A.
The vertical bar means given, not divided by. For independent
events P(B | A) is just P(B), which is what independence
means stated in symbols.
Multiplication rule. When two things happen independently, the probability that both happen is the product of their separate probabilities. Rolling a 3 and then a 2 has probability (1/6) × (1/6) = 1/36. Multiplication is the rule for and, and is also called the law of multiplication. It has a general form that drops the requirement of independence, P(A and B) = P(A) × P(B | A), worked out on the Theory tab.
Addition rule. When two events are mutually exclusive, the probability that one or the other happens is the sum of their separate probabilities. Getting a 3 then a 2, or a 2 then a 3, has probability 1/36 + 1/36 = 2/36 = 1/18. Addition is the rule for or, and is also called the law of addition. It too has a general form that drops its requirement, P(A or B) = P(A) + P(B) − P(A and B), which subtracts the overlap that plain addition would count twice. Both rules work the same way: state the easy version with its condition, then drop the condition and pay for it with one extra term.
Complement rule. The probability that an event does not happen is 1 minus the probability that it does. It earns its own name because it turns an awkward count into an easy one. “At least one die shows a 5” is painful to count forwards and cannot be reached by adding 6/36 and 6/36, since those two overlap in the cell (5, 5). Counted backwards it is almost nothing: neither die shows a 5 with probability (5/6) × (5/6) = 25/36, and everything else is the event wanted, so the answer is 1 − 25/36 = 11/36. Whenever an event is hard to count, the thing it leaves out is often easy, and the two must add to 1.
Order matters, or it does not. This is the distinction the exercise is built around. If (3, 2) and (2, 3) count as different results, order matters and there are thirty-six results. If they count as the same result, three things follow at once: order does not matter, several ordered outcomes collapse into one, and the probabilities of those outcomes add. Sums are the most familiar way of not caring about order: a sum of 5 does not record which die contributed what.
Prediction (also expectation, also expected value). What the model says should happen, computed before looking. For a count, the expected number is the sample size multiplied by the probability: E = np, where E is the expected count, n is the number of trials, and p is the probability of the event on any one trial. Expected values are routinely fractional. Expecting a total of 0.56 rolls of snake eyes in twenty trials is not a mistake and does not need rounding; it is the long-run average of a quantity that is always a whole number in any single experiment.
Observation. What actually happened, counted. Observations are whole numbers here, and they are not wrong when they disagree with the prediction. A prediction and an observation are different kinds of thing, and the entire enterprise of statistics exists to say how much disagreement between them should be tolerated.
Deviation (also residual). Observed minus expected, O − E. It carries a sign; the sign is informative and is discarded only deliberately, by taking the absolute value or by squaring.
Stochastic. Governed by chance. A stochastic process gives different answers on repetition even when nothing about the setup has changed. Its opposite is deterministic. Biology is stochastic at every scale that matters here: which sperm reaches the egg, which allele goes into which gamete, which cell mutates, which bacterium a phage happens to encounter.
Variance and standard deviation. Two measures of how widely a stochastic quantity scatters around its average. Variance is the average squared deviation; the standard deviation is its square root, which has the advantage of being in the same units as the thing measured. The handout uses the word variance informally for a sum of absolute differences, which is a legitimate measure of scatter but strictly, statistically, is not the variance; the Statistics tab computes both and keeps them apart.
Law of large numbers. The statement that as the sample grows, the observed fraction converges on the true probability. Note carefully what it does not say: it says nothing about the observed count getting closer to the expected count. The count usually drifts further from its expectation as the sample grows, and the exercise you are about to do demonstrates exactly that.
Null hypothesis. The dull explanation, held onto until the data make it untenable. Here it is that the dice are fair and independent, and that any gap between observation and prediction is chance alone.
Goodness of fit. A test asking whether one set of observed counts is consistent with a set of expected counts. The chi-square test is the classic one, and it is the test a geneticist reaches for when a cross gives 84 tall and 30 short instead of the 85.5 and 28.5 that a 3 : 1 ratio predicts.
p-value. The probability of seeing a discrepancy at least as large as the one observed, if the null hypothesis is true. Small p means the data sit awkwardly with the model — and the model here is the null hypothesis itself, the assumption that the dice are fair and independent. A small p is not the probability that the model is wrong, and it is not the probability that the result happened by chance. Those two misreadings — that the model is wrong, or that the result happened by chance — are so common that they have their own literature.
Degrees of freedom. The number of counts in a table that are free to vary once constraints are imposed. Eleven possible sums whose counts must total n give ten degrees of freedom: fix any ten and the eleventh is determined.
Negative control. A condition in which the effect being looked for is known to be absent, run so that the experiment can be caught if it produces an effect where none exists. Fair dice are the negative control of this exercise: every departure from expectation that they produce is, by construction, noise, which makes them the standard against which a real departure would have to be judged.
Dice are a stand-in, and the thing they stand in for is most of quantitative genetics and a good deal of microbiology besides. The two rules that this laboratory teaches are the two rules that Mendelian genetics runs on, and they are applied there in exactly the form practiced here.
The laboratory exercise can be completed with a die, a pencil, and the handout, and that is how it is meant to be done: rolling a physical die and writing the result down is part of the point, because it puts a real stochastic process in the room rather than a simulated one. This page is not a replacement for that. It is what you use afterward, when twenty rolls of two dice are sitting on the page in front of you and the question becomes what they mean.
Everything here also works in the other direction: rolls can be generated on request, in any quantity. Generated rolls are no substitute for the exercise itself, the whole point of which is to roll real dice, but they are indispensable for the analysis that comes afterward. Once one can produce ten thousand imaginary classrooms in a second, questions that were unanswerable with a pencil — how unusual is a discrepancy this large? how many rolls would it take to catch a die that is loaded by ten percent? — become simple matters of counting.
Your answers are kept as you go. In most browsers they are still here if you leave and come back on the same device, though a private window, a different device, or cleared browser data will start you fresh. When you are done, download a summary to hand in or keep. It lists your answers and, for each, whether it was right the first time.
There is a temptation to treat probability as a subject made of formulas that have to be memorized and then matched to problems. It is not. For a situation as small as this one — two dice, and 6 × 6 = 36 possibilities — there is exactly one idea, and every formula in the exercise is a shortcut for applying it:
The catch is the phrase equally likely. It is true of the thirty-six ordered pairs of faces, and it is emphatically not true of the eleven possible sums — the totals 2 through 12, which come to eleven numbers when you count them. That is the single most common error in this laboratory. There is no rule against working with sums; there is only a rule against assuming that eleven possibilities means one chance in eleven. So the list is written in terms of the things that are equally likely, and everything else is counted from it.
Below is the complete list of what two dice can do. The row says what the first die — call it student A's die — showed; the column says what the second die, student B's, showed. Six rows and six columns make 6 × 6 = 36 cells, and each of those thirty-six cells is one outcome, every one as likely as any other. The number printed in a cell is the sum of its row and its column. Choose an event and the cells belonging to it are outlined.
The grid has thirty-six cells because there are six ways for the first die to land and, for each of those, six ways for the second to land. Six sixes is thirty-six. That is the whole derivation, and it explains the rule rather than asserting it: multiplying probabilities is what counting a grid does when the grid is expressed as fractions instead of as cells.
A 3 followed by a 2 occupies one cell out of thirty-six, and (1/6) × (1/6) = 1/36 says the same thing.
The rule extends to any number of independent steps, and it extends by multiplying one more time for each step. Three dice, for instance. The first can land six ways; for each of those the second can land six ways, which is already 6 × 6 = 36; and for each of those thirty-six the third can land six ways, giving 6 × 6 × 6 = 36 × 6 = 216 outcomes, each with probability 1/216. Ten flips of a coin work the same way with a 2 in place of each 6, because a coin has two sides rather than six faces: two flips give 2 × 2 = 4 outcomes, three flips give 4 × 2 = 8, and carrying on doubling once per flip — 16, 32, 64, 128, 256, 512 — the tenth flip brings it to 1,024. Each extra step multiplies the number of outcomes rather than adding to it, which is why the totals grow so quickly. A phage that must adsorb, inject, and replicate successfully is the same arithmetic in biology: its probability of getting all the way through is the three separate probabilities multiplied together, provided the three are independent.
The rule above does not simply stop working when events are dependent. It generalizes, and the general form is worth knowing because in biology dependence is the normal case and independence the lucky one.
P(B | A) is called a conditional probability. Read the formula aloud and it is almost obvious: the chance of both is the chance of the first, times the chance of the second in the world where the first already happened. Independence is simply the case where that second world looks like the first — where P(B | A) = P(B) — and the formula collapses into P(A) × P(B). The two dice are that case: the second die does not care what the first did, so the conditional probability is just 1/6 and the general rule and the simple one give the same 1/36.
Cards are the standard counterexample because the deck remembers. Drawing a king and then a queen, without putting the king back, is (4/52) × (4/51) — four queens among the fifty-one cards that remain — which is 16/2652, or 0.60 percent. Treating it as independent would give (4/52) × (4/52), which is wrong, though here only slightly.
It is not always slight, and the case where the error grows large is the one a biology class actually meets: a small population sampled without replacement. Suppose a cross yields eleven offspring and three of them are homozygous recessive, and you pick two of the eleven at random to grow on. The chance that both are homozygous recessive is (3/11) × (2/10) = 3/55, about 5.5 percent — two of the remaining three among the ten plants left. Assume independence and you get (3/11)2 = 9/121, about 7.4 percent, which is 36 percent too large. The error grows as the population shrinks, which is why it matters in a greenhouse and not at a roulette table.
Now stop caring about which die did what. A 3 and a 2, in whichever order, is now one result. Two cells of the grid have collapsed into one event, and the event is therefore twice as likely as either cell:
So P({3, 2} in any order) = 1/36 + 1/36 = 2/36 = 1/18, twice as large as the ordered version. This doubling is not a special trick for dice; it turns up in genetics under another name, and the next box works that out in full.
One exception is worth stating because it catches people. A doubled result — two 2s, say — occupies only one cell, not two, because there is only one way to get it. A 2 and a 2 in either order is still just a 2 and a 2. So P({2, 2}) is 1/36 and not 2/36. Set the grid above to a specific unordered pair, try two different values and then two of the same, and count the outlined cells: two, then one.
Add the squares up and they come to 9 + 18 + 9 = 36, every square used once, so the three frequencies add to 1 — p2 + 2pq + q2 = 1, which is the whole equation. There is no factor of two on the AA and aa terms for the same reason a double on two dice occupies one square rather than two: there is only one way to be AA, an A egg meeting an A sperm, whereas there are two ways to be Aa.
Change the allele frequency by relabelling the die. Let only face 1 mean A and the other five mean a, so p = 1/6: then AA is 1 square, Aa is 1 + 1 × 5 = 10 squares, aa is 25 squares, and 1 + 10 + 25 = 36 again. Rare alleles are overwhelmingly found in heterozygotes, which falls straight out of the counting: 10 squares carry one A against the 1 square that carries two.
There are eleven possible sums — 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, which is eleven numbers — and they are famously unequal. The reason is visible in the grid: the sums lie along diagonals, and the diagonals are of different lengths. A sum of 2 has one cell, because only (1, 1) will do. A sum of 7 has six cells, because every face value has exactly one partner that completes it: 1 with 6, 2 with 5, 3 with 4, 4 with 3, 5 with 2, 6 with 1. So a 7 is six times as likely as a 2.
Counted off the grid, the number of cells per sum runs 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 as the sum goes from 2 up to 12 — climbing to the peak at 7 and falling away symmetrically. Those eleven counts add to 36, as they must, since every cell belongs to exactly one sum. Anyone who prefers a formula to counting can get the same numbers from 6 − |s − 7|, where the bars mean “ignore the minus sign,” but the counting is the real thing and the formula is only a shortcut for it.
The consequence is a distribution shaped like a tent rather than flat, and this is the first appearance in the course of something that will recur constantly: sums and averages of independent quantities pile up in the middle even when the quantities themselves do not. Push the exercise from two dice to ten and the tent becomes a bell. That tendency is the reason the normal distribution is everywhere in biology — heights, enzyme rates, and measurement errors are all sums of many small independent contributions — and it can be watched happening in a laboratory with dice.
A probability describes one trial. A laboratory produces many, and the quantity actually written in a table is a count. The bridge between them is the shortest useful formula in statistics:
Twenty rolls of two dice, with a sum of 8 arising in 5 of the 36 cells, predicts 20 × 5/36 = 2.78 rolls summing to eight. Nobody has ever observed 2.78 rolls of anything. The expected value is the average over many repetitions of the whole twenty-roll experiment, and its being fractional is a feature: rounding it to 3 would throw away the information that eights are slightly rarer than three-in-twenty, and would make the eleven expected counts stop adding to twenty.
One property of expected values makes them far more useful than they look, and it is worth stating because it is used silently throughout this page. Expected values add. Always, whether or not the things being added have anything to do with one another. The expected total across the eleven categories is just the sum of the eleven expected counts.
Here is that rule in its simplest form. Take one die on its own and ask what number it shows on average. The six faces are 1, 2, 3, 4, 5 and 6, each equally likely, so the average is (1 + 2 + 3 + 4 + 5 + 6) ÷ 6 = 21 ÷ 6 = 3.5. No single roll ever shows 3.5, which is the point about expected values being allowed to be fractional, but across many rolls the average closes in on it.
Now roll two dice and add them. Because expected values add, the average total is simply one die's average plus the other's: 3.5 + 3.5 = 7. That is where the 7 in the middle of the distribution comes from, and it is also the line the second graph in each of the first three experiments on the Roll Some Dice tab settles onto. The useful part is that no counting of the thirty-six cells was needed to get it. Adding the two averages was enough.
Nothing comparable is true of variances, which add only when the things being added are independent. That asymmetry — averages add unconditionally, scatter does not — is why expectation is the easy half of statistics and variance the hard half.
This is the question the last part of the laboratory is really asking, and it has an exact answer. Counting how many of n trials fall in a category with probability p is a binomial situation, and the scatter of that count is known:
For sums of 8 in twenty rolls: p = 5/36 = 0.139, E = 2.78, and the standard deviation is √(20 × 0.139 × 0.861) = 1.55. So an observed count anywhere from about 1 to about 4 is entirely ordinary, and a count of 7 is beginning to be interesting. Anyone who expected the observation to land near 2.78 has not appreciated how coarse a sample of twenty is.
Notice where n sits in that formula. It is inside the square root, so the standard deviation of a count grows as √n. Rather than say what that means, here it is, worked out for a total of 7, where p = 6/36 = 1/6.
| Rolls, n | Expected count of 7s n × 1/6 |
Typical departure from it √(n × 1/6 × 5/6) |
That departure as a share of the expected count |
|---|---|---|---|
| 20 | 3.33 | 1.67 | 50% |
| 200 | 33.33 | 5.27 | 16% |
| 2,000 | 333.33 | 16.67 | 5% |
Read the third column downwards: 1.67, then 5.27, then 16.67. The gap between what you predicted and what you got grows. Read the fourth column downwards: 50 percent, 16 percent, 5 percent. Measured against the size of the thing being counted, the same gap shrinks. Both columns describe one set of experiments, and neither is a trick.
Note how fast each one moves. From the first row to the last the number of rolls is multiplied by 100, and the typical departure is multiplied by 10 — because 10 is √100. The share falls by the same factor of 10, in the other direction. That is what “grows as the square root” buys you: not no growth, and not growth in step with the experiment, but growth at a rate the experiment outpaces.
The proportion behaves in the opposite way. Dividing the count by n divides its standard deviation by n as well, and √n/n is 1/√n:
Both statements are true at once and they are not in conflict. The law of large numbers is the second one. It promises that the observed fraction converges on the true probability; it says nothing about the count, which drifts steadily further from its expectation as the experiment grows. This is why the handout, when it compares twenty rolls with forty, divides the forty-roll total by two before comparing: without that division the larger experiment would look worse, and the wrong lesson would be learned from a correct calculation.
If a fair die has failed to show a 6 in twenty rolls, it is not more likely to show one on the twenty-first. The die has no memory, no ledger, and no obligation. The convergence promised by the law of large numbers is achieved not by correction but by dilution: the early shortfall is not repaid, it is merely swamped by the volume of later rolls, and in the limit it becomes an ever-smaller share of an ever-larger total.
The belief that chance keeps accounts is called the gambler's fallacy, and it has a mirror image that is just as wrong — the belief that a die which has thrown three sixes is somehow hot and will throw a fourth. Both errors come from treating independence as something that ought to be visible in a short run. It is not. What independence guarantees is that the mechanism does not change; it guarantees nothing whatever about streaks, which occur in random data far more often than intuition expects, and whose absence is in fact a reliable sign of data that a human being made up.
a 3 and a 4or
a seven,a lot of people pick the pair, because it is more specific and therefore easier to picture. It cannot be. A seven happens on 3–4, 4–3, 2–5, 5–2, 1–6 and 6–1 — the pair is one of six ways of getting the total, so the total is at least as likely as the pair, always, and here six times as likely. Adding a detail to a description can never make it more probable, only less.
Four short videos on the two rules this tab builds everything out of. None of them is required reading and nothing below depends on them, but if either rule has not yet clicked then watching somebody else say it differently is often the fastest fix. Start with the first one: it covers both rules and then shows what they are for, which is more than the other three do between them. Click a thumbnail to load the video; it plays here on the page.
at least one die shows a 6is not 1/6 + 1/6. Note that it calls the addition rule a rule for mutually exclusive events and then works that case, which is not one. Where it says
odds,read
probability; the distinction has its own box on the Definitions tab.
at least one die shows a 5to 11/36: 6/36 + 6/36 − 1/36, where the subtracted term is the single cell (5, 5).
one rank or one suitquestion is 4 + 13 − 1 = 16. They are the same rule kept in two different books — trim the overlap out of one term before adding, or add everything and subtract the overlap at the end. Counting the thirty-six cells of the grid, which is what this laboratory does, is a third method, and the only one that never overcounts in the first place.
at least one die shows a 5,and it is why the complement is now the third rule listed under Rules on the Definitions tab.
history is the best indicator of the future.For the frequentist point it has just made — that a long run of observed frequencies estimates the underlying probability — that is fair. For the next roll it is false, and it is the gambler's fallacy stated as a maxim: see A Warning About the Word
Dueon the Theory tab. Also, it says there are four ways to make a five and its table shows four, but the list it reads aloud names only three, 1–4, 3–2 and 4–1. The missing one is 2–3, and four is the right count.
These are the questions from the second exercise of the handout, in order. Each one has an answer that can be reached by counting cells in the grid on the Theory tab, and each answer here shows that counting rather than merely reporting a number. Work the question first on paper. The button is there for afterward.
Once a probability is in hand, turning it into a prediction for a given number of trials is one multiplication — and turning it into a statement about how far the observation should stray is one square root. This does both, and shows the arithmetic so that the result can be checked by hand.
Most errors in this material are not arithmetic errors. They are errors about which rule applies, and they happen at the moment a question in English is turned into a calculation. The panel below takes a question apart the way it should be taken apart: does this ask for and or for or, and is more than one path leading to the same place?
Three places in the exercise use language that is fine for a first pass and would not survive a methods section. They are pointed out here not to find fault with the handout, which is doing the right thing for a first encounter, but because noticing the looseness is itself a skill the course is trying to build.
This is the raw record, and it is the only thing on this page that cannot be reconstructed from something else. Every table, every figure, and every test that follows is computed from these numbers, so they are worth entering carefully and checking once before moving on.
The handout asks for twenty pairs of rolls in a first round and twenty more in a second, with each partner rolling one die. Enter what your dice actually did. If you are working through the material without dice in front of you — reviewing before an examination, say, or preparing to teach it — the buttons below will roll for you, and the analysis behaves identically either way.
Rolls can be typed, pasted, or exported. Pasting is the fastest route when the rolls were recorded on paper and someone is reading them aloud, and exporting matters because everything on this page lives in one browser on one machine: a downloaded copy is the only version that survives a different computer. A spreadsheet version of the whole exercise sits below, for anyone who would rather work in Excel than in a browser.
Note stochasticity of result.
The handout puts this well: measure twice, cut once. Three checks take a few seconds each and between them catch nearly every recording error that matters.
Every table below is built from the rolls entered on the previous tab, and every one of them is the same comparison seen from a different angle: what the model said, what the dice did, and how far apart the two ended up. Nothing here is a result yet. Tables of this kind are the raw material a result is made from, and the discipline of laying them out before drawing conclusions is most of what separates an analysis from an impression.
The eleven possible sums, from 2 through 12, with the number of times each was observed and the number of times each was expected. Expected is np, computed from the sample space and not rounded.
The same numbers, reordered so that the expected values increase from left to right: 2, 12, 3, 11, 4, 10, 5, 9, 6, 8, 7. This is the ordering the handout asks for, and the reason for it is worth stating plainly, because it is not obvious.
Sorted this way, the expected values form a staircase that rises steadily from left to right, and the observed values are draped over it. The eye can then do something it cannot do with the natural ordering: judge, at a glance, whether the observations are tracking the prediction across the whole range of likelihood, or whether they are tracking it only where it is easy — near the peak — and wandering in the rare tails. That is a real diagnostic, and it is the first appearance in the course of a general principle: the order in which categories are plotted is a choice, and it is a choice that determines what a reader is able to see.
Sums throw away information. The pair (2, 6) and the pair (4, 4) both give eight, and once they have been added together nothing distinguishes them. The grid below keeps that information: each cell counts the times that student A rolled the row value in the same turn that student B rolled the column value. There are thirty-six cells and they are equally likely, so the expected count in every one of them is simply n/36 — which for twenty rolls is 0.56, and that number will become important on the Statistics tab.
The handout's final exercise asks for the sum of |observed − expected| over all thirty-six cells, computed once for the first round of rolls and once for both rounds together, with the second total halved before the two are compared. That comparison is set out below, together with an explanation of why it comes out the way it does — which is a slightly different question from what it comes out as.
Tables can be downloaded as comma-separated values, which any spreadsheet program will open, and which is the format to hand in if the exercise is being submitted electronically.
One pair of students produces twenty rolls, which is not many. A class of thirty produces three hundred, and three hundred is a different kind of number: it is enough for the shape of the distribution to show through the noise rather than being buried in it. Pooling is the cheapest statistical improvement available to anyone, and it costs nothing but the willingness to write results on a board and add them up.
Enter each group's eleven counts as they go up on the board. The order in which groups are entered does not matter. Every row must total the number of rolls that group made, and the page checks that for you: a row that does not add up is highlighted, because a transcription error caught now is a great deal cheaper than one found after the graph has been drawn.
The pooled totals, reordered by expected likelihood exactly as in Table 3, with two further rows dividing each total by the number of groups. That division is what makes Figure 2 comparable with Figure 1: without it the pooled counts are fifteen or twenty times larger than one group's, the vertical axis has to be rescaled, and the two figures can no longer be flipped between and compared by eye.
Comparing your own twenty rolls with the pooled class result is the moment this laboratory makes its central point, and the point is easy to state wrongly. Pooling does not make the observations land closer to the predictions. In absolute terms it makes them land further away: three hundred rolls will show a larger total departure from expectation than twenty did. What pooling buys is a smaller departure relative to the size of the experiment, and it is the relative departure that the eye reads off a graph once both figures have been put on the same scale.
The comparison the class is being invited to make is therefore between two figures whose expected points are identical and whose observed points scatter by different amounts. That is the entire lesson, and it is worth insisting that the second figure is not “more accurate” in some vague sense. It is more precise: repeat the whole exercise and a pooled result will land near where the last pooled result landed, while a twenty-roll result will not. Accuracy is about being centered on the truth, and twenty rolls are already centered on the truth; they are simply centered on it very loosely.
A table of numbers records what happened. A graph shows what happened. The difference matters most when the point being made is about a shape, because a shape is something the eye reads instantly and the mind reads slowly from a row of digits. This exercise produces exactly such a shape: a staircase of predictions with a scatter of observations draped over it, tracking the staircase loosely when the sample is small and tightly when it is large.
A graph is also a claim, and a badly built graph makes a claim its data do not support. Almost every rule below exists because breaking it lets a figure say something false while looking respectable. What follows is therefore not about neatness. It is about not lying, including not lying to yourself.
Below is a data set drawn as it ought to be drawn. Every labeled feature is there for a reason, and a reader who knows the conventions can extract the entire experiment from the figure without reading a word of the surrounding text.
independent,and this page uses both. This is worth stopping on, because the collision is real and nobody warns students about it. On the Definitions tab, independent means that two events do not inform each other: knowing the first die showed a 5 tells you nothing about the second. Here, an independent variable means the thing you chose or the thing that defines the case, as against the thing you measured. The two senses have nothing to do with one another, and one word carrying both is simply an accident of vocabulary.
number of rolls,so yes — one axis, one label, two series, same variable measured twice. Compare Experiment 2 on the opening tab, which also draws two curves but puts a second axis on the right, because there the two quantities are a fraction and a count: different units, different scales, no shared label possible. Two series on one axis means one dependent variable, read twice. Two series needing two axes means two dependent variables. Neither case promotes anything to being the independent variable, which stays on the horizontal axis where it was.
what shape did the sums make?but
how well does the model predict?Worth looking at both and seeing that they are not rivals.
how much bigger?to
how many times bigger?
(logarithmic)in the axis label so that nobody is misled: the figure showing departure against sample size on the Theory tab, which is logarithmic on both axes so that the square-root law comes out as a straight line; Figure 4, where the horizontal axis is logarithmic because the early wandering is the interesting part and would otherwise be crushed against the left edge; and the power curve on the Statistics tab. In all three the horizontal quantity is a number of rolls spanning several orders of magnitude and never zero — which is exactly the case the technique is for.
eleven discrete values, joined for legibility; a line with the markers switched off starts to look like a continuous function of something, and that is when a reader can be misled.
Each switch below introduces one common fault into the figure above. Turn them on one at a time and watch what the graph starts claiming. Turn several on at once for the full experience of a figure that has escaped supervision. The explanation of each fault appears once its switch is on.
The handout asks for the sums to be arranged by increasing expected value rather than from 2 to 12, and the reason repays a moment's thought. Both orderings below plot identical data. Neither is wrong. But they answer different questions, and a figure that answers the wrong question is a figure that will be misread.
The single most useful addition to a figure of this kind is a statement of how far the observations should have strayed. Without it a reader is left to judge the agreement by eye, and the eye is a poor judge: it treats a gap of two as small when the counts are large and as damning when they are small, with no reference to what chance alone would produce.
For counts the relevant scatter is known exactly — √(np(1 − p)), from the Theory tab — so a band can be drawn around the prediction before any data are collected at all. Observations inside the band are unremarkable. Observations outside it are worth a second look, though with eleven categories one should expect roughly three of them to fall outside a one-standard-deviation band by chance alone, which is exactly why a proper test looks at all eleven together rather than at the worst one.
The same data can be plotted as counts of rolls or as fractions of the total, and the choice is not cosmetic. Counts keep the sample size visible, which matters because a reader must know whether a fraction of 0.15 came from three rolls out of twenty or from three hundred out of two thousand. Fractions make experiments of different sizes directly comparable, which is exactly what is needed when a single group's twenty rolls are set beside the pooled class total.
sevens per twenty rolls.Dividing instead by the forty rolls gives 10/40 = 0.25, the fraction, and the first group's 4/20 = 0.20 sits beside it just as well. The two divisions are the same correction. They differ only in what the answer is measured in: one leaves it in rolls, the other turns it into a fraction. Note that 5/20 is also 0.25, which is the point — the division by groups is the division by rolls, scaled back up to one group's worth.
The usual resolution for a figure is therefore to plot fractions and to state the sample size in the caption, in the axis label, or beside each series. Dividing by the number of groups is the cruder version of that resolution: it only works when every group rolled the same number of times, and it quietly hides the sample size, because a bar of height five no longer says whether it rests on twenty rolls or on forty. What it buys in return is that the numbers stay on the familiar scale of one group's experiment rather than becoming decimals, which for a first-year laboratory is the friendlier choice.
Before a figure leaves your hands, walk this list. It takes under a minute and catches nearly everything.
Four videos on the mechanics of a graph. The first two cover the vocabulary — which variable goes on which axis, and why that is not an arbitrary convention. The third is a start-to-finish demonstration of drawing one by hand, which is still the fastest way to learn what a graph is. The fourth is a song.
dependency relationship.That is the right phrase for a math class and a trap for a biology class.
Depends onhere means that hair length is a function of time — the ordinary sense. It does not mean dependent in the probability sense this laboratory uses on the Definitions tab, where it describes two events that shift each other's odds. One word, two unrelated jobs. The box above, Two different meanings of
independent,sorts them out, and the figures here contain both at once.
These are the two figures the handout asks you to draw by hand, drawn from your own numbers. Drawing them by hand is worth doing anyway — deciding where the axis should start and how wide to space eleven categories teaches something that watching a machine decide does not — but having the machine's version to compare against afterward turns a graded exercise into a check on your own work.
Except for the data plotted, Figures 1 and 2 are drawn identically, on the same axes and at the same scale. That is deliberate and it is the point of the exercise: the two can be flipped between, and what differs between them is nothing but the tightness with which the observations track the prediction.
Flipping between two pages is how the handout arranges the comparison, because two pages is what a stapled packet offers. On a screen the two can simply be overlaid, and the effect is more direct: one prediction, two sets of observations, differing only in how far they wander from it.
The two figures above compare a small experiment with a large one at a single instant. This one shows the transition happening. The trace is the running fraction of rolls so far that produced the chosen sum, recomputed after every roll, with the true probability drawn as a horizontal line. Early on the trace swings wildly, because a single roll is a large share of the total. As rolls accumulate the swings shrink, not because the dice change their behavior but because each new roll is a smaller share of what has already happened.
The figures above concern sums, which throw away the identity of the individual dice. This one returns to the thirty-six ordered outcomes and plots the departure from expectation in each, so that a cell which is badly out can be found rather than merely suspected. With twenty rolls in thirty-six cells most of the grid is empty and the departures are small and negative; the interesting thing to look for is any cell that has been visited three or four times, since a cell expected 0.56 times has no business appearing four times — though with thirty-six cells, one of them behaving oddly is itself expected.
Every figure above puts the sum on the horizontal axis and both counts on the vertical one. This figure does the thing that seems as though it ought to be possible and usually is not: it puts expected on the horizontal axis and observed on the vertical. Each of the eleven points is one sum. The dashed diagonal is perfect agreement, where observed equals expected exactly.
It answers a different question from the others, which is the whole reason it is here. Figures 1 to 3 ask what shape did the eleven sums make? This one asks how well does the model predict, and does it predict the common sums better than the rare ones? Points above the line came up more often than predicted and points below it less often; a miss of two rolls on an expectation of three is a different thing from a miss of two on an expectation of 0.6. With twenty rolls the points sit in a short, ragged cloud and that is the correct result — a tidy line would be the surprising outcome, and the Statistics tab says how ragged is too ragged.
You have a prediction and an observation, and they disagree. They always disagree. The question is never whether they disagree but whether they disagree by more than chance alone would arrange, and that question has an answer only because the amount of disagreement chance produces is itself predictable. That is the whole idea. A statistical test computes how big the disagreement is, works out how big it would typically have been if nothing were wrong, and reports where the observed value falls in that distribution.
The dull explanation being tested here — the null hypothesis — is that both dice are fair, that the two are independent of each other, and that successive rolls are independent of one another. If that is true, the eleven expected counts are exactly np and every departure from them is noise. The tests below all ask the same question of that hypothesis and differ only in how they measure departure and how they work out what departure to expect.
Before any test, the departure has to be reduced to a single number, and there is more than one defensible way to do that. The four below are computed from your data at once, because seeing them together makes clear what each one is throwing away.
This is the test a geneticist runs on a Mendelian ratio, and it is the standard tool for the question this laboratory asks. The statistic is a sum over categories:
Division by E is what makes the statistic work, and it is worth pausing on. A departure of 2 where 0.56 was expected is a catastrophe; a departure of 2 where 33 was expected is nothing at all. Dividing by the expected count converts every departure into a comparable unit before adding, which is precisely what the handout's sum of absolute differences fails to do.
Eleven categories do not supply eleven independent pieces of evidence, because their counts are forced to add up to the number of rolls. Fix any ten of them and the eleventh follows. So there are ten degrees of freedom, and the chi-square value has to be judged against the distribution for ten rather than eleven — a distinction that matters, since the two distributions have different means and different tails. The general rule for a goodness-of-fit test is k − 1 degrees of freedom for k categories, less one further degree of freedom for every parameter that had to be estimated from the same data. Here nothing was estimated: the expected values came from the sample space, not from the rolls.
The chi-square distribution is an approximation. The statistic is built from counts, which are lumpy and discrete, and it is being compared against a smooth continuous curve; the approximation is excellent when the expected counts are reasonably large and it degrades when they are not. The usual working rule, from Cochran (1954), is that no expected count should fall below 1 and that no more than a fifth of them should fall below 5.
Twenty rolls of two dice fail that rule badly. The expected count for a sum of 2 is 20 × 1/36 = 0.56, and for eight of the eleven sums the expectation is under 5. The p-value from the chi-square distribution is therefore not to be trusted at this sample size, and reporting it without saying so would be exactly the sort of thing this page exists to avoid. There are three honest responses.
Here is the definition of a p-value again: the probability of a discrepancy at least as large as the one observed, if the null hypothesis is true. A computer can evaluate that definition literally. Simulate the same number of rolls with dice that are fair by construction, compute the chi-square statistic, and repeat some thousands of times. The fraction of simulated experiments whose statistic equals or exceeds yours is the p-value, with no approximation and no distributional assumption anywhere in it.
This is worth appreciating rather than merely using. The chi-square distribution is a piece of nineteenth-century mathematics that exists to spare the analyst exactly this computation, and it does the job so well that it remained the only practical route for a century. It is now the more approximate of the two available answers.
The chi-square statistic is not the only way to measure how badly a set of counts fits a set of expectations. The likelihood-ratio statistic, usually called G, compares how probable the data are under the null hypothesis with how probable they are under the best possible alternative:
G and χ2 are compared against the same distribution and usually give similar answers, and the case for preferring G is that it belongs to a general family — likelihood-ratio tests — that extends cleanly to complicated models where no chi-square analogue exists. The case for preferring χ2 is that it is what everyone reports and what everyone expects to read. Where the two disagree noticeably, the honest conclusion is not that one of them is right but that the sample is too small for either approximation, which is a useful thing for a pair of tests to be able to tell you.
The exercise also asks about the full grid, in which order matters and there are thirty-six equally likely outcomes. Testing that grid is the same test with different numbers — thirty-five degrees of freedom, and an expected count of n/36 in every cell — and at twenty rolls every single one of those thirty-six expectations is 0.56. Not one of them satisfies Cochran's rule, and there is nothing sensible left to pool.
This is not a defect in the exercise. It is the exercise's most valuable moment, because it demonstrates something no amount of being told will convey: an approximation has conditions, the conditions are checkable, and when they fail the number that comes out is not a slightly worse answer but a meaningless one. The Monte Carlo test has no such conditions and remains valid here, so the two can be run side by side and the size of the failure inspected directly.
Testing asks whether the data are consistent with a stated model. Estimation asks a more useful question: given these data alone, and no prior claim about fairness, what range of probabilities would be consistent with what was seen? That range is a confidence interval, and it is often the more informative thing to report, because a test that fails to reject can mean either that the model is right or that the experiment was too small to notice anything — and an interval distinguishes the two immediately by being narrow or wide.
The exercise asks whether the departure from expectation is larger for twenty rolls than for forty, and it is a genuinely good question undercut by a genuinely small sample: with one experiment of each size, the comparison can easily come out backward, and a student who does the arithmetic correctly may be told their answer is wrong because the dice were uncooperative. Repeating the whole comparison thousands of times removes the complaint and reveals what the exercise was pointing at.
Everything above assumes the dice are fair and asks whether the data contradict that. Turn the question around. Suppose one die really is loaded. How large an experiment would be needed to notice? This is the question of statistical power, and it is the question that should be asked before an experiment rather than after, because it is the one that determines whether the experiment is worth doing at all.
Power is the probability of detecting an effect that is really there. It rises with the size of the effect, with the sample size, and with a willingness to tolerate false alarms. A study with low power is not merely likely to miss things: when it does report something, the thing reported is disproportionately likely to be an exaggeration or an artifact, which is why underpowered studies do more damage than no study at all.
Four misreadings account for nearly all of the trouble that p-values cause, and all four are worth being able to recognize in someone else's writing as well as your own.
A brief introduction to variance, the quantity the standard deviation is the square root of. One warning before watching: the video computes the variance of a set of measurements, which is the general recipe. This page mostly uses the special case for counting, where the variance of a count is np(1 − p) and no averaging of squared departures is needed. The general recipe is more work and more correct; the special case is the one that applies here.
How Far from the Prediction Should the Observation Land?on the Theory tab. The short version is that the video estimates a mean from the data and must pay for it, while this page gets its mean from the model and pays nothing.
The questions below are the ones this laboratory is actually about, as opposed to the ones it asks you to compute. Answer each before revealing the response; a wrong answer you committed to teaches considerably more than a right answer you read.
These have no multiple-choice version because the answer is a paragraph. They are the questions the handout ends on, and they are the ones most likely to appear on an examination.
A prediction and an observation are different kinds of statement, and the gap between them is not a mistake. Its size is itself predictable: the gap grows as the square root of the sample size while the gap per trial shrinks at the same rate. Every statistical test in biology is a way of comparing an observed gap against the gap that chance alone would have supplied.
Everything else on this page — the multiplication rule, the addition rule, the sorted tables, the chi-square statistic, the simulations — is machinery in service of that one sentence.
Everything entered on this page is stored in this browser and nowhere else. Clearing it is permanent, so export anything worth keeping first.