๐ŸŽฒ Pre-Lab: Probability & Distributions

Master medical decision-making under uncertainty

MSTA112 Medical Biostatistics โ€” Week 6

Why Probability Matters in Medicine

A patient tests positive for COVID-19. The test has 85% sensitivity and 95% specificity. Should they quarantine immediately?

The answer depends on prevalence โ€” and might shock you. Even with a "positive" test, the probability of actually having COVID could be only 25%.

Addition Rule

When events can't happen together (mutually exclusive):

P(A or B) = P(A) + P(B)

Example: Saudi blood types: Type A = 24%, Type B = 17%

What's the probability a random patient is Type A or Type B?

P(A or B) = 0.24 + 0.17 = 0.41 (41%)

Multiplication Rule

When events are independent:

P(A and B) = P(A) ร— P(B)

Example: Two patients independently tested. Each has 24% chance of diabetes.

Probability both have diabetes:

P(both) = 0.24 ร— 0.24 = 0.0576 (5.76%)

Conditional Probability

Probability of A given B has occurred:

P(A|B) = P(A and B) / P(B)

This is the foundation of diagnostic testing โ€” what's the probability of disease given a positive test?

Bayes' Theorem Interactive Calculator

Enter test characteristics and disease prevalence to calculate predictive values.

Results

Positive Predictive Value
--
Negative Predictive Value
--

2ร—2 Diagnostic Grid (per 10,000 people)

Ethical Communication

Why Natural Frequencies Matter

Telling a patient "Your PPV is 25.7%" is confusing. Instead:

"Out of 10,000 people like you who test positive, about 257 actually have the disease. The other 9,743 are false alarms."

This uses natural frequencies โ€” the brain processes absolute numbers better than percentages.

When Low PPV Happens

PPV depends heavily on prevalence. A test with 99% accuracy can still have low PPV in rare diseases.

Example: Screening for a 0.1% disease with 99% Sn/Sp:

  • 1,000,000 people screened
  • 1,000 have disease โ†’ 990 test positive (TP)
  • 999,000 healthy โ†’ 9,990 test positive (FP)
  • PPV = 990/(990+9,990) = 9% ๐Ÿ˜ฎ

Clinical Scenario: The COVID Test Dilemma

Walk through a real decision step-by-step.

1
Patient
2
Test Result
3
Calculate
4
Decision

๐Ÿ‘ค Step 1: Meet the Patient

A 35-year-old asymptomatic healthcare worker comes for routine screening. Community prevalence of COVID-19 is 2%.

๐Ÿงช Step 2: Test Result

Rapid antigen test comes back POSITIVE.

Test characteristics: Sensitivity 85%, Specificity 95%

๐Ÿงฎ Step 3: Bayes' Theorem

Out of 10,000 people like this patient:

  • 200 have COVID (2% prevalence)
  • 170 test positive (85% sensitivity)
  • 9,800 don't have COVID
  • 490 test positive anyway (5% false positive rate)
PPV = 170 / (170 + 490) = 170 / 660 = 25.7%

โš–๏ธ Step 4: Clinical Decision

The patient has only a 1 in 4 chance of actually having COVID.

Recommended action:

  • โœ… Isolate temporarily
  • โœ… Confirmatory PCR test
  • โœ… Monitor symptoms
  • โŒ Don't panic or assume certainty

Key lesson: A positive screening test in low-prevalence settings requires confirmation. This is why mass screening of asymptomatic populations is controversial.

Drag & Match: Probability Concepts

Drag each concept to its correct medical application.

Score: 0/5

Concepts

Sensitivity
True Positive Rate
Specificity
True Negative Rate
PPV
Positive Predictive Value
NPV
Negative Predictive Value
Prevalence
Disease frequency

Applications

Probability disease is detected if present
Probability test is negative if disease absent
Probability disease present if test positive
Probability disease absent if test negative
Affects predictive values dramatically

What is a Binomial Distribution?

Models the number of successes in a fixed number of independent trials.

The 4 Requirements (BINS)

1. Binary Outcomes

Only two possibilities: success/failure, cured/not cured, survived/died

2. Independent Trials

One patient's outcome doesn't affect another's

3. Number Fixed

You decide n (sample size) in advance

4. Same Probability

Each trial has the same probability p

The Binomial Formula

P(X = k) = C(n,k) ร— p^k ร— (1-p)^(n-k)

Where:

  • n = number of trials
  • k = number of successes we want
  • p = probability of success on each trial
  • C(n,k) = "n choose k" = combinations
Understanding Parameters

Mean (Expected Value):

E(X) = n ร— p

Variance:

Var(X) = n ร— p ร— (1-p)

Standard Deviation:

SD(X) = โˆš[n ร— p ร— (1-p)]

Binomial Calculator

Calculate probabilities and visualize the distribution.

Results

P(X = k)
--
Expected Value
--
Std Deviation
--

Practice Problem: Saudi Smoking Cessation

Scenario: A new smoking cessation program has a 40% success rate. You enroll 15 patients.

Question 1: Expected number who will quit?

Solution:

E(X) = n ร— p = 15 ร— 0.40 = 6 patients

You can expect about 6 patients to successfully quit, but it's not guaranteed.

Question 2: Standard deviation?

Solution:

SD = โˆš[n ร— p ร— (1-p)]
SD = โˆš[15 ร— 0.40 ร— 0.60] = โˆš3.6 โ‰ˆ 1.9

The typical variation around the mean is about 2 patients.

