EmbraceLife / shendusuipian

To know stats by heart
287 stars 70 forks source link

Conditional probability setup and examples based on Harvard Fat Chance #36

Open EmbraceLife opened 6 years ago

EmbraceLife commented 6 years ago

Conditional probability setup and examples

Key questions

how to understand conditional probability with more examples

video links

original courses p54-57

my note videos p53-55

formula

P(W) = P(W assuming A1) x P(A1) + P(W assuming A2) x P(A2) + ... + P(W assuming An) x P(An)

Problem

A and B rolling dice against each other, higher result win; if tie, A rolling again, if A has 1,2,3, or 4 win, or B has 5, 6 win; how much of an edge A wins?

Analysis

total combinations of rolling 2 dice = diceA(6) x diceB(6) x [repetition allowed, independence, sequence matters] = 36

senario1 = tie = A and B got same result = diceA(1) x diceB(1) x options(6) = 6

A $\ne$ B = 36 - 6 = 30

senario2 = A $\gt$ B = 30/2 = 15

senario3 = A $\lt$ B = 30/2 = 15

prob(senario2) = 15/36, prob(A > B | senario 2) = 100% = 1

prob(senario3) = 15/36, prob(A > B | senario 3) = 0% = 0

prob(senario1) = 6/36, prob(A win | senario 1) = diceA(4 options to win) / 6 options in total = 2/3

prob(A)

  • = prob(A & senario1) + prob(A & senario2) + prob(A & senario3)
  • = prob(senario1)prob(A | senario1) + prob(senario2)prob(A | senario2) + prob(senario3)prob(A | senario3)
  • = regardless which senario, the overall winning probability of A
  • = 15/36 + 1/6 x 4/6 = 19/36

Independence and conditional probability

coin flipping = typical example for indepdence

  • P(second H) = P(second H assuming first H) = P(second H assuming first T) = 1/2
  • P(first H and second H) = P(first H) x P(second H)

dealing cards = typical example for dependence

  • P(first Spade) = cardA(13 options being a spade) / total cards options = 13/52 = 1/4
  • P(first non-Spade) = 3/4
  • P(second Spade | first spade) = (13-1)/(52-1)
  • P(second Spade | first non-spade) = 13/(52-1)
  • P(first Spade ) $\gt$ P(second Spade | first spade)
    • second Spade and first spade is negatively correlated
  • P(first Spade) $\lt$ P(second Spade | first non-spade)
    • second Spade and first non-spade is positively correlated

Practice

problem

2 cards poker game, what are mini-flush and mini-straight probabilities?

total = $(^{52}_2)$ = $\frac{52 \times 51}{2!}$

mini flush: mini flush (2 cards with same suit)

  • [suit] 4 options x card1(1) x card1(1 following previous) x [values] card1(13) x card1(12) / 2! = $\frac{4 \times 13 \times 12}{2!}$ = $4 \times (^{13}_2)$ = flush
  • prob(mini flush) = flush/total = $\frac{12}{51}$

mini straight (2 cards with in order sequence, lower card starts from 2 to K, because Ace is the largest value (no value after it))

  • [values differ] card1(12) x card2(1) x [suits same or differ both ok] card1(4) x card2(4) x [no collection count needed]
  • prob(mini straight) = $\frac{12 \times 4 \times 4}{(^{52}_2)}$

prob(mini-straight assuming mini-flush)

  • assuming a flush: [suits: 4 kinds] 4 x card1(1 suit) x card2(1 suit) x [values] card1(13) x card2(12) / 2!
  • straight assuming a flush = [same suit] 4 x card1(1) x card2(1) x [values: lower value from 2 to k] card1(12) x card2(1)
  • prob(straight | flush) = $\frac{4 \times 12}{4 \times 13 \times 12 \div 2!}$ = 2/13

prob(mini-flush assuming mini-straight)

  • assuming mini-straight: [suits: 4 options] card1(4) x card1(4) [independent, repetition allowed] x [values: 12 lower values] card1(12) x card2(1) = 4x4x12
  • mini-flush assuming mini-straight = [suits: to be same] 4 x card1(1) x card2(1) x [values: 12 lower values] card1(12) x card2(1) = 4 x 12
  • prob(mini-flush assuming mini-straight) = 1/4