Tasks 07-06 - Contingency Tables & Bayes
Section 07: Probability & Statistics
A: Skills
Problem 1: Predictive Values from a Table (x)
A recycling plant sorts used plastic bottles. Most bottles are made of PET, but some are made of PVC (\(V\)), a plastic that spoils the recycled PET. An optical sensor gives a signal (\(+\)) for a bottle it takes for PVC, and an air jet blows this bottle off the belt. The PET bottles form the complement \(V'\) (also written \(\bar{V}\)). 4 % of the bottles are made of PVC. The sensor gives a signal for 85 % of the PVC bottles and no signal (\(-\)) for 93 % of the PET bottles.
Give probabilities as fractions or decimals. Where a decimal has to be rounded, round to four decimal places and keep all intermediate results unrounded. This rule holds for the whole sheet.
Complete a contingency table for 10,000 bottles (rows: signal \(+\) or \(-\), columns: \(V\) or \(\bar{V}\), with sums). Name the four inner fields (true positives, false positives, false negatives, true negatives).
Read the positive predictive value \(P(V \mid +)\) and the negative predictive value \(P(\bar{V} \mid -)\) off the table. Name the total you divide by in each case.
Check your positive predictive value with Bayes’ theorem and the law of total probability in the denominator.
Write the true positive rate and the true negative rate as fractions of fields of the table. Explain why they use column totals, while the predictive values use row totals, and interpret the positive predictive value for the plant.
\(10{,}000 \cdot 0.04 = 400\) PVC bottles and \(9{,}600\) PET bottles. Then \(400 \cdot 0.85 = 340\) PVC bottles with a signal and \(9{,}600 \cdot 0.07 = 672\) PET bottles with a signal (false positive rate \(1 - 0.93 = 0.07\)):
PVC (\(V\)) PET (\(\bar{V}\)) sum signal (\(+\)) 340 (true positives) 672 (false positives) 1,012 no signal (\(-\)) 60 (false negatives) 8,928 (true negatives) 8,988 sum 400 9,600 10,000 Check: \(1{,}012 + 8{,}988 = 10{,}000\) and \(400 + 9{,}600 = 10{,}000\) \(\checkmark\)
The signal is known, so the row total of \(+\) is the base:
\[P(V \mid +) = \frac{340}{1012} = \frac{85}{253} \approx 0.3360\]
“No signal” is known, so the row total of \(-\) is the base:
\[P(\bar{V} \mid -) = \frac{8928}{8988} = \frac{744}{749} \approx 0.9933\]
\[P(V \mid +) = \frac{P(+ \mid V) \cdot P(V)}{P(+ \mid V) \cdot P(V) + P(+ \mid \bar{V}) \cdot P(\bar{V})} = \frac{0.85 \cdot 0.04}{0.85 \cdot 0.04 + 0.07 \cdot 0.96} = \frac{0.034}{0.034 + 0.0672} = \frac{0.034}{0.1012} = \frac{85}{253} \;\checkmark\]
\[P(+ \mid V) = \frac{340}{400} = 0.85, \qquad P(- \mid \bar{V}) = \frac{8928}{9600} = 0.93\]
The two rates start from the material of the bottle (PVC or PET), i.e. from a column, so the column total is the base. The predictive values start from the sensor’s result, i.e. from a row, so the row total is the base.
Only about 34 % of the blown-off bottles are really PVC. The other 66 % are good PET bottles that the plant loses, because PET bottles are so much more common than PVC bottles.
Typical mistake: in b), dividing 340 by the column total 400. That gives the true positive rate 0.85 again, not the share of PVC bottles among the bottles with a signal.
Problem 2: A Table from Percentages (x)
A cinema asks 800 visitors of one weekend two questions. 45 % of the visitors buy a snack (\(S\)), 30 % booked their ticket online (\(O\)), and 12 % of all visitors did both.
Complete a contingency table of counts (rows: \(S\) and \(\bar{S}\), columns: \(O\) and \(\bar{O}\), with sums).
Compute \(P(O \mid S)\) and \(P(S \mid O)\) from the table. Name the total you divide by in each case.
Decide with \(P(S \cap O) = P(S) \cdot P(O)\) whether buying a snack and booking online are independent.
Compute \(P(S \mid \bar{O})\) and compare it with \(P(S \mid O)\). Say in one sentence what the comparison means for the cinema.
\(800 \cdot 0.45 = 360\) snack buyers, \(800 \cdot 0.3 = 240\) online bookers, \(800 \cdot 0.12 = 96\) with both. The other fields follow by subtraction:
online (\(O\)) not online (\(\bar{O}\)) sum snack (\(S\)) 96 264 360 no snack (\(\bar{S}\)) 144 296 440 sum 240 560 800 Check: \(96 + 264 + 144 + 296 = 800\) \(\checkmark\)
\[P(O \mid S) = \frac{96}{360} = \frac{4}{15} \approx 0.2667 \quad \text{(base: row total of } S\text{)}\]
\[P(S \mid O) = \frac{96}{240} = 0.4 \quad \text{(base: column total of } O\text{)}\]
\(P(S) \cdot P(O) = 0.45 \cdot 0.3 = 0.135 \neq 0.12 = P(S \cap O)\), so the two events are not independent.
\[P(S \mid \bar{O}) = \frac{264}{560} = \frac{33}{70} \approx 0.4714\]
Of the visitors who did not book online, about 47 % buy a snack, of the online bookers only 40 %. So online bookers buy snacks less often than the other visitors.
Typical mistake: in a), taking 12 % of the snack buyers (\(0.12 \cdot 360\)) for the field \(S \cap O\). “12 % of all visitors” has all 800 visitors as the base.
Problem 3: A Relative Frequency Table (xx)
An escape room (a game in which a group has one hour to solve puzzles and get out of a locked room) offers a standard room and a premium room with actors. The owner records for every booking whether it is for the premium room (\(P\)) and whether it takes place at the weekend (\(W\)). Some fields of the relative frequency table are known:
| weekend (\(W\)) | weekday (\(\bar{W}\)) | sum | |
|---|---|---|---|
| premium room (\(P\)) | 0.21 | 0.28 | |
| standard room (\(\bar{P}\)) | |||
| sum | 0.30 | 1 |
Complete the relative frequency table.
The escape room has 1,500 bookings per year. Convert the table into a table of counts.
Compute \(P(P \mid W)\), \(P(P \mid \bar{W})\) and \(P(W \mid P)\). Name the total you divide by in each case.
The owner says: “21 % of the weekend groups choose the premium room.” Correct the statement.
Each row and each column adds up to its total:
- \(P(P \cap \bar{W}) = 0.28 - 0.21 = 0.07\), \(P(\bar{P} \cap W) = 0.30 - 0.21 = 0.09\)
- \(P(\bar{P}) = 1 - 0.28 = 0.72\), \(P(\bar{W}) = 1 - 0.30 = 0.70\)
- \(P(\bar{P} \cap \bar{W}) = 0.72 - 0.09 = 0.63\)
\(W\) \(\bar{W}\) sum \(P\) 0.21 0.07 0.28 \(\bar{P}\) 0.09 0.63 0.72 sum 0.30 0.70 1 Check: \(0.21 + 0.07 + 0.09 + 0.63 = 1\) \(\checkmark\)
Multiply every entry by 1,500:
\(W\) \(\bar{W}\) sum \(P\) 315 105 420 \(\bar{P}\) 135 945 1,080 sum 450 1,050 1,500 The condition gives the base:
\[P(P \mid W) = \frac{0.21}{0.30} = 0.7, \qquad P(P \mid \bar{W}) = \frac{0.07}{0.70} = 0.1, \qquad P(W \mid P) = \frac{0.21}{0.28} = 0.75\]
The first two use the column totals of \(W\) and \(\bar{W}\), the third uses the row total of \(P\). The counts give the same values, e.g. \(\frac{315}{450} = 0.7\).
21 % is the joint probability \(P(P \cap W)\): 21 % of all bookings are premium bookings at the weekend. Of the weekend bookings, 70 % are for the premium room, compared with 10 % on weekdays.
Typical mistake: in c), dividing by the grand total 1. A field of a relative frequency table is a joint probability, and a conditional probability needs the total of the condition as the base.
Problem 4: Two Machines in a Table (xx)
A pasta factory fills its pasta into bags on two machines. Machine \(A\) fills 80 % of the bags, machine \(B\) the other 20 %. 3 % of the bags from machine \(A\) and 7 % of the bags from machine \(B\) are underweight (\(U\)).
Complete a contingency table for 5,000 bags (rows: \(U\) and \(\bar{U}\), columns: \(A\) and \(B\), with sums).
Compute the probability that a bag is underweight from the table and check it with the law of total probability.
A bag is underweight. Compute the probability that it comes from machine \(A\) from the table and check it with Bayes’ theorem.
Compute \(P(B \mid U)\) and \(P(U \mid B)\). Explain why they differ and compare \(P(B \mid U)\) with the share of machine \(B\) in the production.
\(5{,}000 \cdot 0.8 = 4{,}000\) bags from \(A\) and \(1{,}000\) from \(B\). The rates refer to the bags of one machine, so the column totals are the bases: \(4{,}000 \cdot 0.03 = 120\) and \(1{,}000 \cdot 0.07 = 70\) underweight bags.
\(A\) \(B\) sum underweight (\(U\)) 120 70 190 correct (\(\bar{U}\)) 3,880 930 4,810 sum 4,000 1,000 5,000 \[P(U) = \frac{190}{5000} = 0.038\]
Law of total probability: \(P(U) = 0.8 \cdot 0.03 + 0.2 \cdot 0.07 = 0.024 + 0.014 = 0.038\) \(\checkmark\)
The base is the row total of \(U\):
\[P(A \mid U) = \frac{120}{190} = \frac{12}{19} \approx 0.6316\]
Bayes’ theorem: \(P(A \mid U) = \frac{P(U \mid A) \cdot P(A)}{P(U)} = \frac{0.024}{0.038} = \frac{12}{19}\) \(\checkmark\)
\[P(B \mid U) = \frac{70}{190} = \frac{7}{19} \approx 0.3684, \qquad P(U \mid B) = \frac{70}{1000} = 0.07\]
Both have the numerator 70, but different bases: \(P(B \mid U)\) looks at the 190 underweight bags, \(P(U \mid B)\) at the 1,000 bags from \(B\).
Machine \(B\) fills only 20 % of the bags, but about 37 % of the underweight bags come from it. Its rate of underweight bags is more than twice as high, so its bags are overrepresented among the underweight ones.
Typical mistake: in a), taking 3 % of all 5,000 bags (\(150\)) for the field \(U \cap A\). “3 % of the bags from machine \(A\)” has the 4,000 bags from \(A\) as the base.
Problem 5: Expected Counts and Independence (xx)
A tour operator (a company that puts together package holidays) sells holidays in its travel shops and online. For every booking, it records whether the customer buys a travel insurance (\(I\)) and whether the holiday is a long-haul trip outside Europe (\(L\)).
Bookings in the travel shops:
| long-haul (\(L\)) | Europe (\(\bar{L}\)) | sum | |
|---|---|---|---|
| insurance (\(I\)) | 84 | 66 | 150 |
| no insurance (\(\bar{I}\)) | 36 | 264 | 300 |
| sum | 120 | 330 | 450 |
Bookings online:
| long-haul (\(L\)) | Europe (\(\bar{L}\)) | sum | |
|---|---|---|---|
| insurance (\(I\)) | 45 | 105 | 150 |
| no insurance (\(\bar{I}\)) | 135 | 315 | 450 |
| sum | 180 | 420 | 600 |
For the travel shops, compute the expected count of the field \(I \cap L\) if buying an insurance were independent of the destination. Compare it with the observed count and decide.
Compute the expected counts of all four fields for the travel shops and check that they have the same row and column totals as the observed table.
Decide for the online bookings with the expected count and with \(P(I \cap L) = P(I) \cdot P(L)\) whether \(I\) and \(L\) are independent.
Compute \(P(I \mid L)\) and \(P(I \mid \bar{L})\) for both sales channels and interpret the results for the tour operator.
\[E_{I,L} = \frac{\text{row total} \cdot \text{column total}}{\text{grand total}} = \frac{150 \cdot 120}{450} = 40\]
Observed: 84. Since \(84 \neq 40\), insurance and destination are not independent in the travel shops.
\(E_{I,\bar{L}} = \frac{150 \cdot 330}{450} = 110\), \(E_{\bar{I},L} = \frac{300 \cdot 120}{450} = 80\), \(E_{\bar{I},\bar{L}} = \frac{300 \cdot 330}{450} = 220\):
\(L\) \(\bar{L}\) sum \(I\) 40 110 150 \(\bar{I}\) 80 220 300 sum 120 330 450 Check: the row totals 150 and 300 and the column totals 120 and 330 are the same as in the observed table \(\checkmark\)
\[E_{I,L} = \frac{150 \cdot 180}{600} = 45 = \text{observed count}\]
Independence test with probabilities: \(P(I) \cdot P(L) = \frac{150}{600} \cdot \frac{180}{600} = 0.25 \cdot 0.3 = 0.075 = \frac{45}{600} = P(I \cap L)\) \(\checkmark\)
For the online bookings, \(I\) and \(L\) are independent. (The other three fields also match: e.g. \(\frac{450 \cdot 420}{600} = 315\).)
Travel shops: \(P(I \mid L) = \frac{84}{120} = 0.7\), \(P(I \mid \bar{L}) = \frac{66}{330} = 0.2\).
Online: \(P(I \mid L) = \frac{45}{180} = 0.25\), \(P(I \mid \bar{L}) = \frac{105}{420} = 0.25\).
In the travel shops, 70 % of the long-haul customers buy an insurance, but only 20 % of the Europe customers. Online, a quarter of the customers buy an insurance, whatever the destination. The tour operator could show the insurance more clearly for long-haul trips on its website.
Typical mistake: in a), computing \(\frac{150}{450} \cdot \frac{120}{450} \approx 0.0889\) and comparing it with 84. This product is a probability. Multiplied by the grand total 450, it gives the expected count 40.
B: Set Up & Check
Problem 6: From Words to Table Fields (xx)
Translate each statement into a table field, a total or a probability. Then answer the check question: it tells you whether your translation works.
In a mobile phone shop, 55 % of the customers buy a new phone (\(N\)). Of the customers who buy a new phone, 20 % also take out an insurance for the phone (\(I\)). Write both statements in probability notation and compute the two fields of the row \(N\) in a relative frequency table.
Check: A classmate writes 20 % into the field \(N \cap I\). Explain which total the 20 % refer to and how you get them back from the table.
At a music school, 35 % of the students take a weekly private lesson (\(L\)), the others learn in groups. 30 % of all students play in one of the school’s bands (\(B\)), and 14 % of all students take a private lesson and play in a band. Enter the three values in a relative frequency table and complete it.
Check: The head of the school says: “Of the students who play in a band, 14 % take a private lesson.” Decide whether this is right.
A zoo sells 1,500 tickets for a holiday weekend. 600 of them are family tickets (\(F\)), and 360 ticket buyers book a guided tour (\(G\)). Write the expected count of the field \(F \cap G\) if booking a tour were independent of the ticket type, and compute it.
Check: Show that with your expected count, the share of tour bookers among the family tickets is the same as the share among all tickets.
A furniture store records for each order whether the customer orders delivery (\(D\)) and whether the customer orders assembly (\(M\)), i.e. the store’s staff assemble the furniture in the customer’s home. State the businesslike meaning of \(\bar{D} \cap M\), \(D \setminus M\) and \(\overline{D \cup M}\), and name the field of a contingency table (rows \(D\) and \(\bar{D}\), columns \(M\) and \(\bar{M}\)) that belongs to each of them.
Check: A classmate reads \(\overline{D \cup M}\) as “the customer does not order both services”. Decide whether this is right.
A pizzeria records its 250 orders of one Saturday evening:
paid online (\(O\)) paid on the spot (\(\bar{O}\)) sum delivered (\(D\)) 100 50 150 picked up (\(\bar{D}\)) 20 80 100 sum 120 130 250 Convert the table into a relative frequency table (in % of all orders).
Check: A classmate divides each field by its row total and gets 66.67 % and 33.33 % in the first row. Explain what these numbers are and how you can see that the classmate’s table is not a relative frequency table.
“Of the customers who buy a new phone” names the condition \(N\):
\[P(N) = 0.55, \qquad P(I \mid N) = 0.2\]
Multiplication rule for the field, then the rest of the row by subtraction:
\[P(N \cap I) = P(N) \cdot P(I \mid N) = 0.55 \cdot 0.2 = 0.11, \qquad P(N \cap \bar{I}) = 0.55 - 0.11 = 0.44\]
Check: the 20 % refer to the row total of \(N\), not to all customers. In the table, they come back as field divided by row total: \(\frac{0.11}{0.55} = 0.2\).
Typical mistake: writing a conditional share into a field. A field of a relative frequency table is always a share of all customers.
“Of all students” means the grand total is the base, so 14 % is a field and 35 % and 30 % are totals:
\(B\) \(\bar{B}\) sum \(L\) 0.14 0.21 0.35 \(\bar{L}\) 0.16 0.49 0.65 sum 0.30 0.70 1 Check: the head of the school is wrong. 14 % of all students take a private lesson and play in a band. Of the students who play in a band, the share is
\[P(L \mid B) = \frac{0.14}{0.30} = \frac{7}{15} \approx 0.4667\]
Typical mistake: reading a share “of all” as a share of a group. Only the phrase “of the …” changes the base.
\[E_{F,G} = \frac{\text{row total} \cdot \text{column total}}{\text{grand total}} = \frac{600 \cdot 360}{1500} = 144\]
Check: \(\frac{144}{600} = 0.24 = \frac{360}{1500}\) \(\checkmark\) Under independence, knowing that a ticket is a family ticket does not change the share of tour bookers.
Typical mistake: stopping at \(\frac{600}{1500} \cdot \frac{360}{1500} = 0.096\). This is the probability \(P(F) \cdot P(G)\). The expected count is this probability times the grand total 1,500.
The three sets in words, with their fields:
- \(\bar{D} \cap M\): the customer takes the furniture home without delivery but orders the assembly (field in row \(\bar{D}\), column \(M\)).
- \(D \setminus M = D \cap \bar{M}\): the customer orders delivery but assembles the furniture without the store’s help (field in row \(D\), column \(\bar{M}\)).
- \(\overline{D \cup M}\): the customer orders neither delivery nor assembly (field in row \(\bar{D}\), column \(\bar{M}\)).
Check: wrong. “Not both services” is \(\overline{D \cap M}\): it contains the three fields outside \(D \cap M\), e.g. also a customer with delivery only. \(\overline{D \cup M}\) means “neither service” and is a single field.
Typical mistake: treating the bar over a union like the bar over an intersection. Draw the Venn diagram: \(\overline{D \cup M}\) is the region outside both circles.
Divide every entry by the grand total 250:
\(O\) \(\bar{O}\) sum \(D\) 40 % 20 % 60 % \(\bar{D}\) 8 % 32 % 40 % sum 48 % 52 % 100 % Check: the classmate’s numbers are conditional probabilities, \(P(O \mid D) = \frac{100}{150} \approx 0.6667\) and \(P(\bar{O} \mid D) = \frac{50}{150} \approx 0.3333\), i.e. shares among the delivered orders. Each of the classmate’s rows adds up to 100 %, so the four fields add up to 200 %. In a relative frequency table, the four fields add up to 100 %.
Typical mistake: dividing by the row totals. For a relative frequency table, every field is divided by the same number, the grand total.
Problem 7: One Paragraph, One Table (xx)
A regional bus company surveys its passengers on one weekday. 45 % of the passengers have a monthly pass (\(M\)). Of the passengers with a monthly pass, 68 % travel to work or to school (\(W\)). Of the passengers without a monthly pass, 22 % travel to work or to school. The company wants to know the share of passengers who travel to work or to school, the probability that a passenger who travels to work or to school has a monthly pass, the share of passengers who have no monthly pass and do not travel to work or to school, and whether having a monthly pass is independent of the purpose of the trip.
Draw the empty contingency table (rows \(W\) and \(\bar{W}\), columns \(M\) and \(\bar{M}\), with sums) and write every given value into the field or total where it belongs, as a share of all passengers. Write products, do not compute them. Then write every question of the company as a mathematical statement and name the field or total you would divide by. Do not compute anything.
Check: An assistant writes 68 % into the field \(M \cap W\). Explain the mistake.
Table with the given values as shares of all passengers:
| \(M\) | \(\bar{M}\) | sum | |
|---|---|---|---|
| \(W\) | \(0.45 \cdot 0.68\) | \((1 - 0.45) \cdot 0.22\) | sum of the row |
| \(\bar{W}\) | \(0.45 \cdot (1 - 0.68)\) | \((1 - 0.45) \cdot (1 - 0.22)\) | sum of the row |
| sum | \(0.45\) | \(1 - 0.45\) | \(1\) |
Questions as mathematical statements:
- Random experiment: one randomly chosen passenger of that weekday, with \(M\) = “has a monthly pass” and \(W\) = “travels to work or to school”
- Share of passengers who travel to work or to school: \(P(W) = P(M \cap W) + P(\bar{M} \cap W)\), the row total of \(W\) (law of total probability)
- A passenger who travels to work or to school has a monthly pass: \(P(M \mid W) = \frac{P(M \cap W)}{P(W)}\), field \(M \cap W\) divided by the row total of \(W\)
- No monthly pass and not to work or to school: \(P(\bar{M} \cap \bar{W})\), a field, divided by the grand total 1
- Independence: compare the field \(P(M \cap W)\) with the product of its totals \(P(M) \cdot P(W)\) (in counts: observed count and expected count \(\frac{\text{row total} \cdot \text{column total}}{\text{grand total}}\))
Check: the 68 % refer only to the passengers with a monthly pass, so they are the conditional probability \(P(W \mid M)\). In the table, they appear as field divided by column total. The field itself is the product \(P(M) \cdot P(W \mid M) = 0.45 \cdot 0.68\).
Typical mistake: dividing by the column total of \(M\) for question 3. The passenger is known to travel to work or to school, so \(W\) is the condition and its row total is the base.
C: Applied
Problem 8: Camera Check at a Weaving Mill (xx)
A weaving mill (a factory that weaves fabric) produces 10,000 rolls of curtain fabric per month. From past data, 10 % of the rolls have a weaving fault (\(F\)). A camera system checks every roll and flags (\(+\)) 90 % of the rolls with a fault, but also 6 % of the rolls without a fault. Every flagged roll is checked again by hand, and the faults found by hand are repaired before delivery. Rolls without a flag (\(-\)) are delivered without a hand check.
- Display the rolls of one month in a contingency table (rows: \(+\) and \(-\), columns: \(F\) and \(\bar{F}\), with sums).
(for verification: 1,440 rolls are flagged)
Compute the probability that a flagged roll really has a fault and the probability that a roll without a flag is free of faults. Name both values and interpret them for the hand check.
The production manager says: “The camera misses only 1 % of the faults.” Compute \(P(F \cap -)\), \(P(F \mid -)\) and \(P(- \mid F)\) from the table and assess the statement.
Suppose the camera flagged 1,440 rolls per month at random, independently of the faults. Compute the expected number of flagged rolls with a fault and compare it with the table. Explain what the comparison says about the camera.
A hand check costs 6 EUR per roll, and the camera system costs 9,000 EUR per month. A faulty roll that reaches a customer costs the mill 250 EUR on average (complaint and replacement). Compare the monthly costs of the camera system with a hand check of every roll, which finds every fault.
a) \(10{,}000 \cdot 0.1 = 1{,}000\) rolls with a fault and \(9{,}000\) without. Then \(1{,}000 \cdot 0.9 = 900\) flagged rolls with a fault and \(9{,}000 \cdot 0.06 = 540\) flagged rolls without a fault:
| fault (\(F\)) | no fault (\(\bar{F}\)) | sum | |
|---|---|---|---|
| flagged (\(+\)) | 900 | 540 | 1,440 |
| not flagged (\(-\)) | 100 | 8,460 | 8,560 |
| sum | 1,000 | 9,000 | 10,000 |
Check: \(1{,}440 + 8{,}560 = 10{,}000\) and \(1{,}000 + 9{,}000 = 10{,}000\) \(\checkmark\)
b) Positive predictive value, the base is the row total of \(+\):
\[P(F \mid +) = \frac{900}{1440} = 0.625\]
Negative predictive value, the base is the row total of \(-\):
\[P(\bar{F} \mid -) = \frac{8460}{8560} = \frac{423}{428} \approx 0.9883\]
62.5 % of the hand checks find a fault, the other 37.5 % (540 rolls per month) are checked in vain. Of the rolls without a flag, about 98.83 % are free of faults, so the hand check is spent where the faults are.
c) Same numerator 100, three different bases:
\[P(F \cap -) = \frac{100}{10000} = 0.01, \qquad P(F \mid -) = \frac{100}{8560} = \frac{5}{428} \approx 0.0117, \qquad P(- \mid F) = \frac{100}{1000} = 0.1\]
- \(P(F \cap -) = 0.01\): 1 % of all rolls have a fault and no flag (joint probability).
- \(P(F \mid -) \approx 0.0117\): of the rolls without a flag, about 1.17 % have a fault.
- \(P(- \mid F) = 0.1\): of the rolls with a fault, the camera misses 10 % (false negative rate).
The statement is wrong. “Misses x % of the faults” has the rolls with a fault as the base, so the camera misses 10 % of the faults. The manager’s 1 % is the joint probability with all rolls as the base.
d) If the flags were independent of the faults:
\[E_{+,F} = \frac{\text{row total} \cdot \text{column total}}{\text{grand total}} = \frac{1440 \cdot 1000}{10000} = 144\]
Observed: 900 flagged rolls with a fault, i.e. \(\frac{900}{144} = 6.25\) times as many. A camera that flags at random would find faults in only 10 % of the flagged rolls, the same share as among all rolls. The real camera finds a fault in 62.5 % of the flagged rolls, so its flags depend strongly on the faults, and the camera is useful.
e) Camera system: 1,440 hand checks and 100 faulty rolls that reach a customer:
\[9{,}000 + 1{,}440 \cdot 6 + 100 \cdot 250 = 9{,}000 + 8{,}640 + 25{,}000 = 42{,}640 \text{ EUR}\]
Hand check of every roll: \(10{,}000 \cdot 6 = 60{,}000\) EUR, and no faulty roll reaches a customer.
The camera system is cheaper by \(60{,}000 - 42{,}640 = 17{,}360\) EUR per month, although 100 faulty rolls per month reach customers.
Typical mistake: in c), reading the joint probability 1 % as the false negative rate. The false negative rate uses the column total of \(F\) (1,000 rolls with a fault) as the base.
Problem 9: Counterfeit Brake Pads in an Online Shop (xx)
An online shop for car spare parts sells brake pads. Counterfeit brake pads (\(F\)), i.e. cheap fakes of branded products, are dangerous because they can fail when the driver brakes. Before a package is shipped, a scanner checks its hologram label (a security label that is hard to copy) and flags (\(+\)) 76 % of the counterfeit packages, but also 1 % of the genuine packages.
- The shop buys most packages from a regular wholesaler, and 1 % of these packages are counterfeit. Complete a contingency table for 10,000 packages from the wholesaler and compute the probability that a flagged package is really counterfeit.
(for verification: 175 packages are flagged)
Some packages come from a cheap supplier on an online platform, and 20 % of these packages are counterfeit. Complete a contingency table for 2,000 packages from this supplier and compute the same probability.
Explain with the two tables why the same scanner gives such different results for the two suppliers.
The shop wants to send the flagged packages of a supplier straight back without a further check only if at least 80 % of them are really counterfeit. For a supplier with \(x\) counterfeit packages among 10,000 packages, express the two fields of the row \(+\) with \(x\). Determine the base rate for which exactly 80 % of the flagged packages are counterfeit and decide for which of the two suppliers the shop sends flagged packages straight back.
(for verification: \(x = 500\))
- In one year, the shop receives 10,000 packages from the wholesaler and 2,000 packages from the platform supplier. Combine the tables from a) and b) into one table for all 12,000 packages and compute the probability that a flagged package is counterfeit. Compare the base rate of all 12,000 packages with the base rate from d), explain the result and say why the shop should keep the two suppliers apart.
a) \(10{,}000 \cdot 0.01 = 100\) counterfeit packages, \(9{,}900\) genuine ones. Flagged: \(100 \cdot 0.76 = 76\) counterfeit and \(9{,}900 \cdot 0.01 = 99\) genuine packages:
| \(F\) | \(\bar{F}\) | sum | |
|---|---|---|---|
| \(+\) | 76 | 99 | 175 |
| \(-\) | 24 | 9,801 | 9,825 |
| sum | 100 | 9,900 | 10,000 |
The base is the row total of \(+\):
\[P(F \mid +) = \frac{76}{175} \approx 0.4343\]
b) \(2{,}000 \cdot 0.2 = 400\) counterfeit packages, \(1{,}600\) genuine ones. Flagged: \(400 \cdot 0.76 = 304\) and \(1{,}600 \cdot 0.01 = 16\):
| \(F\) | \(\bar{F}\) | sum | |
|---|---|---|---|
| \(+\) | 304 | 16 | 320 |
| \(-\) | 96 | 1,584 | 1,680 |
| sum | 400 | 1,600 | 2,000 |
\[P(F \mid +) = \frac{304}{320} = 0.95\]
c) The scanner’s rates are the same, but the base rate differs. At the wholesaler, almost all packages are genuine: 1 % of 9,900 genuine packages still gives 99 false alarms, more than the 76 counterfeit packages found. So less than half of the flagged packages are counterfeit. At the platform supplier, there are only 1,600 genuine packages, which gives 16 false alarms against 304 counterfeit packages found.
d) With \(x\) counterfeit packages and \(10{,}000 - x\) genuine ones, the row \(+\) contains
\[0.76x \text{ counterfeit packages} \quad \text{and} \quad 0.01(10{,}000 - x) = 100 - 0.01x \text{ genuine packages}\]
Row total: \(0.76x + 100 - 0.01x = 0.75x + 100\). Exactly 80 % counterfeit:
\[\frac{0.76x}{0.75x + 100} = 0.8 \iff 0.76x = 0.6x + 80 \iff 0.16x = 80 \iff x = 500\]
(The row total is positive, so multiplying by it is allowed.) The base rate is \(\frac{500}{10000} = 5\,\%\).
Check: \(0.76 \cdot 500 = 380\) and \(100 - 5 = 95\), \(\frac{380}{475} = 0.8\) \(\checkmark\)
Wholesaler: 43.43 % < 80 %, so its flagged packages need a further check. Platform supplier: 95 % ≥ 80 %, so the shop sends its flagged packages straight back.
e) Add the two tables field by field:
| \(F\) | \(\bar{F}\) | sum | |
|---|---|---|---|
| \(+\) | 380 | 115 | 495 |
| \(-\) | 120 | 11,385 | 11,505 |
| sum | 500 | 11,500 | 12,000 |
\[P(F \mid +) = \frac{380}{495} = \frac{76}{99} \approx 0.7677\]
The base rate of all packages is \(\frac{500}{12000} \approx 4.17\,\%\), less than the 5 % from d), and the probability is below 80 %. Mixed together, the flagged packages of the platform supplier (95 % counterfeit) and of the wholesaler (43 %) give an average that fits neither supplier. With separate tables, the shop can send the platform supplier’s flagged packages straight back and check only the wholesaler’s flagged packages again.
Typical mistake: in d), writing the genuine packages in the row \(+\) as \(0.01 \cdot 10{,}000 = 100\). Only the \(10{,}000 - x\) genuine packages can give a false alarm, so this field also depends on \(x\).
Problem 10: Planetarium Shows at a Science Centre (xxx)
A science centre (a museum with experiments that the visitors try out themselves) shows films in its planetarium for an extra ticket and has a shop at its exit. On one weekend, 2,400 visitors come. 900 of them buy a planetarium ticket (\(T\)). 15 % of all visitors buy a planetarium ticket and buy something in the shop (\(S\)). Of the visitors without a planetarium ticket, 16 % buy something in the shop.
- Complete a contingency table of counts (rows \(S\) and \(\bar{S}\), columns \(T\) and \(\bar{T}\), with sums).
(for verification: 600 visitors buy something in the shop)
Compute \(P(S \mid T)\), \(P(S \mid \bar{T})\) and \(P(T \mid S)\) and name the total you divide by in each case. Say which of the three values answers the shop manager’s question “How many of our customers had a planetarium ticket?”
Investigate with the expected count whether buying a planetarium ticket and buying in the shop are independent. Interpret the result for the science centre.
Argue whether the following statements are true or false.
(1) Visitors with a planetarium ticket buy something in the shop three times as often as visitors without one.
(2) 15 % of the visitors with a planetarium ticket buy something in the shop.
(3) More than half of all visitors neither buy a planetarium ticket nor buy something in the shop.
(4) \(P(\bar{T} \cup \bar{S}) = 0.85\)
- For a weekend with a new planetarium film, the science centre expects 3,000 visitors, and 45 % of them are expected to buy a planetarium ticket. \(P(S \mid T)\) and \(P(S \mid \bar{T})\) stay the same. Estimate the number of visitors who buy something in the shop and compare their share with the weekend above.
a) “15 % of all visitors” has the grand total as the base: \(2{,}400 \cdot 0.15 = 360\) visitors in \(T \cap S\). “Of the visitors without a planetarium ticket” has the column total \(2{,}400 - 900 = 1{,}500\) as the base: \(1{,}500 \cdot 0.16 = 240\) visitors in \(\bar{T} \cap S\). The rest follows by subtraction:
| \(T\) | \(\bar{T}\) | sum | |
|---|---|---|---|
| \(S\) | 360 | 240 | 600 |
| \(\bar{S}\) | 540 | 1,260 | 1,800 |
| sum | 900 | 1,500 | 2,400 |
Check: \(360 + 240 + 540 + 1{,}260 = 2{,}400\) \(\checkmark\)
b) \[P(S \mid T) = \frac{360}{900} = 0.4 \quad \text{(column total of } T\text{)}, \qquad P(S \mid \bar{T}) = \frac{240}{1500} = 0.16 \quad \text{(column total of } \bar{T}\text{)}\]
\[P(T \mid S) = \frac{360}{600} = 0.6 \quad \text{(row total of } S\text{)}\]
The manager asks about the shop customers, so \(S\) is the condition: \(P(T \mid S) = 0.6\), i.e. 60 % of the shop customers had a planetarium ticket.
c) Under independence, the expected count of \(T \cap S\) is
\[E_{T,S} = \frac{600 \cdot 900}{2400} = 225\]
Observed: 360. Since \(360 \neq 225\), buying a planetarium ticket and buying in the shop are not independent. Equivalently: \(P(S \mid T) = 0.4 \neq 0.25 = P(S)\).
Interpretation: visitors with a planetarium ticket buy in the shop far more often (40 %) than visitors without one (16 %). The shop earns a large part of its sales from planetarium visitors, e.g. the science centre could offer star maps and posters at the exit of the planetarium.
d) (1) False. \(\frac{P(S \mid T)}{P(S \mid \bar{T})} = \frac{0.4}{0.16} = 2.5\), so visitors with a planetarium ticket buy two and a half times as often, not three times.
(2) False. 15 % is the joint probability \(P(T \cap S)\) with all 2,400 visitors as the base. Of the visitors with a planetarium ticket, \(P(S \mid T) = 40\,\%\) buy something.
(3) True. “Neither … nor …” is \(\overline{T \cup S}\), the field \(\bar{T} \cap \bar{S}\): \(\frac{1260}{2400} = 0.525 > 0.5\). With the addition rule and the complement: \(P(T \cup S) = 0.375 + 0.25 - 0.15 = 0.475\) and \(1 - 0.475 = 0.525\).
(4) True. A visitor is outside \(\bar{T} \cup \bar{S}\) only if the visitor is in \(T\) and in \(S\). So \(T \cap S\) is the complement of \(\bar{T} \cup \bar{S}\), and \(P(\bar{T} \cup \bar{S}) = 1 - P(T \cap S) = 1 - 0.15 = 0.85\). In the table: \(240 + 540 + 1{,}260 = 2{,}040\) and \(\frac{2040}{2400} = 0.85\).
e) \(3{,}000 \cdot 0.45 = 1{,}350\) visitors with a planetarium ticket and \(1{,}650\) without:
\[1{,}350 \cdot 0.4 + 1{,}650 \cdot 0.16 = 540 + 264 = 804 \text{ visitors}\]
(law of total probability in counts). Their share is \(\frac{804}{3000} = 26.8\,\%\), compared with 25 % on the weekend above: more visitors buy a planetarium ticket, and they buy in the shop more often.
Typical mistake: in a), computing \(0.16 \cdot 2{,}400 = 384\) for \(\bar{T} \cap S\). “Of the visitors without a planetarium ticket” has only these 1,500 visitors as the base.
D: FSP Problem
Work on this problem as in the exam: write down every step. The points show what each part is worth.
FSP Problem: Bookings at a Lakeside Campsite [22 pts. total]
A campsite at a lake rents out pitches (places for a tent or a caravan) for the summer season. For every booking, the campsite records whether the guests stay in their own caravan (\(C\)) or in a tent, and whether they order the bread-roll service (\(B\)), i.e. fresh bread rolls brought to the pitch every morning. Last season, the campsite had 2,500 bookings. From its records:
- 36 % of the bookings were for guests with a caravan.
- 26 % of all bookings included the bread-roll service.
- Of the bookings for guests with a caravan, 50 % included the bread-roll service.
Round probabilities to four decimal places where rounding is necessary.
Part a)
Display the fractions in a contingency table. Fill in the blank fields. [5 pts.]
| caravan (\(C\)) | tent (\(\bar{C}\)) | sum | |
|---|---|---|---|
| bread-roll service (\(B\)) | |||
| no bread-roll service (\(\bar{B}\)) | |||
| sum | 2,500 |
Totals from the shares of all bookings: \(2{,}500 \cdot 0.36 = 900\) bookings in \(C\) and \(2{,}500 \cdot 0.26 = 650\) bookings in \(B\).
Field \(C \cap B\): the 50 % refer to the bookings with a caravan, so the base is 900, not 2,500:
\[900 \cdot 0.5 = 450\]
Other fields by subtraction: \(C \cap \bar{B}\): \(900 - 450 = 450\), \(\bar{C} \cap B\): \(650 - 450 = 200\), \(\bar{C}\): \(2{,}500 - 900 = 1{,}600\), \(\bar{C} \cap \bar{B}\): \(1{,}600 - 200 = 1{,}400\), \(\bar{B}\): \(2{,}500 - 650 = 1{,}850\).
| \(C\) | \(\bar{C}\) | sum | |
|---|---|---|---|
| \(B\) | 450 | 200 | 650 |
| \(\bar{B}\) | 450 | 1,400 | 1,850 |
| sum | 900 | 1,600 | 2,500 |
Check: \(450 + 200 + 450 + 1{,}400 = 2{,}500\) \(\checkmark\)
Grading: 1 Pt. totals 900 and 650, 1 Pt. \(C \cap B = 450\) with the base 900, 2 Pts. the other three inner fields, 1 Pt. remaining totals with the check.
Part b)
State the businesslike meaning of the quantities \(\bar{C} \cap B\) and \(\overline{C \cup B}\). [2 pts.]
- \(\bar{C} \cap B\): bookings of guests who stay in a tent and order the bread-roll service (200 bookings).
- \(\overline{C \cup B}\): bookings of guests who neither stay in a caravan nor order the bread-roll service, i.e. tent guests without bread rolls (1,400 bookings).
Grading: 1 Pt. per quantity.
Part c)
A booking includes the bread-roll service. Compute the probability that the guests stay in a caravan. Compute the share of bookings with the bread-roll service among the tent bookings. The owner tells a local newspaper: “Half of our bread-roll customers stay in a caravan.” Assess this statement.
(for verification: 200 tent bookings include the bread-roll service) [4 pts.]
Bread-roll service known: the base is the row total of \(B\), 650 bookings:
\[P(C \mid B) = \frac{450}{650} = \frac{9}{13} \approx 0.6923\]
Tent bookings: the base is the column total of \(\bar{C}\), 1,600 bookings:
\[P(B \mid \bar{C}) = \frac{200}{1600} = 0.125\]
Statement: wrong. “Half” is \(P(B \mid C) = 0.5\), the share of bread-roll bookings among the caravan bookings. The owner speaks about the bread-roll customers, and of them about 69.23 % stay in a caravan. The owner swaps condition and event.
Grading: 1 Pt. base 650, 1 Pt. \(P(C \mid B) \approx 0.6923\), 1 Pt. \(P(B \mid \bar{C}) = 0.125\) with the base 1,600, 1 Pt. assessment of the statement.
Part d)
Determine the number of bookings you would expect in the field \(C \cap B\) if staying in a caravan and ordering the bread-roll service were independent. Decide with this expected count whether the two events are independent and explain what the result means for the campsite. [4 pts.]
Expected count under independence:
\[E_{C,B} = \frac{\text{row total} \cdot \text{column total}}{\text{grand total}} = \frac{650 \cdot 900}{2{,}500} = 234\]
Decision: observed are 450 bookings, and \(450 \neq 234\). So staying in a caravan and ordering the bread-roll service are not independent. Equivalently: \(P(B \mid C) = 0.5 \neq 0.26 = P(B)\).
Meaning: caravan guests order the bread-roll service much more often (50 %) than tent guests (12.5 %). The campsite sells most of its bread rolls to caravan guests. If it wants to sell more, it should advertise the service to the tent guests, e.g. at the check-in.
Grading: 2 Pts. expected count 234, 1 Pt. comparison and decision, 1 Pt. meaning.
Part e)
Give the table from part a) as a relative frequency table (in % of all bookings). Next season, the campsite expects 3,200 bookings with the same shares. Estimate the number of tent bookings without the bread-roll service and the number of tent bookings with the bread-roll service. [3 pts.]
Relative frequency table: divide every entry by 2,500:
| \(C\) | \(\bar{C}\) | sum | |
|---|---|---|---|
| \(B\) | 18 % | 8 % | 26 % |
| \(\bar{B}\) | 18 % | 56 % | 74 % |
| sum | 36 % | 64 % | 100 % |
Estimates for 3,200 bookings (multiply the fields by 3,200):
- tent bookings without bread rolls (\(\overline{C \cup B} = \bar{C} \cap \bar{B}\)): \(3{,}200 \cdot 0.56 = 1{,}792\) bookings
- tent bookings with bread rolls (\(\bar{C} \cap B\)): \(3{,}200 \cdot 0.08 = 256\) bookings
Grading: 1 Pt. relative frequency table, 1 Pt. per estimate.
Part f)
The owner runs a second campsite at another lake. Last season, it had 1,200 bookings, and 285 of them included the bread-roll service. The shares of bread-roll bookings among the caravan bookings and among the tent bookings are the same as in part c). Determine with a system of linear equations the number of caravan bookings at the second campsite. Compare their share with the first campsite.
(for verification: 12.5 % of the tent bookings include the bread-roll service) [4 pts.]
Variables: \(c\) = number of caravan bookings, \(t\) = number of tent bookings.
System:
\[\text{(I)} \quad c + t = 1{,}200\]
\[\text{(II)} \quad 0.5c + 0.125t = 285\]
Elimination: \(0.125 \cdot \text{(I)}\) gives \(0.125c + 0.125t = 150\). Subtract it from (II):
\[0.375c = 135 \iff c = 360, \qquad t = 1{,}200 - 360 = 840\]
Check: \(360 + 840 = 1{,}200\) and \(0.5 \cdot 360 + 0.125 \cdot 840 = 180 + 105 = 285\) \(\checkmark\)
Comparison: at the second campsite, \(\frac{360}{1200} = 30\,\%\) of the bookings are caravan bookings, compared with 36 % at the first campsite.
Grading: 1 Pt. per equation, 1 Pt. solving the system, 1 Pt. \(c = 360\) and \(t = 840\) with the check and the share 30 %.