Accessible version · How to use this site with a screen reader · Course home
Day 1 Afternoon · Accessible lecture notes

Discrete distributions

A screen-reader-friendly transcript of the lecture slides: all slide text, tables, figure descriptions, and speaker notes.

About these notes

Each section is one slide. Figures carry text descriptions where available. For the concepts with worked examples, also read the plain-language summary and lab for this session.

Slide 1: Discrete Probability Distributions

(No text on this slide.)

Slide 2: Binomial Experiments-I

Slide 3: Binomial Experiments-II

Slide 4: Binomial Experiments-II (Notation)

Slide 5: Binomial Probabilities-I

P(x) = nCx px qn−x = n! / ((n − x)! x!) · px qn−x

Slide 6: One Binomial Trial: The Bernoulli Distribution

P(x) = nCx px qn−x = n! / ((n − x)! x!) · px qn−x

Slide 7

Concept Question

1. Let X ~ binom(n, p) and Y ~ binom(m, p) be independent. Then X + Y follows:

2. Let X ~ binom(n, p) and Z ~ binom(n, q) be independent. Then X + Z follows:

Slide 8

Concept Question

1. Let X ~ binom(n, p) and Y ~ binom(m, p) be independent. Then X + Y follows:

2. Let X ~ binom(n, p) and Z ~ binom(n, q) be independent. Then X + Z follows:

1. answer: (a). Each binomial random variable is a sum of independent Bernoulli(p) random variables, so their sum is also a sum of Bernoulli(p) r.v.'s.

2. answer: (d) This is different from problem 1 because we are combining Bernoulli(p) r.v.'s with Bernoulli(q) r.v.'s. This is not one of the named random variables we know about.

Slide 9

Group Work

1. Prove: if X ~ Bernoulli(p) then Var(X) = p(1 − p).

2. Prove: if X ~ bin(n, p) then Var(X) = n p(1 − p).

Slide 10

Solution

1. For X ~ Bernoulli(p) we use a table. (We know E(X) = p.)

X01
p(x)1 − pp
(X − μ)2p2(1 − p)2

Var(X) = E((X − μ)2) = (1 − p)p2 + p(1 − p)2 = p(1 − p)

2. X ~ bin(n, p) means X is the sum of n independent Bernoulli(p) random variables X1, X2, …, Xn. For independent variables, the variances add. Since Var(Xj) = p(1 − p) we have

Var(X) = Var(X1) + Var(X2) + … + Var(Xn) = np(p − 1).

Slide 11: Binomial Probabilities-II

X ~ B(n,p); X ~ Bin(n,p); X ~ Binom(n,p)

Slide 12: The Binomial Distribution

n=6; p=0.5

n=6; p=0.9

0 1 2 3 4 5 6

0 1 2 3 4 5 6

This is a probability mass function; PMF

Slide 13: Examples of the Binomial Distribution-I

Group Work

P(x) = nCx px qn−x = n! / ((n − x)! x!) · px qn−x

Slide 14: Examples of the Binomial Distribution-III

(12 choose 2) 0.12 0.910 = 0.2301

(12 choose 0) 0.10 0.912 = 0.2824

Slide 15: Sneak peak: Maximum likelihood is just doing this in reverse!!!

Slide 16

This is among the easiest possible likelihood problems

Sneak peak: Maximum likelihood is just doing this in reverse!!!

ℒ(p | k, N) = (N choose k) pk (1 − p)N − k

Slide 17: Sneak peak: Maximum Likelihood is just doing this in reverse!!!

ℒ(p | k, N) = (N choose k) pk (1 − p)N − k

Slide 18: Sneak peak: Maximum likelihood is just doing this in reverse!!!

Should I show you the derivation?

ℒ(p | k, N) = (N choose k) pk (1 − p)N − k

L(p | k, N) = log(N choose k) + k log(p) + (N − k) log(1 − p)

Slide 19

Sneak peak: Maximum likelihood is just doing this in reverse!!!

L(p | k, N) = log(N choose k) + k log(p) + (N − k) log(1 − p)

Slide 20

Figure 20.1. Two log-likelihood curves for p (binomial, constant term dropped). Panel a: 4 successes in 10 trials, wide peak near p=0.4. Panel b: 40 in 100, much narrower peak near 0.4. Larger samples give sharper likelihoods.

Sneak peak: Maximum likelihood is just doing this in reverse!!!

Slide 21: Back to distributions

Slide 22

The multinomial distribution: more than one kind of success

The multinomial distribution is an extension of the binomial distribution to the case of more than two (we shall assume n) kinds of outcomes, in which a single trial has probability pi of ending in category i. In a total of N trials, we assume that ki of the outcomes end in category i.

Pr{k | N, p} = N! / (∏i=1n ki!) · ∏i=1n pikᵢ

Slide 23: The Poisson Distribution-I

Slide 24: The Poisson Distribution-I

Slide 25: The Poisson Distribution - pmf

pk(t) = (λt)k / k! · e−λt

P(k events in interval) = e−λ · λk / k!

P(X = x) = μx e−μ / x!

Slide 26: Where does the Poisson distribution come from?

In a very small interval of time, either nothing happens or one event happens

Slide 27: Where does the Poisson distribution come from?

What we want is the probability of k events in a a longer interval, say time = t

dp0 / dt = −λ p0

p0(t) = exp(−λt)

