Five Probability Distributions, Explained With Beer, Peas, and Free Throws
From the publisher’s feed, collected in the ZeroLabs newsroom.
Normal, Binomial, t, Chi-Square, F. Five Shapes, One Afternoon.Cambridge, the 1920s. A biologist named Ronald Fisher poured a cup of tea for a colleague, Muriel Bristol. She turned it down. Not because of the tea, but because he had added the milk after the tea instead of before, and she insisted she could taste the difference. Fisher thought that was nonsense. So, being the sort of person who cannot let a claim breathe, he designed a test right there at the table.Eight cups. Four poured milk first, four poured tea first, all shuffled into a random order. If Muriel was bluffing, she would get about half of them right by sheer luck. She got all eight.The odds of pulling that off by guessing are 1 in 70.The famous lady tasting tea experiment, the birth of the modern statistical testHere is why that tiny story matters more than it should. Before Fisher could call Muriel gifted, he had to answer a sneakier question first. What does luck look like? How often does blind guessing land all eight, or seven, or six? Only once you know the shape that luck makes can you point at a result and say, that is too clean to be an accident.That shape of luck has a name. Honestly it has about forty names, because somewhere along the way statisticians got a little carried away and named a distribution for every occasion. But here is the part nobody tells you when you are starting out. In real work, you reach for the same five over and over, and the other thirty-five mostly gather dust. This article is those five. What they are, when you grab each one, and the short Python that draws them. By the end you will recognize all five on sight, and you will see the quiet trick that ties them into one family.No memorizing. Recognizing. There is a difference, and it is the whole game.So what even is a distributionDrop the textbook word for a moment and picture something concrete.Imagine you measured the height of every adult man in your city and stacked them into a giant bar chart, one column for each height. The column at 4 foot 11 would be tiny. The column at 7 foot would basically not exist. All the tall columns would bunch up in the middle, somewhere around 5 foot 9, and fade out as you slide toward the short and tall extremes. That pile of columns has a shape. That shape is the distribution. It tells you where the numbers like to land and how often they land there.So a distribution is not a formula to fear. It is a portrait of a crowd. Some crowds bunch in the middle. Some lean to one side. Some can only stand on the positive end of the room. Each of our five is just a differently shaped crowd, and learning them is learning to recognize who shows up where.There is one fork in the road you need before we go further, and mixing it up causes about half of all beginner confusion. Some things you count. Other things you measure.When you count, you get whole numbers. Heads in ten coin flips. Cars in a parking lot. You cannot have 3.5 heads. We describe counted things with bars, and each bar is an honest probability you can read straight off the chart. The chance of exactly 4 heads might be 20 percent, and there it is, a bar of height 0.20.When you measure, you get a smooth slide of values with no gaps. Height can be 70 inches, or 70.4, or 70.41, on and on. We describe measured things with a smooth curve, and here is the bit that tripped me up for an embarrassingly long stretch. For a smooth curve, the height of the line at a single point is not a probability. The probability lives in the area under the curve across a range.Why on earth would that be? Because for something truly smooth, the chance of landing on one exact value, like a height of precisely 70.00000 inches forever, is basically zero. There are infinite possible values, so any single one is a vanishing sliver. So we never ask for the chance of one exact spot. We ask for the chance of a range, like between 69 and 71 inches, and the answer is the area sitting under the curve over that stretch. Height of the line tells you how crowded a region is. Area tells you the actual probability.Read that twice if you need to. Counted things use bars and exact chances. Measured things use a curve where probability is area. Lock that in and the rest is downhill.A clean example to anchor it. IQ scores are built to have an average of 100 and a typical spread of 15 points. That spread has a name, the standard deviation, and it just means the usual distance a value sits from the average. We will lean on it constantly.The whole cast, on one mapBefore the close-ups, here is the cheat you will glance at when a real problem lands on your desk. You will not summon an equation. You will find the row that sounds like your situation and grab that one.A simple decision map for choosing the right probability distribution for your dataFive shapes. Now let me introduce them properly, because each one earns its place.1. Normal, the one you already knowYou have seen this shape your whole life. The bell curve. It is the silhouette of any crowd that bunches around a typical value and trails off evenly on both sides.Let me make it concrete with real numbers instead of hand waving. Adult men in the US average about 5 foot 9, with a standard deviation near 3 inches. Plug that into the single most useful fact about the bell curve, the one rule worth carrying in your head forever.The normal distribution and the 68 95 99.7 rule, the most useful fact about the bell curveAbout 68 percent of values sit within one standard deviation of the average. About 95 percent sit within two. About 99.7 percent sit within three. So for those men, roughly 68 percent stand between 5 foot 6 and 6 foot, and about 95 percent between 5 foot 3 and 6 foot 3. Or take IQ, with its average of 100 and spread of 15. Right away you know about 95 percent of people score between 70 and 130, and only about 3 in 1000 score above 145. You just did real statistics in your head, no calculator, no panic.Now, why does this shape turn up everywhere, from heights to measurement errors to the total on a pair of dice? Because of a genuinely beautiful fact. When you add up or average a big pile of small, independent, random things, the result drifts toward a bell almost no matter what the individual things looked like. Flip one coin and the outcome is not bell shaped at all. But count the heads across many flips, or average a lot of measurements, and a bell quietly assembles itself. That tendency has a name, the Central Limit Theorem, and it is the reason the normal curve haunts the whole field.The cleanest way to feel it is an old wooden toy called a Galton board. Balls drop through a forest of pegs, bounce left or right at random on the way down, and collect in bins at the bottom. Every single time, with enough balls, they pile into a bell.A Galton board dropping balls into a normal distribution, randomness quietly assembling a bell curveTwo warnings, because this is exactly where beginners get burned. First, the Central Limit Theorem is about averages and sums of many samples, not about single raw measurements magically becoming normal if you collect enough of them. Income, for example, is not a bell. It leans hard to the right, dragged out by a few very high earners, which is why the average income in most places sits well above the typical income. Not everything is normal, and assuming it is will quietly wreck your analysis. Second, the bell is so famous that people slap it on data that clearly leans or has fat tails. Look at your actual data before you trust the shape.And here is a small thing I love, just to prove that even the icon of randomness has a secret. A research team once flipped coins 350,757 times by hand, and found that a flipped coin lands the same way it started about 50.8 percent of the time, not a clean 50. The wobble in the air gives the starting side a hair of an edge. The bell is reliable. The coin is the one that lies a little.Time to draw one. Here is the normal distribution in Python, with every line narrated.import numpy as npimport matplotlib.pyplot as pltfrom scipy import stats## numpy handles the number-crunching, matplotlib draws, scipy holds the# distribution itself, every distribution lives in scipy.stats## make 500 evenly spaced points from -4 to 4 to trace a smooth curvex = np.linspace(-4, 4, 500)# linspace just means "give me this many points spread evenly between A and B"## ask the normal for the height of the curve at each x# loc is the average (center), scale is the standard deviation (width)y = stats.norm.pdf(x, loc=0, scale=1)# pdf returns the curve height, this is the bell shape, not a probability#plt.plot(x, y, linewidth=2)# fill underneath so the "probability is area" idea is something you can seeplt.fill_between(x, y, alpha=0.2)plt.title("Standard Normal")plt.show()## now a real question, what share of people score below an IQ of 115# that is one standard deviation above a mean of 100, so loc=100 scale=15print(stats.norm.cdf(115, loc=100, scale=15))# cdf is the area piled up from the far left to this point, prints about 0.84# so roughly 84 percent of people score below 115, which fits the 68 ruleLet me decode the buttons once, because the same ones work on all five distributions, and I never want you scared of them again. .pdf gives the height of a smooth curve. .cdf gives the area to the left of a point, which is the probability of getting that value or less, and it is the function you will use most. Want the chance of landing between two values? Subtract one .cdf from another. .ppf runs that backward, you hand it a probability and it returns the cutoff value, perfect for questions like what score marks the top 5 percent. And .rvs spits out random samples, which is how you fake data for a simulation. Five buttons, five distributions, that is most of the toolkit right there.Use it when your data clusters around a typical value and fades off evenly on both sides. Heights, errors, averages of almost anything.2. Binomial, the counterNow we hop from smooth curves back to bars, because the binomial is about counting.It answers one very specific question. You run a fixed number of independent yes-or-no tries, each with the same chance of success. How many successes do you end up with? That is the entire job. Count the wins.Let me hang it on someone real. Steph Curry has made about 91 percent of his free throws across his career, the best mark in NBA history. So picture him stepping to the line for 10 free throws. How many does he sink? Not always 9. Sometimes 10, sometimes 8, occasionally a rough night at 7. The binomial gives you the chance of each outcome. It needs just two settings. The number of tries, which statisticians call n, here 10. And the chance of success on a single try, called p, here 0.91.Swap those two dials and the same shape bends to fit almost anything. A fair coin is n flips at p of 0.5. A website where 2 percent of visitors buy something is n visitors at p of 0.02. Ten penalty kicks from a pro who scores about 75 percent of the time is n of 10 at p of 0.75.The binomial distribution for a fair coin versus a biased one, how the success rate shifts the most likely countLook at the fair coin on the left. The tallest bars sit at 4, 5, and 6 heads, and getting 0 or 10 is so rare the bars almost vanish. Now here is a fact that surprises nearly everyone. With a fair coin and 10 flips, the chance of getting exactly 5 heads, the so-called expected number, is only about 25 percent. The single most likely outcome is still a long shot. Expected does not mean probable, it means the long-run average, and confusing the two is one of the most common stumbles in all of probability.There is one rule the binomial is strict about, and it is worth policing. Each try must be independent, with the same p every time. Coin flips qualify because a coin has no memory. Drawing cards from a deck without putting them back does not, because every card you remove changes the odds for the next draw. When you catch yourself reaching for the binomial, ask quietly, are my tries truly independent, and is p really the same each time. If not, it is the wrong tool.import numpy as npimport matplotlib.pyplot as pltfrom scipy import stats## the only outcomes for 10 free throws are the whole numbers 0 through 10k = np.arange(0, 11)# arange builds 0,1,2,... up to but not including 11## ask the binomial for the chance of each exact make-count, n tries at rate pprobs = stats.binom.pmf(k, n=10, p=0.91)# pmf gives a real probability per whole number, and they all add up to 1#plt.bar(k, probs)plt.title("Curry takes 10 free throws")plt.xlabel("number made")plt.show()## a real question, what is the chance he makes all 10print(stats.binom.pmf(10, n=10, p=0.91))# prints about 0.39, so even the best shooter alive misses at least one# more often than not, which is a fun thing to knowNotice it is .pmf here, not .pdf. That p stands for mass, and it is what we use for counted things, where each bar is a genuine probability. One more curiosity for the road. As you crank n higher, those binomial bars start tracing out a bell. Count the heads in 1000 flips instead of 10 and the picture is basically normal. That is the Central Limit Theorem again, sneaking in through the back door, because a count is really just a sum of a lot of tiny yes-or-no values.Reach for it when you are counting how many times a yes-or-no thing came up yes, across a fixed number of independent tries with a steady success rate.A short detour, so the last three make senseThe normal and the binomial describe data directly. The last three are a different breed, and if nobody explains this part, they feel pointless. So let me explain it.The t, the chi-square, and the F are not really shapes of your raw data. They are the rulers you measure surprise against. Remember the tea. To judge whether Muriel was gifted, Fisher needed to know the shape of luck, so he could see where her result fell on it. These three are exactly those shapes of luck, each built for a different kind of question.It works like this. You take your data and boil it down to a single number that captures how far what you saw sits from what plain luck would produce. That number is called a test statistic. Then you drop it onto the matching curve, the one that describes how that number behaves when nothing interesting is going on. If your number lands in the crowded middle, shrug, that is ordinary luck. If it lands way out in a thin tail, where almost nothing normally lands, then either something rare just happened or something real is going on, and you bet on real.That tail area, the fraction of the curve sitting further out than your number, is the famous p-value. A small p-value means a result this extreme would be a rare fluke if nothing were happening, which is your cue to take it seriously.A test statistic asks whether your result sits in the ordinary middle or out in the rare tailOne honest warning, because this is the single most misunderstood idea in statistics, missed even by working scientists. A p-value is the chance of seeing data this extreme if nothing is going on. It is not the chance that nothing is going on, and it is not the chance your result was a fluke. Those sound the same and are not, and the difference has launched a thousand bad headlines. You do not need to master this today. Just file away that a small p-value is evidence, not proof, and you are already ahead of most.The phrase that scares everyone, defusedYou cannot read about the next three without tripping over degrees of freedom. It sounds like something from a philosophy seminar. It is not. It is almost insultingly simple once someone says it plainly, and I was a little annoyed when I finally understood how simple.Degrees of freedom is the count of values that are still free to change after you have locked down a summary you calculated from them.Here is the example that made it click. Suppose I tell you that five numbers have an average of 10. You can pick the first four to be anything you like. Truly anything. But the moment those four are down, the fifth is no longer free. It is forced to be whatever drags the average back to exactly 10. So five numbers with one fixed average give you four free choices. Four degrees of freedom. One value got spent holding the summary in place.That is the whole idea. Every summary you pin down costs you one free value, and what remains is your degrees of freedom. It is just a tally of how much independent wiggle your data still has. Hold that, and t, chi-square, and F stop being intimidating and start being useful.3. The t distribution, born in a breweryThis one has my favorite origin story in all of science, and it is completely true.Around 1908, a young chemist named William Sealy Gosset was working at the Guinness brewery in Dublin, trying to judge the quality of barley and yeast from tiny samples. Not thousands of measurements. A handful. The trouble is that the normal distribution quietly assumes you already know the true spread of the whole population, and with only a few data points, pretending you know that spread makes you far too confident. So Gosset worked out a more honest curve for small samples. Then came the twist. Guinness forbade its employees from publishing, terrified that rivals would learn its methods, so Gosset published under the pen name Student. His real identity stayed secret for years. To this day it is called Student’s t, and one of the most used tools in science is named after a beer inspector’s cover identity.William Sealy Gosset, the Guinness brewer who invented the t distribution and published as StudentSo what does his curve look like? Like a normal that has been through something. Same bell in the middle, but with fatter tails. Those fat tails are the honesty. They are the curve admitting that, with so little data, your estimate of the spread is shaky, so genuinely extreme values are more plausible than a cocky normal would ever allow. Think of the fat tails as padding for uncertainty.The t distribution versus the normal, why small samples get fatter tails and stay humbleAnd here is the elegant part. The fatness depends on degrees of freedom, which here tracks your sample size. A tiny sample gives very fat, very cautious tails. As your sample grows, the tails pull in, and the t slims down until, past about 30 data points, it is almost identical to the normal. Push the sample to infinity and the two become the exact same curve. The t is not a rival to the normal. It is the normal with the humility to admit when it does not have much to go on.import numpy as npimport matplotlib.pyplot as pltfrom scipy import stats#x = np.linspace(-5, 5, 500)# draw the normal as a dashed reference, the confident big-sample curveplt.plot(x, stats.norm.pdf(x), linestyle="--", label="Normal")# now a t with only 3 degrees of freedom, a small nervous sample# df is the degrees of freedom, the only shape dial the t needsplt.plot(x, stats.t.pdf(x, df=3), label="t, df=3")# and a t with df=30, watch it basically hug the normalplt.plot(x, stats.t.pdf(x, df=30), label="t, df=30")plt.legend()plt.show()## the cutoff for a 95 percent confidence interval from a sample of 10# a sample of 10 leaves 9 degrees of freedom, ppf turns a probability# back into a cutoff value on the curveprint(stats.t.ppf(0.975, df=9))# prints about 2.262, fatter than the normal's famous 1.96 cutoffThat last number is the t earning its keep. For a small sample, the magic cutoff is 2.262, not the normal’s well-worn 1.96. The t stretches your confidence interval a little wider because, with little data, you have earned a little less certainty. That is not a flaw. It is wisdom baked into a shape.Pull it out when you are estimating an average from a small sample and you do not already know the true spread of the whole population. Small experiments, lab runs, A and B tests with modest numbers.4. Chi-square, the one for counts and categoriesNew shape, new personality. The chi-square lives only on the positive side of the line, it can never go below zero, and it leans to the right, bunched near the low end with a long tail stretching off to the high end.Why can it never be negative? Because of how it is built, and this is the secret that turns it from a mystery test into an obvious idea. Take values from a standard normal, square them, and add them up. Squaring kills every minus sign, so the result is always positive. The number of squared pieces you add is the degrees of freedom. That is literally what a chi-square is, a pile of squared bell-curve values.The chi-square distribution at several degrees of freedom, always positive and leaning right by designSo what is it good for? Comparing counts you observed against counts you expected. The classic, and one of the most charming stories in science, is Gregor Mendel and his pea plants. Breeding peas, Mendel predicted that a certain cross would give round-yellow, round-green, wrinkled-yellow, and wrinkled-green seeds in a ratio of 9 to 3 to 3 to 1. Out of 556 peas, he expected roughly 313, 104, 104, and 35. He observed 315, 108, 101, and 32. A chi-square test asks the obvious question. Is the gap between what I expected and what I got just random wobble, or is it too big to ignore? For Mendel, the fit was so close the test basically shrugged and said, yes, your theory holds.Mendel’s pea experiments, the textbook case for a chi-square goodness of fit testNow the twist, and it is a good one. Decades later, Ronald Fisher, the same tea fellow, ran the chi-square across all of Mendel’s experiments and found the results hugged the predicted ratios too tightly. So tightly that there was only about a 1 in 14,000 chance honest data would land that perfectly. The father of genetics may have had a helpful assistant who nudged the counts toward the theory. We will probably never know. But notice what just happened. The very same tool that confirms a theory can also whisper that a dataset looks a little too good to be true. That is the chi-square doing both of its jobs at once.The same machinery checks whether two things are related, by comparing the counts you see in a table against the counts you would expect if the two had nothing to do with each other. Are coffee drinkers more likely to be night owls? Build the table, compare observed to expected, let the chi-square judge.import numpy as npimport matplotlib.pyplot as pltfrom scipy import stats## chi-square only lives on positive numbers, so start just above zerox = np.linspace(0.05, 18, 500)# draw a few versions so the family resemblance is obvious# df is the number of squared normals we added togetherfor df in [1, 4, 8]: plt.plot(x, stats.chi2.pdf(x, df=df), label=f"df={df}")plt.legend()plt.show()## Mendel-style check, suppose our test statistic came out to 0.47# with 3 degrees of freedom, how ordinary is that under the theory# sf is the survival function, the tail area to the RIGHT of our valueprint(stats.chi2.sf(0.47, df=3))# prints about 0.93, a huge p-value, meaning the data fits the theory greatThe new button there is .sf, the survival function, which is just the right-tail area, everything beyond your value. It equals 1 minus the cdf. For chi-square and F tests you almost always care about that right tail, so .sf becomes your go-to.It is your tool when you are working with counts in categories and want to know whether the pattern is real or just noise. Survey tables, dice fairness, genetics ratios, did the new design change which button people click.5. The F distribution, the refereeLast one, and the fanciest, so let me make it click instead of just defining it.The F is about comparing two spreads. Not two averages, two amounts of variability. It is literally a ratio, one variance divided by another, and because it is built from two chi-squares stacked over each other, it carries two separate degrees-of-freedom dials, one for the top and one for the bottom. When the two spreads are about equal, the ratio sits near 1. When one is much larger than the other, the ratio climbs into the right tail. So a big F means these two things vary by very different amounts, and that is the signal you are hunting.The F distribution is a ratio of two spreads, with values near 1 meaning the two spreads look about equalHere is where it earns its salary. The F is the engine behind ANOVA, which stands for analysis of variance, and ANOVA answers a question you will hit the moment you compare more than two groups. Say you test three fertilizers on plant growth. You could compare every pair one at a time, but that piles up errors fast. ANOVA asks one clean question instead. Is the variation between the group averages bigger than the ordinary variation inside each group?That is the intuition that finally made it land for me. You are weighing signal against noise. The spread between the group averages is the signal, the possible real difference. The spread within each group is the noise, the random scatter you would see anyway. The F is signal divided by noise. A big ratio means the groups differ by more than random scatter can explain, so the difference is probably real. An F near 1 means the gaps between groups are no bigger than the wobble inside them, so you have nothing.The name throws everyone, by the way. Why analyze variances to compare averages? Because the question is this group really different only means something next to how noisy the data is to begin with. Variance is just the measuring stick for that noise.The F honors Ronald Fisher, who worked out the idea at an agricultural research station comparing crop yields across fields, and whose colleague George Snedecor later tabulated it and named the statistic F in his honor. Yes, the same Fisher from the tea and from catching Mendel. The man got around.import numpy as npimport matplotlib.pyplot as pltfrom scipy import stats## F also lives only on the positive side, start just above zerox = np.linspace(0.02, 5, 500)# two dials, one for the numerator and one for the denominator# dfn is the between-groups count, dfd is the within-groups countplt.plot(x, stats.f.pdf(x, dfn=3, dfd=20))# mark 1, where the two spreads would be equalplt.axvline(1, linestyle="--")plt.show()## an ANOVA-style question, our F came out to 4.5 with 3 and 20 dof# how surprising is that if the groups were really all the sameprint(stats.f.sf(4.5, dfn=3, dfd=20))# prints about 0.014, under 5 percent, so the groups really do differCall on it when you are comparing spreads, or comparing the averages of three or more groups at once. ANOVA, checking whether one process is more variable than another, testing whether a whole model is doing anything.The reveal, they were family the whole timeHere is the thing that, once I saw it, turned five separate headaches into one idea. These distributions are not strangers who happen to share a textbook chapter. They are one family, and the normal is the ancestor everyone descends from.Watch how they connect. Take a normal, square it, and add several of those squares together, and you have built a chi-square. Take a normal on top and divide it by a scaled chi-square underneath, and you get a t. Take two chi-squares and divide one by the other, and you get an F. Even the binomial joins in, because as the number of tries grows, its bars settle into the shape of a normal.How the chi-square, t, and F distributions are all built from the normal, one statistical familyThis is why they keep showing up together in tests, and why degrees of freedom threads through all three. You are not memorizing four unrelated curves. You are remembering one shape, the bell, and three simple moves done to it. Square and add. Divide by a scaled version. Take a ratio. That is a thing you can actually still know a year from now.The reference card, the part you bookmarkHere is the whole article squeezed into something you can screenshot. The five shapes, what each one is for, and the exact SciPy object to call.+-------------+------------+---------------+------------------------+-------------+| SHAPE | TYPE | DIALS | REACH FOR IT WHEN | SCIPY |+-------------+------------+---------------+------------------------+-------------+| Normal | measured | mean, std dev | data clusters around | stats.norm || | | | a typical value | |+-------------+------------+---------------+------------------------+-------------+| Binomial | counted | n tries, p | counting wins in fixed | stats.binom || | | | yes / no tries | |+-------------+------------+---------------+------------------------+-------------+| t | measured | df | a mean from a small | stats.t || | | | sample | |+-------------+------------+---------------+------------------------+-------------+| Chi-square | measured | df | comparing observed vs | stats.chi2 || | | | expected counts | |+-------------+------------+---------------+------------------------+-------------+| F | measured | dfn, dfd | comparing spreads or | stats.f || | | | many group means | |+-------------+------------+---------------+------------------------+-------------+And the same five buttons open every one of them.+----------+-----------------------------------------------------------+| METHOD | WHAT IT HANDS YOU |+----------+-----------------------------------------------------------+| .pdf(x) | height of a smooth curve at x (for measured things) || .pmf(k) | real probability of the exact whole number k (counted) || .cdf(x) | probability of getting x or less, the area to the left || .sf(x) | probability of getting more than x, the right-tail area || .ppf(p) | the cutoff value that leaves probability p to its left || .rvs(n) | n random samples drawn from the distribution |+----------+-----------------------------------------------------------+The five probability distributions you will actually use, normal binomial t chi-square and F at a glanceRun all of it yourselfYou are three lines from every chart above. If you have Python, open a terminal.pip install numpy scipy matplotlibThen paste any block from this article into a file or a notebook and run it. Better yet, change the dials. Widen the bell. Bias the coin. Crank the t up from 2 degrees of freedom to 200 and watch it morph into the normal in real time, which is honestly the fastest way to feel why they are related. If no chart appears, you probably left off plt.show() at the end. I have made that exact mistake more times than I would like on the record.The five-second versionHere is the whole thing in one breath, since that is what a reference is for. Normal for data that clusters around a typical value. Binomial for counting wins across a fixed set of yes-or-no tries. The t for estimating an average from a small sample. Chi-square for comparing the counts you got against the counts you expected. F for comparing spreads, or for judging several groups at once.Five Probability Distributions, Explained With Beer, Peas, and Free Throws was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.