Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Conditional Probability Calculator

Frequency Table (Counts)
Test+No Test+Total
Disease
0.0095
0.0005
100
No Disease
0.0495
0.9405
9900
Total590941010000
Conditional Probabilities Given Disease
Given ConditionTest+No Test+Total
Disease
95.0%
P(Test+|Disease)
5.0%
P(No Test+|Disease)
100%
No Disease
5.0%
P(Test+|No Disease)
95.0%
P(No Test+|No Disease)
100%
Conditional Probability Calculations
P(Test+ | Disease)
= 95 / 100
95.0%
P(Test+ | No Disease)
= 495 / 9900
5.0%
P(Disease | Test+)
= 95 / 590
16.1%
P(No Disease | Test+)
= 495 / 590
83.9%

Understanding the Results

Key Insight: Conditional probability focuses on a subset of the data. When we calculate P(B|A), we only look at the rows/columns where A occurred.

How to read contingency tables for conditional probability:

  • P(Outcome | Condition): Look at the condition row, divide the intersection by the row total
  • P(Condition | Outcome): Look at the outcome column, divide the intersection by the column total
  • The intersection cell represents both events happening together
  • Marginal totals show the unconditional probabilities
Medical Test Interpretation: Even with a 95% accurate test, a positive result only gives 16.1% chance of actually having the disease. This is because the disease is rare (1% prevalence), so most positive tests are false positives.








Selecting Preset Scenarios

The calculator provides six preset scenarios demonstrating common conditional probability applications. Medical Test shows disease diagnosis with test results, using realistic sensitivity and specificity values. Playing Cards demonstrates card draw probabilities with suit and rank conditions. Weather Forecast models prediction accuracy with actual weather outcomes.

Quality Control represents manufacturing defect rates across production lines. Survey Data shows demographic conditional probabilities from hypothetical survey responses. Click any scenario button to instantly load its frequency data, condition names, and outcome labels.

The Custom button clears all preset data, allowing you to enter your own frequencies and labels. After loading a preset, you can still modify individual cell values to explore variations. Preset scenarios serve as starting points for understanding how conditional probabilities work in real contexts.

Understanding the Frequency Table

The frequency table displays a 2×2 contingency table showing counts for all four possible outcome combinations. Rows represent whether the condition occurred (Disease/No Disease, Red Card/Black Card, etc.). Columns represent whether the outcome occurred (Test+/Test-, Heart/Other, etc.).

Each cell contains an editable input field showing the frequency count for that combination. Below each count, a small probability displays the joint probability: the cell count divided by grand total. The highlighted intersection cell (top-left) represents both events occurring together—the numerator for most conditional probability calculations.

Row totals appear in the rightmost column, showing total occurrences for each condition. Column totals appear in the bottom row, showing total occurrences for each outcome. The bottom-right cell shows the grand total—the sum of all four cells and the denominator for unconditional probabilities.

Reading Conditional Probability Tables

The second table converts frequency counts to conditional probabilities normalized by row. Each row sums to 100%, showing the distribution of outcomes given a specific condition. For medical tests, the top row shows P(Test+|Disease) and P(Test-|Disease)—the test's performance when disease is present.

The percentages answer "Given this row's condition, what's the probability of each outcome?" The formula appears below each percentage, like "P(Test+|Disease)" to clarify what's being calculated. This table demonstrates how conditioning restricts attention to a subset of cases.

Compare across rows to see how outcome probabilities change with different conditions. If P(Outcome|Condition) differs substantially from P(Outcome|No Condition), the condition and outcome are dependent. If probabilities stay similar, the events are approximately independent.

Customizing Labels and Values

The label inputs above the tables let you customize condition and outcome names. Change "Disease" to "Diabetes" or "Test+" to "Positive Result" to match your specific scenario. Labels update throughout all tables and calculation boxes instantly.

Click any cell in the frequency table to edit its value. Enter non-negative integers representing counts from your data. As you type, all dependent calculations update automatically: row and column totals, joint probabilities, conditional probabilities, and the calculation boxes below.

Use the Custom scenario when your data doesn't match presets. Enter your four cell frequencies, name your condition and outcome, and the calculator computes all relevant probabilities. This flexibility supports analysis of any 2×2 categorical data: survey responses, experimental results, observational studies, or theoretical problems.

