Data ScienceMathematics and statistical foundations

Conditional probability with an explicit contingency table

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 3 min read
Technically reviewed by Ishaan Sharma
In this article (7 sections)

Conditional probability restricts the population to the event after the conditioning bar. In P(A | B), the denominator concerns B. Reversing the expression to P(B | A) usually changes the denominator and the answer.

A small contingency table makes that distinction visible before you use the formula in a model or business report.

Define the table and its population

The original synthetic example contains one hundred support tickets with known priority and resolution status at the chosen observation point. Eighteen urgent tickets are resolved, twelve urgent tickets are unresolved, fifty-six normal tickets are resolved and fourteen normal tickets are unresolved.

PriorityResolvedUnresolvedTotal
Urgent181230
Normal561470
Total7426100

These counts are authored teaching data. They do not establish a real service-level result, equal ticket maturity or a causal effect of priority.

Read the condition before calculating

The probability of resolution given an urgent ticket is 18 / 30 = 60%. The population is the thirty urgent tickets.

The probability that a ticket is urgent given that it is resolved is 18 / 74, approximately 24.32%. The population is the seventy-four resolved tickets.

The numerator happens to be the same intersection in both calculations. The denominators differ because the questions differ.

python
from fractions import Fraction
from probability_core import ticket_probabilities

r = ticket_probabilities()
assert (r['total'],r['urgent'],r['resolved'])==(100,30,74)
assert r['resolved_given_urgent']==Fraction(3,5)
assert r['urgent_given_resolved']==Fraction(9,37)
assert r['joint_urgent_resolved']==Fraction(9,50)
assert r['resolved_given_urgent']!=r['urgent_given_resolved']
print({'resolved_given_urgent_percent':float(r['resolved_given_urgent'])*100,
       'urgent_given_resolved_percent':float(r['urgent_given_resolved'])*100,
       'joint_urgent_and_resolved_percent':float(r['joint_urgent_resolved'])*100})

The probability fixture and helper preserve the counts and use exact fractions for the table calculations.

Distinguish joint and marginal probabilities

The joint probability of urgent and resolved is 18 / 100 = 18%. The marginal probability of urgent is 30%, while the marginal probability of resolved is 74%.

The conditional formula divides the joint probability by the conditioning event's marginal probability, provided that marginal probability is positive. Thus 0.18 / 0.30 = 0.60.

If the conditioning group has no observations, the empirical conditional rate is undefined. The lab returns an explicit missing result for that case instead of converting the absence of a denominator into zero probability.

Check whether independence fits the table

If urgent status and resolution were independent in this empirical table, the joint proportion would equal the product of their marginals: 0.30 × 0.74 = 0.222. The observed joint proportion is 0.18, so the table does not factor that way.

This is a descriptive comparison of the supplied counts. It is not a formal population-level independence test or evidence that urgency causes slower resolution.

Urgent tickets may differ in complexity, follow-up time or other characteristics. Those factors matter before using the conditional difference to judge a process or recommend an intervention.

Preserve eligibility and observation time

A real table needs a clear rule for which tickets enter and when resolution is measured. Recently opened tickets may not have had the same opportunity to resolve as older ones. Missing outcomes should not silently be classified as unresolved unless that is the defined measure.

Keep the unit of analysis consistent. If one ticket generates several events, counting events in the table can change the probability question from ticket-level status to event composition.

Explain the answer in words

Say “60% of urgent tickets in this supplied table are resolved,” rather than “the probability is 60%” without a population. The wording helps a reader retain the denominator and scope.

Exercise: calculate the resolution proportion among normal tickets and the urgent proportion among unresolved tickets. State the conditioning population before writing each fraction, then explain why neither is a reversal of the other.

NeuraPath's Data Science course connects probability foundations with model evaluation and business metrics. Conditional reasoning becomes more dependable when every denominator is visible and every claim names its population.

Continue learning

This article is part of the Mathematics and statistical foundations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.

Explore Data Science
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.