Conditional probability: the share within a group

31 min · 6 drills

In the textbook: Ch. 5.2 Bedingte Wahrscheinlichkeiten

42 % of all users of a streaming service watch series, and among premium users almost 80 %. A share inside a group can be quite different from the share among everyone. The article ends with the reverse question: a loan application was flagged as risky, how likely is it that the loan will not be repaid?

Conditional probability answers the question “how often, when it is already known that …”: how often orders paid by invoice come back, or how often someone with a positive test is ill. In a task it is given away by the words “among”, “given that”, “it is known that”.

An online clothes shop received 1000 orders in one month:

  • 400 of them were bought on invoice: the customer pays after delivery;
  • the rest were paid at once;
  • 250 orders were sent back, and 160 of these had been bought on invoice.

The shop is thinking of dropping payment on invoice. Are invoice orders really sent back more often than orders paid at once, and by how much?

Compare the shares inside the groups. Of the 400 orders paid by invoice, 160 came back, that is 40 %. 600 were paid at once, and 250−160=90 of them came back, that is 15 %. Yes, invoice orders come back more often, almost three times as often. Both shares are conditional probabilities: “returned among those paid by invoice” and “returned among those paid at once”.

Check yourself. A task at exam level: in a furniture store 45 % of customers order delivery, 60 % pay by card, and 75 % do at least one of the two. What share of the card payers ordered delivery?

The four-field table: four fields and their margins

You can ask two questions about each order: was it bought on invoice, and was it sent back? Each question defines an event: the set of orders for which the answer is “yes”, just as for the die an event was a set of faces. We write:

  • A: the order was sent back;
  • B: the order was bought on invoice;
  • A′ and B′: “not A” and “not B”, that is kept and paid at once. On the formula sheet the complement is written with a prime.

The two answers split all orders into four fields with no order in common: invoice and returned, invoice and kept, at once and returned, at once and kept. Written as a table they give the four-field table (German Vierfeldertafel). In the shop's filled-in table further down, the sums of the rows and columns stand on the right and at the bottom: the margins of the table.

The task gives four numbers: 1000 in total, 400 on invoice, 250 returns, 160 on invoice and returned. The rest follows by subtraction, because the fields of a row add up to its margin:

  • invoice and kept: 400−160=240;
  • at once: 1000−400=600;
  • at once and returned: 250−160=90;
  • at once and kept: 600−90=510;
  • check with the column “kept”: 240+510=750, and 1000−250=750.
Four-field table of the online shop: rows invoice and at once, columns returned and kept, sums at the marginsreturnedkeptinvoiceat once16024090510totaltotal4006002507501000

What the intersection A∩B (“and”) and the union A∪B (“or”) mean is shown on a die in the section “And, or, not”. Here the shop's table above takes the place of the die. In it “and” is one field, 160, and “or” is three fields, 160+240+90=490. The other combinations are read off the fields in the same way:

  • neither A nor B, that is A′∩B′: one field, 510, and that is 1000−490;
  • exactly one of the two: two fields, 240+90=330.

You can also get the union 490 straight from the margins, without filling the whole shop table. Add the margins: 250+400=650. That is more than 490, because the field “invoice and returned” sits both in 250 and in 400, so it is counted twice. Subtract it once: 650−160=490. In shares of 1000 orders, that is for the probabilities (P for probability, as in the article on events), this is the addition rule (German Additionssatz):

P(A∪B)=P(A)+P(B)−P(A∩B),0.25+0.40−0.16=0.49

The share within a group

Back to the shop's question. Of all orders, 250/1000=0.25 were returned. But we care only about invoice orders, that is one row of the shop's table. It holds 400 orders, and 160 of them were returned: 160/400=0.40. In the row “at once”, 90/600=0.15 were returned. The answer for the shop: invoice orders come back almost three times as often, 0.40 against 0.15.

The same table with the row invoice marked: 160 returns out of 400 ordersreturnedkeptinvoiceat once16024090510totaltotal4006002507501000

A share within a group is called a conditional probability. P(A∣B) is read “the probability of A given B”. Behind the bar stands the group in which the share is taken, here the invoice orders: P(A∣B)=0.40. Measured against everyone it would be P(A)=0.25, a different number.

The same share can be computed from shares of everyone. Divide numerator and denominator by 1000:

160400=160/1000400/1000=0.160.40=0.40

On top stands the intersection P(A∩B), below it the share of the group P(B). This gives the line of the formula sheet:

P(A∣B)=P(A∩B)P(B)

Turn the question round: what share of the returns had been bought on invoice? The numerator stays 160, but the group behind the bar changes:

QuestionGroup behind the barShare
What share of invoice orders came back?row “invoice”, 400 ordersP(A∣B)=160/400=0.40
What share of returns was bought on invoice?column “returned”, 250 ordersP(B∣A)=160/250=0.64