Question 3: Probability exactly 6 quit?

Solution: Use the binomial calculator above with n=15, p=0.40, k=6

The formula gives us:

P(X = 6) โ‰ˆ 0.207 (20.7%)

Even though 6 is the expected value, the probability of getting exactly 6 is only about 21%!

The Normal Distribution

The bell curve โ€” the most important distribution in statistics.

ฮผ ฮผ-ฯƒ ฮผ+ฯƒ 68%

Key Properties

  • Symmetric bell shape
  • Mean = Median = Mode (at the center)
  • Completely defined by ฮผ (mean) and ฯƒ (standard deviation)
  • Area under curve = 1 (100% probability)

The 68-95-99.7 Rule

68% within ยฑ1 SD

ฮผ - ฯƒ to ฮผ + ฯƒ

The "typical" range for most observations

95% within ยฑ2 SD

ฮผ - 2ฯƒ to ฮผ + 2ฯƒ

The "reference range" in lab medicine

99.7% within ยฑ3 SD

ฮผ - 3ฯƒ to ฮผ + 3ฯƒ

Beyond this โ†’ very unusual, investigate

Z-Score Calculator

Standardize values to compare across different scales.

Results

Z-Score
--
Percentile
--

Example: Saudi Newborn Birth Weights

Population parameters: ฮผ = 3.2 kg, ฯƒ = 0.4 kg

What is the normal reference range?

Solution: Use ยฑ2 SD (95% range)

Lower = ฮผ - 2ฯƒ = 3.2 - 0.8 = 2.4 kg
Upper = ฮผ + 2ฯƒ = 3.2 + 0.8 = 4.0 kg

Normal range: 2.4 to 4.0 kg
95% of healthy newborns fall in this range

A baby weighs 2.8 kg. Is this concerning?

Solution: Calculate Z-score

Z = (2.8 - 3.2) / 0.4 = -0.4 / 0.4 = -1.0

Z = -1.0 means the baby is 1 SD below the mean.

โœ… Within normal range (within ยฑ2 SD). This is at the 16th percentile โ€” low but not alarming.

How to assess if data is normally distributed?

Three methods:

  1. Histogram: Does it look bell-shaped and symmetric?
  2. Q-Q Plot: Do points fall on a straight diagonal line?
  3. Shapiro-Wilk test: Statistical test (p > 0.05 suggests normality)

If data is NOT normal โ†’ use median/IQR instead of mean/SD!

What is Monte Carlo Simulation?

A computational technique that uses random sampling to solve complex problems that are difficult or impossible to calculate analytically.

Core Idea: Run thousands of random trials to approximate the probability distribution of outcomes.

The Monte Carlo Process

1
Define the problem
What uncertainty are you modeling?
2
Identify random inputs
What variables are uncertain? What are their distributions?
3
Run simulations
Generate thousands of random scenarios
4
Analyze results
Look at distribution, percentiles, risk of extremes

Case Study: Hajj Ambulance Capacity Planning

Problem: How many ambulances needed for Hajj if emergency rate is uncertain?

Scenario Setup

Known:

  • Expected pilgrims: 2 million
  • Emergency rate: 3-7 per 1,000 (varies by day, heat, crowding)
  • Each ambulance handles 20 patients/day

Question: How many ambulances to ensure 95% coverage?

Monte Carlo Approach

Simulation steps:

  1. For each of 10,000 simulations:
    • Randomly sample emergency rate from 3-7 per 1,000
    • Calculate total emergencies = 2,000,000 ร— (rate/1,000)
    • Calculate ambulances needed = emergencies / 20
  2. Sort the 10,000 results
  3. The 95th percentile = capacity needed
Result: 95th percentile โ‰ˆ 650 ambulances
With 650 ambulances, you can handle 95% of scenarios. The worst 5% require surge capacity.
Why Not Just Use the Average?

Average rate = 5 per 1,000 โ†’ 500 ambulances

But this only covers 50% of scenarios!

โš ๏ธ Planning for the average means you're unprepared half the time. Monte Carlo reveals the distribution of risk.

When to Use Monte Carlo

โœ… Good for:

โ€ข Complex systems with multiple uncertainties
โ€ข Risk assessment and planning
โ€ข When exact math is intractable
โ€ข Resource allocation under uncertainty

โŒ Not needed for:

โ€ข Simple problems with known formulas
โ€ข When you need exact answers
โ€ข Small sample sizes (unreliable)
โ€ข When assumptions about distributions are wrong

Pre-Lab Quiz

Test your understanding. Score: 0/10

1. A COVID test has 85% sensitivity and 95% specificity. If prevalence is 2%, what is PPV approximately?
2. Saudi diabetes screening: 1,000 tested, TP=170, FP=40, FN=30, TN=760. What is sensitivity?
3. Which is NOT a requirement for binomial distribution?
4. Smoking cessation: n=15, p=0.40. What is the expected number who quit?
5. In a normal distribution, what percentage falls within ฮผ ยฑ 2ฯƒ?
6. Saudi newborn weights: ฮผ=3.2kg, ฯƒ=0.4kg. What is the 95% reference range?
7. A baby weighs 2.0 kg (ฮผ=3.2, ฯƒ=0.4). What is the Z-score?
8. What is the primary advantage of Monte Carlo simulation?
9. PPV depends heavily on which factor?
10. You screen 10,000 for a rare disease (prev=0.1%) with 99% Sn/Sp. How many false positives?