Interpreting Calculation Boxes

Four calculation boxes below the tables show the most common conditional probabilities with full formulas. Each box displays the conditional probability notation, the arithmetic (numerator/denominator), and the final percentage.

P(Outcome|Condition) divides the intersection cell (both events true) by the condition row total. This answers "Given the condition, what's the outcome probability?" For medical tests, this is sensitivity: P(Test+|Disease).

P(Outcome|No Condition) divides the opposite intersection by the no-condition row total. For medical tests, this is the false positive rate: P(Test+|No Disease).

P(Condition|Outcome) divides the intersection by the outcome column total. This reverses the conditioning direction. For medical tests, this is positive predictive value: P(Disease|Test+)—the crucial probability for interpreting positive results.

P(No Condition|Outcome) completes the set, showing how often the outcome occurs without the condition. These four probabilities provide comprehensive insight into the relationship between condition and outcome.

Using Row vs Column Conditions

Conditional probability direction matters critically. P(B|A) asks "Given A occurred, what's the probability of B?" while P(A|B) asks "Given B occurred, what's the probability of A?" These probabilities are generally different and answer different questions.

Row conditioning uses row totals as denominators. Look at the condition row, divide the intersection by the row total. The conditional probability table computes this automatically for each row. Row percentages sum to 100% across each row.

Column conditioning uses column totals as denominators. Look at the outcome column, divide the intersection by the column total. The calculation boxes show examples: P(Condition|Outcome) uses column totals. Column percentages would sum to 100% down each column.

Understanding which direction to condition is essential. Medical diagnosis requires P(Disease|Test+), not P(Test+|Disease). The former uses column totals, the latter uses row totals. The calculator provides both to clarify the distinction.

What is Conditional Probability?

Conditional probability measures the likelihood of an event given that another event has occurred. Notation P(B|A) reads "probability of B given A" and equals the fraction of A-outcomes where B also occurs. Mathematically: P(BA)=P(AB)P(A)P(B|A) = \frac{P(A \cap B)}{P(A)}.

The denominator restricts attention to the subset where A occurred. The numerator counts how often B occurs within that subset. This ratio ranges from 0 (B never occurs with A) to 1 (B always occurs with A). Values between indicate partial dependence.

Conditioning updates probabilities based on partial information. Without conditioning, P(B) uses the entire sample space. With conditioning on A, P(B|A) uses only the portion where A occurred. If A provides information about B, these probabilities differ. If A tells nothing about B (independence), they're equal.

For comprehensive theory on conditional probability including derivations, properties, and applications, see conditional probability theory.

Understanding Contingency Tables

A contingency table cross-tabulates frequencies for two categorical variables, organizing data into rows and columns. Each cell shows how many observations satisfy both the row category and column category. Row and column totals (marginals) show unconditional frequencies for each category.

2×2 tables handle binary variables: Yes/No, Success/Failure, Present/Absent. Larger tables accommodate more categories, but the principle remains: cross-classify observations and count cell frequencies. Joint probabilities come from dividing each cell by the grand total.

Contingency tables reveal relationships between variables. If variables are independent, knowing one provides no information about the other—cell frequencies match what you'd expect from marginal totals alone. Dependence appears as departures from expected frequencies, indicating the variables relate.

The table structure makes conditional probability calculations transparent. Row percentages show outcome distributions given each condition. Column percentages show condition distributions given each outcome. This visual organization clarifies the conditioning subset and normalization.

Related Probability Tools and Calculators

Bayes' Theorem Calculator - Calculate posterior probabilities by reversing conditional probabilities, essential for medical diagnosis and hypothesis updating.

Joint Probability Calculator - Compute probabilities for intersections and unions of multiple events with Venn diagrams.

Independence Test Calculator - Determine whether two events are independent using chi-square tests on contingency tables.

Probability Tree Diagram Generator - Visualize conditional probabilities through branching tree structures for sequential events.

Law of Total Probability Calculator - Calculate marginal probabilities by partitioning across conditional probabilities.

Sensitivity and Specificity Calculator - Analyze medical test performance metrics including positive and negative predictive values.

Conditional Probability Visualizer - Interactive Venn diagrams showing conditional probability as restricted sample space.

Two-Way Table Analysis Tool - Perform comprehensive statistical analysis on contingency tables including chi-square tests.