So P(A∣B) and P(B∣A) are almost always different numbers. First settle which group stands behind the bar.

Multiplying the formula by P(B) gives the multiplication rule: P(A∩B)=P(B)⋅P(A∣B). In the shop: 40 % of the orders are on invoice, P(B)=0.40, and 40 % of those are returned, P(A∣B)=0.40: P(B)⋅P(A∣B)=0.40⋅0.40=0.16. The multiplication rule is needed when the condition has to be turned round.

If the row “invoice” had the same share of returns as everyone, 0.25, the condition would change nothing. Such events are called independent; they are the topic of the next article.

Filling in and reading the four-field table

In the shop the four-field table was filled in so that a share within a group could be read from it. The first exam task stops half a step earlier: it needs just one field of the filled-in table:

Exam-style task

Auf einer Bahnstrecke fuhren an einem Tag 800 Passagiere mit. 25 % von ihnen hatten eine Sitzplatzreservierung, 160 Passagiere hatten ein Jahresticket, und 110 Passagiere hatten beides. Wie viele Passagiere hatten weder eine Reservierung noch ein Jahresticket?

  1. a)732
  2. b)424
  3. c)550
  4. d)250
  5. e)494

Three numbers about two features (each alone and both together, one in percent) and a question about one field: “neither … nor”. It is the same table as the shop's, only about passengers: the margins and one field are given, the rest follows by subtraction.

Given: 110, 25 % of 800 = 200, 160, 800

Four-field table of the railway line, filled field by field: reservation and annual ticket, margins, the last field neither … norannualno annualtotalreserv.no reserv.total110200160800
Step 1 of 4Enter the data

800 passengers in total. The reservation is given in percent. Percent of what? Of all 800: 0.25⋅800=200, the margin of the row “reservation”. Margin of the column “annual ticket”: 160.

“Both” is the field “reservation and annual ticket”: 110.

Why can't you get “neither … nor” by simply subtracting both margins from 800? Hint: look at which margins the field 110 sits in.

Tasks on the addition rule (Additionssatz) give the same in percent and ask for “at least one”.

At a conference, 55 % of the participants attend the morning session and 70 % the afternoon session; 38 % attend both.

With what probability (in percent) has a randomly chosen participant attended at least one of the two sessions?

“At least one” is three fields: only morning, only afternoon, both. Only the field “neither” is left out.

55+70=125. More than 100 %: the participants in both sessions, 38 %, are counted twice.

125−38=87. Neither: 100−87=13 %.

Your turn: exactly one club. A school has 600 children. 40 % play football, 150 play chess, 60 do both. How many children attend exactly one of the two? Percent of what? Of all 600 children: football 0.40⋅600=240. Only football: 240−60=180. Find “only chess” and the answer.

Your turn1 of 6

Of the customers of a supermarket, 42 % buy organic products, 36 % pay by phone, and 12 % do both. With what probability does a randomly chosen customer have exactly one of the two features?

Your turn2 of 6

Of 1200 users of an app, 420 have a premium plan, 540 use Android, and 150 have premium and Android. How many premium users do not use Android?

Traps. The wrong options of the exam task and the mistakes in the second example come about like this:

  • “At least one” instead of “neither … nor”, option (d), 250: 200+160−110=250 are the passengers with a reservation or a ticket. The addition rule is applied correctly, but the question asks for the complement. Check: the answer and 250 together make all 800.
  • The other options, (a) 732, (b) 424 and (e) 494, come from no sensible calculation. The check with the second margin rules them out: in the column “no ticket” the field “neither … nor” is 640−90=550.
  • Percentages multiplied, in the second example: instead of the given 38 % one takes 0.55⋅0.70=0.385, and 55+70−38.5=86.5. Multiplying is allowed only for independent events, and here the intersection is in the task. Use it.
  • Exactly one instead of at least one, in the second example: 87−38=49 throws out the participants in both sessions. “At least one” includes them.

On the formula sheet: P(A∪B)=P(A)+P(B)−P(A∩B) (addition rule) and P(A′)=1−P(A) (complement).

The share “among …”: conditional probability via the intersection

In the task about passengers the answer was one field, a share of everyone. The second task asks for a share within a group, and the addition rule from the first one only gives its numerator:

Exam-style task

Bei einem Streamingdienst haben 33 % der Nutzer ein Premium-Abo, 42 % schauen Serien, und 49 % haben ein Premium-Abo oder schauen Serien (oder beides). Wie groß ist der Anteil der Serienschauer unter den Nutzern mit Premium-Abo? Runden Sie auf vier Nachkommastellen.

  1. a)0.6190
  2. b)0.3482
  3. c)0.7879
  4. d)0.6886
  5. e)0.2121