p0(t + dt) = p0(t)(1 − λdt)

Slide 28: Zero term of the Poisson Distribution

Probability Mass Function:

pk(t) = (λt)k / k! · e−λt

Pr{no event in 0 to t} = p0(t) = e−λt

Slide 29: First term of the Poisson Distribution

Figure 29.1. Equation: p_k(t) = (lambda t)^k / k! times e^(-lambda t). The full Poisson pmf.

Slide 30: The Poisson Distribution - pmf

pk(t) = (λt)k / k! · e−λt

P(k events in interval) = e−λ · λk / k!

P(X = x) = μx e−μ / x!

Slide 31: The Poisson Distribution Graphically

μ=2

μ=5

μ=8

Slide 32: An Example of the Poisson Distribution-I

Breakout groups: Try to find analytical solutions AND a solution using built in functions in R

Group Work

P(X = x) = μx e−μ / x!

Slide 33: An Example of the Poisson Distribution-II

P[X = 4] = μx e−μ / x! = 34 e−3 / 4! = 0.168

Slide 34: An Example of the Poisson Distribution-III

P[X ≤ 2] = e−3 [ 30/0! + 31/1! + 32/2! ] = 0.423

Slide 35: An Example of the Poisson Distribution-III

e-3

1 - e-3

Slide 36: Example of using Poisson Probabilistic Arguments in Research

Figure 36.1. Journal article header: 'Killer Whale Predation on Sea Otters Linking Oceanic and Nearshore Ecosystems' by Estes, Tinker, Williams and Doak, with abstract on sea otter decline from killer whale predation.

constant over the 27-year period. By modeling the expected number of observed attacks as a Poisson process, the probability of zero attacks being seen before 1990 is 0.006 (15).

Slide 37: The Poisson Distribution - Caveat

Slide 38: But first: MLE for the Poisson Distribution

pk(t) = (λt)k / k! · e−λt

L(p | {Xi}) = Σi=1n log( f(Xi | p) )

ℒ(p | {Xi}) = ∏i=1n f(Xi | p)

Slide 39: The Negative Binomial Distribution (1) # failures/trials before fixed number of successes

Slide 40

Try to derive it based on this argument

How do we turn this into “failures”, now k, until r successes? k->r; N-> k+r;

The Negative Binomial Distribution(1) # failures/trials before fixed number of successes

Pr{N = n | k, p} = Probability that the kth success occurs on trial n

Pr{N = n | k, p} = (n−1 choose k−1) pk−1 (1 − p)n − k p = (n−1 choose k−1) pk (1 − p)n − k

f(k; r, p) ≡ Pr(X = k) = (k+r−1 choose r−1) (1 − p)k pr

Now, for the kth success to occur on trial n, we must have k − 1 successes in the first n − 1 trials and a success on the nth trial. The probability of k − 1 successes in n − 1 trials has a binomial distribution with parameters n − 1 and p and the probability of success on the nth trial has probability p and these are independent of each other. We thus conclude

Speaker notes for this slide

Examples? Number of foraging bouts before r successes. Number of surveys before r detections.

Slide 41: The Negative Binomial Distribution (2) Poisson with a variable rate parameter

Because:

Pr{k events in [0, t] | λ} = (λt)k / k! · e−λt

Pr{k events in [0, t]} = ∫0∞ (λt)k / k! · e−λt · f(λ) dλ

pX(x) = ∫y pX,Y(x, y) dy = ∫y pX|Y(x | y) pY(y) dy

Slide 42: Quick note on Gamma function

Γ(z) = (z − 1)!

Γ(z + 1) = z Γ(z)

Γ(z) = ∫0∞ sz−1 e−s ds

Slide 43: The Negative Binomial Distribution (2) Poisson with a variable rate parameter

Common parameterization in ecology with the mean as a parameter:

Pr{N = n} ≡ pn(m, k) = Γ(k + n) / (n! Γ(k)) · (k / (k + m))k · (m / (k + m))n

Slide 44: The Negative Binomial Distribution (2) Poisson with a variable rate parameter

What is the probability of no events?

This probability can be large if k is small even if m is big

Pr{N = n} ≡ pn(m, k) = Γ(k + n) / (n! Γ(k)) · (k / (k + m))k · (m / (k + m))n

p0(m, k) = (k / (k + m))k

Slide 45: Poisson vs. Negative Binomial

Figure 45.1. Four bar charts of probability versus number of events (0 to 30). Panel a: Poisson, mean 10, bell-shaped peak near 10. Panels b, c, d: negative binomial, same mean, dispersion 5, 1, 0.5, becoming flatter and more skewed as dispersion drops.

Slide 46: The Geometric Distribution

This is a special case of the negative binomial distribution for which k =1 (i.e. the probability of the number of trials or failures until one success is recorded).

Figure 46.1. Comparison table of two geometric distribution conventions (k trials vs k failures): Support, PMF (1-p)^(k-1)p vs (1-p)^k p, CDF, and Mean 1/p vs (1-p)/p.

Slide 47: Summary of Discrete Distributions

DistributionNumber of trialsRandom VariableParameters
BinomialPre-specifiedNumber of successesn, p
Negative BinomialRepeated until a given number of successesNumber of failuresr, p
GeometricRepeated until one success occursNumber of failures or trialsp
PoissonN/ANumber of occurrences