4.6 Continuous Distribution
SLO 3
Describe and apply probability concepts and distributions.
You generate 50 values with a random number generator, then hold your sample's mean, quartiles, and box plot against what U(0,1) actually predicts, so applying a distribution becomes something you check against data instead of take on faith.
Learning Objectives
By the end of this section, you will be able to:
- compare and contrast empirical data from a random number generator against the uniform distribution it is supposed to follow;
- compute the mean, standard deviation, quartiles, and median of a continuous uniform distribution from its endpoints;
- explain why a run of 50 generated values is allowed to miss the theoretical values it is being compared against.
4.6.1 Stats Lab: Continuous Distribution
The distribution you get by tallying data you actually collected — the frequencies, relative frequencies, and summary statistics of a real sample. An empirical distribution is measured, so it changes every time the experiment is rerun.
Its counterpart is the theoretical distribution, which is computed from the structure of the experiment before any data is collected and does not change when you rerun anything.
This section is a lab, not a reading. In §4.5 you learned to write down a uniform distribution and compute probabilities from its endpoints. Here you will generate the numbers that distribution describes — 50 of them, straight out of a random number generator — and then hold your own results up against what the formula predicted.
Class Time:
Names:
You will end up with two pictures of the same thing: the theoretical distribution the formula gives you, and the empirical distribution your 50 generated values actually produced. The whole point of the lab is that these two will not match exactly, and that the size and direction of the mismatch is itself the lesson.
Write down what you actually did, including anything that went sideways. If your calculator was set to two decimal places for the first ten values, if you accidentally generated 51 numbers and deleted one, if two people in the group used different tools — record it. A lab report that hides its own irregularities cannot be checked by anyone, and being checkable is most of what makes a result worth anything.
Of the two distributions this lab produces — theoretical and empirical — which one would come out differently if you ran the whole lab again tomorrow? Explain what that tells you about which one you are allowed to call "the right answer".
Solution
Step 1 — ask what each one is built from. The theoretical distribution is computed from the generator's design: it is set to produce values between 0 and 1, with no value favored over any other. Nothing in that computation looks at data.
Step 2 — check which one depends on data. The empirical distribution is a tally of the 50 numbers the generator actually handed you this afternoon. It is a measurement.
Answer: the empirical distribution would change and the theoretical one would not. That is why the theoretical distribution is the standard the other one gets compared against — not because it is more accurate about your 50 values, but because it is the only one of the two that is not a sample. Be clear about the direction of that comparison: you are not checking whether the formula got your run right, you are checking whether your 50-value sample landed where a sample from that formula should land.
4.6.2 Collect the Data
Use a random number generator to generate 50 values between zero and one (inclusive). List them in Table 4.6.1. Round the numbers to four decimal places, or set your calculator's MODE to four places so the rounding happens for you.
Try it in rāSHio
You do not need a graphing calculator for this step — open rāSHio and choose File → Random Numbers…. rāSHio draws whole numbers, so ask it for 50 values with Min 0, Max 9999 and How many 50, then divide each by 10,000 to land in the 0-to-1 range at exactly the four decimal places this lab asks for. Leave No repeats unticked: the values are drawn independently, so a repeat is allowed and forbidding one would quietly bias your sample.
Figure 4.6.1 — Generating the lab’s 50 values in rāSHio: File → Random Numbers…
- Complete the table.
| 1–5 | 6–10 | 11–15 | 16–20 | 21–25 |
|---|---|---|---|---|
| 26–30 | 31–35 | 36–40 | 41–45 | 46–50 |
|---|---|---|---|---|
- Calculate the following:
a. \(\bar{x} =\) _________
b. \(s =\) _________
c. first quartile = _________
d. third quartile = _________
e. median = _________
The theoretical values you will compare against are 0.2500, 0.5000, and 0.7500. Round your data to two places and a quartile of 0.2537 becomes 0.25 — a perfect match you did not actually earn. Matching precision on both sides is what keeps the comparison honest.
Sort the 50 values before you touch the quartiles. Every one of those five statistics except \(\bar{x}\) and \(s\) is read off a position in the sorted list, and with an even count of 50 values the median is the average of the 25th and 26th, the first quartile is the median of the lowest 25, and the third quartile is the median of the highest 25. Doing this by hand once is worth it, because it shows you that a quartile is a location in the data rather than a formula applied to it — which is exactly why a quartile of the generated data can drift away from the theoretical quartile without anything being wrong.
Try it in rāSHio
Sorting 50 four-decimal values by hand is where copying mistakes creep in. Paste your column into rāSHio with File → Delimited List…, then choose Transform → Sort to put them in order — and count the positions yourself from there. The 25th and 26th values give the median, the median of the lowest 25 gives the first quartile, and the median of the highest 25 gives the third. Sorting is the mechanical part; locating a quartile is the part worth doing by hand once.
Figure 4.6.2 — Ordering the lab’s 50 values in rāSHio: Transform → Sort.
Try it in rāSHio
Once the column is sorted, check all five of your part-2 blanks at once: rāSHio’s Stats → Summary Statistics returns the mean, the standard deviation, the median, and both quartiles for the selected column in one step. Use it to CHECK the numbers you worked out, not to replace them — if the tool and your hand count disagree on a quartile, you have found either a mis-sorted value or a position you counted off by one, and both are worth finding now.
Figure 4.6.3 — Checking the five part-2 blanks in rāSHio: Stats → Summary Statistics.
Hannah ran a short pilot before the real lab and generated only twelve values, which she has already sorted:
0.0412, 0.1187, 0.2043, 0.2765, 0.3391, 0.4508, 0.5624, 0.6130, 0.7042, 0.8219, 0.8873, 0.9564
Find the median, the first quartile, and the third quartile.
Solution
Step 1 — find the median. There are twelve values, so the median sits between the 6th and 7th.
$$ \text{median} = \frac{0.4508 + 0.5624}{2} = \frac{1.0132}{2} = 0.5066 $$Step 2 — take the first quartile from the lower half. The lowest six values are 0.0412 through 0.4508, and their median is the average of the 3rd and 4th.
$$ Q_1 = \frac{0.2043 + 0.2765}{2} = \frac{0.4808}{2} = 0.2404 $$Step 3 — take the third quartile from the upper half. The highest six values are 0.5624 through 0.9564, and their median is the average of the 9th and 10th values overall.
$$ Q_3 = \frac{0.7042 + 0.8219}{2} = \frac{1.5261}{2} \approx 0.7631 $$Answer: Hannah's median \(= 0.5066\), \(Q_1 = 0.2404\), \(Q_3 = 0.7631\). Hold those against the theoretical 0.5000, 0.2500, and 0.7500 you will compute later — each one is off by less than 0.015, from a sample of only twelve. That is a preview of the whole lab: the sample does not land on the theoretical value, it lands near it.
Using the same twelve values from Hannah's pilot, find the sample mean \(\bar{x}\).
Solution
Step 1 — add the twelve values.
$$ 0.0412 + 0.1187 + 0.2043 + 0.2765 + 0.3391 + 0.4508 + 0.5624 + 0.6130 + 0.7042 + 0.8219 + 0.8873 + 0.9564 = 5.9758 $$Step 2 — divide by the count.
$$ \bar{x} = \frac{5.9758}{12} \approx 0.4980 $$Answer: \(\bar{x} \approx 0.4980\). The theoretical mean is 0.5000, so this sample landed within 0.002 of it. Do not read that as "twelve values is plenty" — it is one run, and a different twelve values could easily have come out at 0.44 or 0.56. What the mean does reliably is sit near the center; how near depends on how many values you averaged.
Hannah's lab partner Cole takes the same twelve values and works out the sample standard deviation \(s\). Do it with him: their sum is 5.9758 and the sum of their squares is 4.0176696.
Solution
Step 1 — subtract the part explained by the mean. With \(n = 12\) and \(\bar{x} \approx 0.4980\),
$$ s^2 = \frac{\sum x^2 - n\bar{x}^2}{n - 1} = \frac{4.0176696 - 12(0.49798)^2}{11} \approx \frac{4.0176696 - 2.9758}{11} \approx \frac{1.0419}{11} \approx 0.0947 $$Step 2 — take the square root.
$$ s = \sqrt{0.0947} \approx 0.3078 $$Answer: Cole gets \(s \approx 0.3078\). Hold his number beside the theoretical \(\sigma \approx 0.2887\) you will compute in the Theoretical Distribution section — the sample came out about 7% more spread out than the model predicts. Divide by \(n - 1\), not \(n\); these twelve values are a sample, not every value the generator could ever produce. And notice that \(s\) drifted further from \(\sigma\) than \(\bar{x}\) did from \(\mu\). A standard deviation is built from squared distances, so a single value out near an end moves it more than it moves the mean.
4.6.3 Organize the Data
- Construct a histogram of the empirical data. Make eight bars. Put the generated value on the horizontal axis, running from 0 to 1, and the frequency on the vertical axis. Title it your eight-bar histogram so you can refer to it in the discussion question.
- Construct a second histogram of the same empirical data. Make five bars, on the same horizontal axis and with the same axis label, and title it your five-bar histogram.
Both histograms show the same 50 numbers. Nothing about the data changes between them — the only thing that changes is how wide a slice of the interval each bar is allowed to cover, and therefore how many of your 50 values land in it. Because the interval from 0 to 1 is being cut into equal pieces, eight bars means each bar is 0.125 wide and five bars means each is 0.2 wide, and the count you expect in a bar is just 50 times the width of that bar.
Try it in rāSHio
Draw both histograms in rāSHio rather than by hand, so the only thing that differs between them is the bar count. With your values in the spreadsheet choose Graph → Histogram, set the bin start to 0 and the bin width to 0.125 for the eight-bar version, then re-run it at width 0.2 for the five-bar version. Keeping the same axis on both is what makes the shape comparison in the next section mean anything.
Two people can draw honest, correct histograms of identical data and get pictures that look different, because the bar width is theirs to pick. That is why the lab makes you draw both — so you see the choice before you draw a conclusion from it.
For 50 values generated between 0 and 1, find the width of each bar and the number of values you would expect in each bar, first for eight bars and then for five.
Solution
Step 1 — get the bar widths. The interval from 0 to 1 has length 1, split into equal pieces.
$$ \text{eight bars: } \frac{1}{8} = 0.125 \qquad \text{five bars: } \frac{1}{5} = 0.2 $$Step 2 — turn a width into an expected count. Because every value between 0 and 1 is equally likely, the chance of landing in a bar is exactly that bar's width, so the expected count is 50 times the width.
$$ 50(0.125) = 6.25 \qquad 50(0.2) = 10 $$Answer: eight bars of width 0.125 with 6.25 values expected in each, and five bars of width 0.2 with 10 expected in each. The 6.25 is worth staring at — no bar can hold a quarter of a value. An expected count is an average over many reruns of the lab, not a prediction of what any one histogram will show, which is exactly why a bar holding 4 or 9 is not evidence that the generator is broken.
4.6.4 Describe the Data
- In two to three complete sentences, describe the shape of each graph. Keep it simple: does the graph go straight across, does it have a V shape, does it have a hump in the middle or at either end? One way to help you determine a shape is to draw a smooth curve roughly through the top of the bars.
- Describe how changing the number of bars might change the shape.
The shape you are hoping to see is flat — every bar about the same height — because that is what "every value is equally likely" looks like once you draw it. What you will actually see is a ragged version of flat, with some bars noticeably taller than their neighbors. Describing the shape well means naming the flat trend and the raggedness, rather than picking one and pretending the other is not there.
Two students describe the same 50 values. Aiko says the eight-bar histogram she drew is "roughly flat with some bounce". Imani says the five-bar histogram they drew is "clearly flat". Both are looking at correct histograms of the same data. Explain how both descriptions can be right.
Solution
Step 1 — compare the expected counts. Aiko's eight bars expect 6.25 values each; Imani's five bars expect 10 each.
Step 2 — ask how much a bar can wobble. A bar that comes out 3 above expectation is off by about half its height at 6.25, but only about a third of its height at 10. The same absolute wobble looks bigger on a shorter bar.
Step 3 — see what wider bars do. Widening the bars pools more values into each one, and pooling averages the wobble out. Imani's five bars each absorb the ups and downs of what would have been more than one of Aiko's bars.
Answer: both students are right, because the fewer and wider bars Imani chose smooth the picture while the more and narrower bars Aiko chose expose the run-to-run variation. Neither histogram is more truthful than the other — they trade detail against steadiness. The reason the lab has you draw both is so you notice that "the data looks uniform" is partly a statement about the data and partly a statement about how you chose to draw it.
4.6.5 Theoretical Distribution
A continuous random variable \(X\) that has equally likely outcomes over the domain \(a < x < b\), written \(X \sim U(a, b)\). Its probability density function, mean, and standard deviation are
$$ f(x) = \frac{1}{b - a} \quad \text{for } a \leq x \leq b, \qquad \mu = \frac{a + b}{2}, \qquad \sigma = \sqrt{\frac{(b - a)^2}{12}} $$and its cumulative distribution function is \(P(X \leq x) = \dfrac{x - a}{b - a}\).
Every number below comes out of \(a = 0\) and \(b = 1\) — the mean, the spread, and all three quartiles. A uniform distribution has nothing else to know, which is exactly what makes it a clean standard to test a generator against.
- In words, \(X =\) _________.
- The theoretical distribution of \(X\) is \(X \sim U(0,1)\).
- In theory, based upon the distribution \(X \sim U(0,1)\), complete the following.
a. \(\mu =\) _________
b. \(\sigma =\) _________
c. first quartile = _________
d. third quartile = _________
e. median = _________
- Are the empirical values (the data) in the Collect the Data section close to the corresponding theoretical values? Why or why not?
Every one of those five theoretical numbers comes out of the two endpoints \(a = 0\) and \(b = 1\), and nothing else. The generator never gets consulted. That is the property that makes the theoretical column the fixed standard: you could compute all five of these on the bus this morning, before anyone in the room had generated a single value.
The quartiles and the median all come from the same place — the cumulative distribution function. For \(X \sim U(0,1)\), \(P(X \leq x) = x\), which says the probability of landing at or below a value is that value. So the number with 25% of the distribution below it is 0.25, the number with half below it is 0.5, and the number with 75% below it is 0.75. On a uniform distribution the percentile and the value are the same number, which is a coincidence of \(U(0,1)\) and not a general rule.
Compute \(\mu\) and \(\sigma\) for \(X \sim U(0,1)\).
Solution
Step 1 — identify the endpoints. Here \(a = 0\) and \(b = 1\).
Step 2 — apply the mean formula.
$$ \mu = \frac{a + b}{2} = \frac{0 + 1}{2} = 0.5 $$Step 3 — apply the standard deviation formula.
$$ \sigma = \sqrt{\frac{(b - a)^2}{12}} = \sqrt{\frac{1}{12}} = \frac{1}{\sqrt{12}} \approx 0.2887 $$Answer: \(\mu = 0.5\) and \(\sigma \approx 0.2887\). Notice that \(\sigma\) is a good deal smaller than the 0.5 half-width of the interval. That is the uniform distribution's shape showing up in a number: the values are spread evenly rather than piled at the two ends, so a typical value sits about 0.29 away from the center rather than the 0.5 you would get if every value were at 0 or 1.
Use the cumulative distribution function to find the first quartile, the median, and the third quartile of \(X \sim U(0,1)\).
Solution
Step 1 — write down the cdf. With \(a = 0\) and \(b = 1\),
$$ P(X \leq x) = \frac{x - a}{b - a} = \frac{x - 0}{1 - 0} = x $$Step 2 — set it equal to each target proportion and solve. The first quartile is the value with 0.25 of the distribution below it, so solve \(x = 0.25\). The median has 0.50 below it, so \(x = 0.50\). The third quartile has 0.75 below it, so \(x = 0.75\).
Answer: \(Q_1 = 0.2500\), median \(= 0.5000\), \(Q_3 = 0.7500\). These are the four-decimal values to write in the Theoretical Distribution blanks, and they are the numbers your sorted 50 values get held up against. The median equals the mean here because the uniform distribution is symmetric — a fact that will stop being true the moment you meet a skewed distribution.
Hannah's twelve pilot values gave \(\bar{x} \approx 0.4980\), median \(= 0.5066\), \(Q_1 = 0.2404\), and \(Q_3 = 0.7631\). Answer question 4 above for her: are the empirical values close to the theoretical ones, and why or why not?
Solution
Step 1 — line the four pairs up. Mean 0.4980 against 0.5000; median 0.5066 against 0.5000; \(Q_1\) 0.2404 against 0.2500; \(Q_3\) 0.7631 against 0.7500.
Step 2 — measure each gap. The gaps are 0.0020, 0.0066, 0.0096, and 0.0131 — all under 0.014, on a scale where the whole distribution is only 1 wide.
Step 3 — say why they are not exact. Twelve values are a sample. Each one is drawn independently, and there is no mechanism forcing a sample's quartile to equal the distribution's quartile; the only guarantee is that the sample statistics cluster around the theoretical ones and cluster more tightly as the sample grows.
Answer: yes, close — every statistic is within about 1.3% of the width of the distribution — and they are not exact because the empirical values are measurements of a random sample while the theoretical values are computed from the generator's design. Notice which gap is biggest: the quartiles drifted more than the mean did. That is normal. The mean uses all twelve values, while each quartile is pinned by the position of just two of them, so a quartile is the shakier estimate of the pair.
4.6.6 Plot the Data
A data value that falls unusually far from the middle half of the data. Using the interquartile range \(IQR = Q_3 - Q_1\), a value \(x\) is a potential outlier when
$$ x < Q_1 - 1.5(IQR) \qquad \text{or} \qquad x > Q_3 + 1.5(IQR) $$The two boundary values are called the fences. Anything outside them is flagged for a second look, not automatically thrown away.
- Construct a box plot of the data. Be sure to use a ruler to scale accurately and draw straight edges.
- Do you notice any potential outliers? If so, which values are they? Either way, justify your answer numerically.
Justifying it numerically means computing both fences and saying which of your 50 values, if any, fall outside them — not eyeballing the box plot and deciding a whisker looks long. Compute \(IQR = Q_3 - Q_1\) from your own quartiles, multiply by 1.5, then subtract from \(Q_1\) and add to \(Q_3\). Write both fence values down in your report even when nothing crosses them, because "no outliers" is a claim, and the fences are the evidence for it.
Try it in rāSHio
rāSHio’s Graph → Box Plot draws the five-number summary for your sorted column and marks any value outside the fences as a separate point, so you can check your hand-drawn plot against it. Read the tool as a second opinion on the picture, not as the justification — the lab wants the two fence values written out, and those come from your own \(Q_1\), \(Q_3\), and \(IQR\).
Figure 4.6.4 — Checking the lab’s box plot in rāSHio: Graph → Box Plot.
Compute the two outlier fences for the theoretical distribution \(X \sim U(0,1)\), and say what they imply about finding outliers in this lab.
Solution
Step 1 — get the IQR from the theoretical quartiles.
$$ IQR = Q_3 - Q_1 = 0.75 - 0.25 = 0.50 $$Step 2 — build the fences.
$$ Q_1 - 1.5(IQR) = 0.25 - 1.5(0.50) = 0.25 - 0.75 = -0.50 $$ $$ Q_3 + 1.5(IQR) = 0.75 + 1.5(0.50) = 0.75 + 0.75 = 1.50 $$Step 3 — compare the fences to the possible values. The generator only ever produces values between 0 and 1, and both fences sit outside that interval.
Answer: the fences are at \(-0.50\) and \(1.50\), so no value this generator can produce could ever be flagged as a potential outlier. That is a real property of the uniform distribution, not a quirk of the numbers: with the data spread evenly and no tails, there is nothing far from the middle for the rule to catch. If your own fences (computed from your sample's quartiles rather than the theoretical ones) do flag a value, look at it — the likeliest explanations are a typo when you copied a number into the table or a value entered at the wrong number of decimal places, not a surprising draw.
4.6.7 Compare the Data
- For each of the following parts, use a complete sentence to comment on how the value obtained from the data compares to the theoretical value you expected from the distribution in the Theoretical Distribution section.
a. minimum value: _________
b. first quartile: _________
c. median: _________
d. third quartile: _________
e. maximum value: _________
f. width of IQR: _________
g. overall shape: _________
- Based on your comments in the Collect the Data section, how does the box plot fit or not fit what you would expect of the distribution in the Theoretical Distribution section?
The theoretical distribution has no smallest or largest value it expects — it runs right up to 0 and 1 without ever promising to reach them. Your sample's minimum is whichever of 50 draws happened to land lowest, so "close to 0" is the most you can ask of it.
Parts b through d are matched pairs and should be answered the same way each time: state your value, state the theoretical value, and say how far apart they are in the units of the data. Part f is the one that most often gets a vague answer — the theoretical IQR is 0.50 exactly, so your sample's \(Q_3 - Q_1\) either came out wider than 0.50 or narrower, and saying which tells the reader whether your middle half was more spread out or more bunched than the model predicts.
Mateo is writing up Hannah's pilot for the class. Her twelve values gave \(Q_1 = 0.2404\) and \(Q_3 = 0.7631\), with a minimum of 0.0412 and a maximum of 0.9564. Answer parts b, d, e, and f as he would.
Solution
Step 1 — the first quartile (part b). The group's \(Q_1 = 0.2404\) against a theoretical 0.2500, so the sample's first quartile is 0.0096 lower than expected.
Step 2 — the third quartile (part d). The group's \(Q_3 = 0.7631\) against a theoretical 0.7500, so the sample's third quartile is 0.0131 higher than expected.
Step 3 — the maximum (part e). The group's largest value is 0.9564. The distribution runs to 1, so the sample fell 0.0436 short of the top of the interval — expected, since landing in the top 4% of the range takes a lucky draw and there were only twelve.
Step 4 — the width of the IQR (part f).
$$ IQR = 0.7631 - 0.2404 = 0.5227 $$against a theoretical 0.5000, so the sample's middle half is 0.0227 wider than the model predicts.
Answer: \(Q_1\) came in 0.0096 low, \(Q_3\) came in 0.0131 high, the maximum fell 0.0436 short of 1, and the IQR came out 0.5227 — about 4.5% wider than 0.50. Read those together and the picture is coherent: both quartiles drifted outward, so of course the distance between them grew. Reporting the IQR gap as a separate surprise, when it is just the sum of the two quartile gaps you already reported, is the most common way this part of the lab gets written up wrong.
4.6.8 Discussion Question
- Suppose that the number of values generated was 500, not 50. How would that affect what you would expect the empirical data to be and the shape of its graph to look like?
Work the discussion question all the way through for yourself before you discuss it. Which of your two columns — empirical or theoretical — changes when you generate 500 values instead of 50, in which direction, and what stays fixed?
Solution
Step 1 — identify what each column is made of. The empirical column holds \(\bar{x}\), \(s\), the quartiles, and the median of numbers the generator actually produced. The theoretical column holds values computed from \(a = 0\) and \(b = 1\).
Step 2 — see which one has data in it. Only the empirical column does. The theoretical column never looks at the generator, so producing ten times as many values cannot move a single entry in it.
Step 3 — say which direction the empirical column moves. With 500 values, every statistic is built from ten times as much information, so each one settles closer to its theoretical partner. The mean tightens toward 0.5000, the quartiles toward 0.2500 and 0.7500, and the sample standard deviation toward 0.2887.
Step 4 — say what happens to the picture. With eight bars the expected count per bar rises from 6.25 to 62.5, so a bar that runs a few values over or under is now a small fraction of its height instead of a large one. The histogram flattens out and starts looking like the rectangle the density function actually is.
Answer: the empirical column changes and the theoretical column does not; the empirical statistics tighten around the theoretical ones and the histogram flattens toward a rectangle. This is the whole meaning of a continuous distribution's parameters, and it is the lab's real payoff. The 0.5 was never a promise about your 50 values — it was a promise about what the average of generated values does as you keep generating. Fifty values cannot show you that. Five hundred can start to.
Key Terms
empirical distribution — the distribution of data actually collected, summarized by frequencies and sample statistics; a measured quantity that changes each time the experiment is rerun.
fences — the two boundary values \(Q_1 - 1.5(IQR)\) and \(Q_3 + 1.5(IQR)\) used to flag potential outliers.
potential outlier — a data value below the lower fence or above the upper fence, flagged for a second look rather than automatically discarded.
random number generator — a calculator or software tool that produces values which behave as if drawn from a stated distribution, used here to produce values from \(U(0,1)\).
theoretical distribution — the distribution computed from the structure of the experiment rather than from data; the fixed standard an empirical distribution is compared against.
uniform distribution — a continuous random variable with equally likely outcomes over a domain \(a < x < b\), written \(X \sim U(a, b)\).