Words like “among …”, “given that …” or “a person who … is chosen” mean one thing: the share is taken within a group, as in the shop's row “invoice”. Instead of the intersection, “or” is given here, so first the intersection from the addition rule, then the division by the row of the condition.

Condition: row premium, 0.33

Four-field table of the streaming service in shares: rows premium and no premium, columns series and no seriesseriesno seriestotalpremiumno prem.total0.330.421
Step 1 of 4Find the condition

“Among the users with a premium plan”: the group is premium, the row of the table with margin 0.33.

0.42 of all users watch series: the margin of the column.

We need P(series∣premium).

Why do we divide by 0.33 and not by 0.42? Hint: the numerator of both shares is the same, 0.26; which group is named after “among”?

In a company 80 % of the employees work from home, 35 % have been there for more than five years, and 20 % have been there for more than five years and work from home.

An employee working from home is chosen at random. With what probability has she been with the company for at most five years?

“An employee working from home”: the row “from home”, 0.8.

In the row “from home”, 0.2 have been there for more than five years. At most five years: 0.8−0.2=0.6.

0.6/0.8=0.75.

Check: the share “more than five years” in the row is 0.2/0.8=0.25, and 1−0.25=0.75. Within one row the complement works as it does among everyone.

A university has 500 students. 205 receive a scholarship, 315 live in a dorm, and 110 receive a scholarship and live in the dorm. A person from the dorm is chosen. With what probability does she receive a scholarship? The condition “from the dorm” leaves a group of 315 people, and 110 of them receive a scholarship. The share is 110/315=0.349206…≈0.3492. If you got 110/205≈0.5366, you divided by the scholarship holders: that is the share of dorm residents among scholarship holders, the condition turned round.

Your turn3 of 6

Of 1000 people surveyed, 450 are members of the city library and 520 are younger than 25. 180 respondents are under 25 and members. With what probability is a randomly chosen person under 25, given that they are a library member? Round to four decimal places.

Your turn4 of 6

In a vaccination campaign among 3000 people, 1800 were vaccinated. 1000 fell ill in the following season, among them 270 vaccinated people. What is the share of those who fell ill among the vaccinated? Round to four decimal places.

Traps. The wrong options of the exam task come about like this:

  • Condition turned round, option (a), 0.6190: 0.26/0.42 is the share of premium users among series watchers. The numerator is the same, so the answer looks plausible. Check: the denominator is the group named after “among”, here premium, 0.33.
  • Complement computed, option (e), 0.2121: 1−0.7879, the share of premium users without series, 0.07/0.33. Check: reread which field of the row the question asks for.

On the formula sheet: P(A∣B)=P(A∩B)P(B), where B is the condition, the group behind the bar.

The result is known, the question is about the group

So far it was clear which group a person belonged to, and you divided by that group's share. In the last task the group is exactly what is unknown: only the outcome is known, and the shares are given the other way round:

Exam-style task

Eine Bank prüft Kreditanträge mit einem Scoring-Verfahren. Erfahrungsgemäß fallen 6 % der Kredite aus. Das Verfahren markiert 90 % der später ausfallenden Kredite als riskant, aber auch 15 % der Kredite, die nicht ausfallen.

Ein Antrag wird als riskant markiert. Mit welcher Wahrscheinlichkeit fällt dieser Kredit aus (auf drei Nachkommastellen gerundet)?

  1. a)0.195
  2. b)0.900
  3. c)0.277
  4. d)0.054
  5. e)0.383

Here shares within groups are given (“flags 90 % of the loans that later default”). The question, though, runs in the opposite direction: the result is known, “an application is flagged”, and it asks about the group. In the shop this is the question “what share of the returns was on invoice”, 160/250=0.64, but there the shop's whole table was given. Here you build the table yourself by imagining a round number of cases, for example 1000 loans.

1000 loans: 60 bad, 940 good

Tree: bad and good loans, in each group flagged or not; the paths to a flag are added, the bad path is divided by the sum0.06bad0.94good
Step 1 of 4First fork

The tree starts with a fork: the loan is bad or good. Each branch carries the share of its group, 0.06 and 0.94; of 1000 loans that is 60 and 940.

Why are there more flagged good loans than bad ones, although the flag catches 90 % of the bad ones? Hint: compare 60 and 940.

The same calculation in letters. Let B be “the loan is bad” and A “flagged”. The numerator 54 of 1000 is P(A∣B)⋅P(B)=0.9⋅0.06, the multiplication rule. The denominator 195 is the sum of both paths to a flag, called the total probability (German totale Wahrscheinlichkeit): P(A)=P(A∣B)⋅P(B)+P(A∣B′)⋅P(B′). Together this is Bayes' theorem (German Satz von Bayes):

