Binomial Distribution, R Syntax, and Applications in Probability

R Functions for Binomial Distribution: dbinom, pbinom, and choose

  • dbinom(k, n, p): Calculates the exact probability (probability mass function) of obtaining exactly kk successes in nn independent trials with individual trial success probability pp.

    • Mathematical Representation: P(X=k)=(nk)pk(1−p)n−kP(X = k) = \binom{n}{k} p^k (1-p)^{n-k}
    • Parameter Structure: First parameter kk (or xx) represents the target number of successes; second parameter nn represents total trials; third parameter pp represents individual success probability.
  • pbinom(k, n, p): Calculates the cumulative probability (cumulative distribution function) of obtaining kk or fewer successes (0,1,2,…,k0, 1, 2, \dots, k) across nn independent trials with success probability pp.

    • Mathematical Representation: P(X≤k)=∑i=0k(ni)pi(1−p)n−iP(X \le k) = \sum_{i=0}^{k} \binom{n}{i} p^i (1-p)^{n-i}
    • Relationship to dbinom: pbinom sums individual dbinom probabilities from zero up to kk: pbinom(k,n,p)=∑i=0kdbinom(i,n,p)\text{pbinom}(k, n, p) = \sum_{i=0}^{k} \text{dbinom}(i, n, p)
  • choose(n, k): Computes the binomial coefficient (nk)=C(n,k)=n!k!(n−k)!\binom{n}{k} = C(n, k) = \frac{n!}{k!(n-k)!}, which counts the number of distinct ways to choose kk items from a set of nn items.

    • Parameter Structure: First parameter is the total set size nn; second parameter is the chosen subset size kk.
    • Example: Selecting 44 individuals from a group of 1010 people is written as choose(10, 4).
  • RStudio Interface Assistance:

    • Typing an open parenthesis ( after dbinom, pbinom, or choose displays a tooltip context menu showing required arguments.
    • The parameter xx or kk represents the changing number of successes.

Mathematical Logic of Binomial CDF and Complementary Probabilities

  • Lower-End vs. Upper-End Probability Computations:

    • pbinom inherently evaluates the lower tail of the distribution, P(X≤k)P(X \le k).
    • Upper-tail probabilities (e.g., P(X≥k)P(X \ge k), representing "at least kk successes") require applying the rule of complementary events.
  • Mathematical Definition of Complementary Events:

    • Two events are complements if they are mutually exclusive (zero overlap) and collectively exhaustive (together encompass all possible outcomes in the sample space).
    • If event AA is "at least kk successes" (X≥kX \ge k), its complement AcA^c is "at most k−1k - 1 successes" (X≤k−1X \le k - 1).
    • Complement Probability Identity: P(A)+P(Ac)=1  ⟹  P(A)=1−P(Ac)P(A) + P(A^c) = 1 \implies P(A) = 1 - P(A^c)
  • Index-Shift Rule for Discrete Complement Calculations:

    • To calculate P(X≥k)P(X \ge k), the lower-end bound in pbinom must be shifted down by exactly 11 to k−1k - 1: P(X≥k)=1−pbinom(k−1,n,p)P(X \ge k) = 1 - \text{pbinom}(k - 1, n, p)
    • Example 1: For at least 6 successes\text{at least } 6 \text{ successes} (X≥6X \ge 6), the complement is 5 or fewer successes\text{5 or fewer successes} (X≤5X \le 5). The formula is 1−pbinom(5,n,p)1 - \text{pbinom}(5, n, p).
    • Example 2: For at least 600 successes\text{at least } 600 \text{ successes} (X≥600X \ge 600), the complement is 599 or fewer successes\text{599 or fewer successes} (X≤599X \le 599). The formula is 1−pbinom(599,n,p)1 - \text{pbinom}(599, n, p).
  • Required Conditions for Binomial Experiments:

    • A fixed number of repeated trials (nn).
    • Each trial results in one of two binary outcomes: Success or Failure.
    • Trials are independent under identical, homogeneous conditions.
    • The probability of success (pp) remains constant for every trial.

Binomial Distribution Applications and Case Studies

Case Study 1: Wildlife Disease Tracking (Infected Raccoons)

  • Experimental Parameters:

    • Sample size: n=12n = 12 raccoons.
    • Infection probability per raccoon: p=0.30p = 0.30 (30%30\%).
    • Non-infection probability: 1−p=0.701 - p = 0.70 (70%70\%).
  • Target Calculation: Probability that exactly 22 raccoons out of 1212 are infected (P(X=2)P(X = 2)).

    • Context: Implies 22 infected and 1010 uninfected raccoons, where the ordering does not matter (e.g., first two, first and third, last two).
    • R Syntax: dbinom(2, 12, 0.3)
    • Numerical Result: Approximately 0.170.17 or 17%17\%

Case Study 2: Quality Control (Defective Items)

  • Experimental Parameters:

    • Sample size: n=5n = 5 randomly selected items.
    • Defect rate per item: p=0.10p = 0.10 (10%10\%).
    • Trial definition: Finding a defective item is classified as a "success".
  • Target Calculation: Probability of observing "at least one defective item" (P(X≥1)P(X \ge 1)).

    • Expanded Summation Approach: P(X=1)+P(X=2)+P(X=3)+P(X=4)+P(X=5)=∑i=15dbinom(i,5,0.1)P(X = 1) + P(X = 2) + P(X = 3) + P(X = 4) + P(X = 5) = \sum_{i=1}^{5} \text{dbinom}(i, 5, 0.1)
    • Complementary CDF Approach: P(X≥1)=1−P(X=0)=1−pbinom(0,5,0.10)P(X \ge 1) = 1 - P(X = 0) = 1 - \text{pbinom}(0, 5, 0.10)

Case Study 3: Extrasensory Perception (ESP) and Card Guessing

  • Experimental Setup:

    • Total cards tested: n=8n = 8 cards.
    • Card shapes: 44 distinct shapes (star, circle, triangle, square).
    • Experimenter views each card while the subject guesses the shape without seeing it.
    • Random guessing probability of success: p=14=0.25p = \frac{1}{4} = 0.25 (25%25\%).
    • Random guessing probability of failure: 1−p=0.751 - p = 0.75 (75%75\%).
    • Cards are shuffled between trials to maintain randomness and trial independence.
    • Multiple-choice test analogy: Equivalent to an 88-question exam with 44 options per question answered by pure random guessing.
  • Part A: Exactly 4 Correct Guesses:

    • Target: P(X=4)P(X = 4)
    • R Syntax: dbinom(4, 8, 0.25)
    • Numerical Result: Approximately 0.080.08 (8%8\%
  • Part B: 3 or Fewer Correct Guesses:

    • Target: P(X≤3)P(X \le 3), covering outcomes X∈{0,1,2,3}X \in \{0, 1, 2, 3\}.
    • R Syntax: pbinom(3, 8, 0.25)
    • Interpretation: Yields a high cumulative probability because getting 33 or fewer correct is common when individual success probability is low (p=0.25p = 0.25).
  • Part C: At Least 4 Correct Guesses:

    • Target: P(X≥4)P(X \ge 4), covering outcomes X∈{4,5,6,7,8}X \in \{4, 5, 6, 7, 8\}.
    • R Syntax: 1 - pbinom(3, 8, 0.25)

Airline Flight Overbooking Model

Business Context and Economics of Overbooking

  • Definition of Overbooking / Overselling: Selling more confirmed passenger tickets than physical seat capacity on an aircraft.
  • Denied Boarding (Bumping): Occurs when actual passenger arrivals exceed physical seat availability. Passengers are bumped either voluntarily (accepting compensation) or involuntarily.
  • Airline Incentives Offered: Free hotel accommodations, complimentary dinner vouchers, rebooking on alternative flights the next day, and financial discount vouchers.
  • Economic Rationale: Historical flight data indicates that approximately 3%3\% of ticketed passengers fail to show up ("no-shows"). Selling extra tickets ensures maximum capacity utilization and captures revenue from non-refundable no-show tickets.

Operational Airport Interruption

  • Public Announcement Event: Passengers Carissa Fortune and Sam Kirkwood requested immediately at Terminal B, Gate 13 for impending flight departure.
  • Passenger Statuses:
    • Carissa Fortune: Delayed due to a 6-hour highway traffic drive.
    • Sam Kirkwood: Slept through alarm / sick in bed.
  • Operational Consequence: Both passengers missed the flight. The airline retains ticket revenues and fills physical seats with overbooked ticket holders without incurring net financial penalty.

Overbooking Model Setup and Parameters

  • Aircraft Physical Capacity: 150150 physical seats.
  • Tickets Sold: n=152n = 152 confirmed tickets (152152 independent trials).
  • Passenger Arrival Probability: p=0.97p = 0.97 (97%97\% chance an individual ticket holder shows up).
  • Passenger No-Show Probability: 1−p=0.031 - p = 0.03 (3%3\% chance an individual ticket holder misses the flight).

Mathematical Computations for Passenger Bumping

  • Part A: Flight oversold and exactly 1 passenger bumped:

    • Passenger Count Translation: Bumping exactly 11 passenger requires exactly 151151 passengers showing up for 150150 seats (151−150=1151 - 150 = 1).
    • Target: P(X=151)P(X = 151) given n=152n = 152 and p=0.97p = 0.97
    • R Syntax: dbinom(151, 152, 0.97)
    • Numerical Result: Approximately 0.0460.046 or 4.6%4.6\% (about 5%5\%
  • Part B: Flight oversold and exactly 2 passengers bumped:

    • Passenger Count Translation: Bumping exactly 22 passengers requires all 152152 ticketed passengers to show up (152−150=2152 - 150 = 2).
    • Target: P(X=152)P(X = 152) given n=152n = 152 and p=0.97p = 0.97
    • R Syntax: dbinom(152, 152, 0.97)
    • Parameter Distinction: In dbinom(152, 152, 0.97), the first 152152 represents target successes kk; the second 152152 represents total trials nn.
    • Numerical Result: Less than 1%1\% (specifically 0.090.09 or approximately 0.98%0.98\%
  • Part C: Flight oversold and at least 1 passenger bumped:

    • Passenger Count Translation: Bumping at least 11 passenger requires 151151 or 152152 passengers showing up (X≥151X \ge 151).
    • Summation Syntax: dbinom(151, 152, 0.97) + dbinom(152, 152, 0.97)
    • Complementary CDF Formula: P(X≥151)=1−P(X≤150)=1−pbinom(150,152,0.97)P(X \ge 151) = 1 - P(X \le 150) = 1 - \text{pbinom}(150, 152, 0.97)
    • Index Shift Logic: Shift the threshold down from 151151 to 150150. The term pbinom(150, 152, 0.97) calculates the probability that 150150 or fewer passengers show up (no bumping required).
    • Numerical Result: Approximately 5.5%5.5\% to 5.6%5.6\% overall probability of bumping at least one passenger.
  • Part D: Flight is NOT oversold (zero passengers bumped):

    • Passenger Count Translation: Zero bumping occurs if 150150 or fewer passengers show up (X≤150X \le 150).
    • Target: P(X≤150)P(X \le 150)
    • R Syntax: pbinom(150, 152, 0.97)
    • Numerical Result: Complement of Part C (1−0.055=0.9451 - 0.055 = 0.945 or 94.5%94.5\%

Homework, Review, and Upcoming Exam Schedule

  • Core Practical Skill: Translating real-world operational language (e.g., "bump 1 passenger", "bump at least 1 passenger") into exact numerical parameters (kk, nn, pp) required for R binomial functions.
  • Upcoming Schedule:
    • Tomorrow: Exam review and question-answering session.
    • Wednesday: Scheduled Quiz.