P(B∣A)=P(A∣B)⋅P(B)P(A)=0.9⋅0.060.9⋅0.06+0.15⋅0.94=0.0540.195≈0.277

Picture a factory with three machines. Machine 1 makes 50 % of the parts, 2 % of them defective. Machine 2 makes 30 %, defects 3 %. Machine 3 makes 20 %, defects 5 %.

A part is defective. With what probability was it made by machine 3?

Machine 1: 500 parts, machine 2: 300, machine 3: 200.

500⋅0.02=10, 300⋅0.03=9, 200⋅0.05=10.

10+9+10=29. There are three groups, so the total probability has three terms.

10/29=0.344827…≈0.3448. Machine 3 makes a fifth of the parts but a third of the defects.

Among the participants of a cycling race, 6 % dope. The doping test is positive for 88 % of dopers and for 4 % of clean athletes. An athlete tested positive. With what probability is he clean? Of 10000 athletes: 600 dope, positive among them 600⋅0.88=528. 9400 are clean, positive among them 9400⋅0.04=376. Positive in total 528+376=904. The question is about the clean ones: 376/904=0.415929…≈0.4159. 528/904≈0.5841 answers a different question: it is the share of dopers among those who tested positive.

Your turn5 of 6

A bank classes 2 % of all card payments as fraudulent. The system raises an alarm for 92 % of fraudulent and 4 % of honest payments. The alarm goes off for a payment. With what probability is it really fraudulent? Round to four decimal places.

Your turn6 of 6

In a screening, 1500 people are tested. 8 % of them are ill. The test is positive in 90 % of the ill and in 10 % of the healthy. How many of the people who tested positive are healthy?

Traps. The wrong options of the exam task come about like this:

  • Condition turned round, option (b), 0.900: this is the share of flagged among the bad loans, given in the task. The question is the share of bad among the flagged. Check: behind the bar stands what is already known about the application, “flagged”.
  • Intersection instead of share, option (d), 0.054: 54 of 1000 are the loans that are bad and flagged among all loans. The division by 195 is missing.
  • Total probability instead of the answer, option (a), 0.195: this is the share of all flagged loans, the calculation stops one step early.
  • Only the good ones in the denominator, option (e), 0.383: 54/141. The group “flagged” includes the bad ones too, the denominator is 54+141=195.
  • Group sizes forgotten, drill on card payments, 0.9583: only 92 % and 4 % were compared. Honest payments are 49 times as many, and their 4 % raise more alarms than the 92 % of fraudulent ones.

Bayes' theorem is not on the formula sheet. You build it from the line P(A∣B)=P(A∩B)P(B): the intersection by the multiplication rule, the denominator as the sum of the paths. The safest way is to compute with 1000 or 10000 imagined cases.

At a glance: the table, the share within a group, the reversed condition

The topic in a minute

  • Four-field table: two events split everyone into four fields, the margins are the sums of the rows and columns. What is missing follows by subtraction. Addition rule P(A∪B)=P(A)+P(B)−P(A∩B): the intersection sits in both margins.
  • Conditional probability P(A∣B)=P(A∩B)/P(B): the share within the group B, not of everyone. P(A∣B) and P(B∣A) have the same numerator and different denominators.
  • Reversed condition (Bayes): shares within groups are given, the question is about the group. Imagine 1000 cases, find the result in each group, add and divide.
  • Filling in and reading the four-field table

    Two features and both together, in people or percent; the question is “neither … nor”, “at least one”, “exactly one” or one field.
    P(A∪B)=P(A)+P(B)−P(A∩B)

    Trap: subtract both margins from the whole and forget to give back the intersection.

  • Conditional probability from the intersection

    “Among …”, “a person who … is chosen”: the share is taken within a group; the intersection is given or follows from “or”.
    P(A∣B)=P(A∩B)P(B)

    Trap: divide by the other group and get P(B∣A).

  • Turning a condition round

    The share of the group and the shares within the groups are given; the result is known, the question is about the group.
    P(B∣A)=P(A∣B) P(B)P(A)

    Trap: give the share from the task, P(A∣B), or forget the group sizes.

Sometimes a condition changes nothing: the share within the group is the same as among everyone. Then probabilities are multiplied, which is the subject of “Independent events and systems of parts”.

Cards to memorise

Tap a card to see the formula. All topic cards

Formula

What holds for the intersection of two independent events?

Formula

Groups Gi with shares P(Gi) and rates P(F∣Gi). What is P(G1∣F)?

Now practise it

Conditional probability: the share within a group

Trainer · Probability

Practise
Next: Independence: when probabilities multiply
0/6

Was this article helpful?