Varying λ ~ Gamma → Negative Binomial
• Click right half → Next slide
• Click left half → Previous slide
• Swipe left/right → Navigate (touch devices)
• 📖/🎬 Button (top-left) → Toggle Reading/Presentation Mode
• ⬆️/⬛ Button (below) → Toggle Top-Align/Center Layout
(Use Top-Align when collapsed sections leave too much whitespace)
Dr.Ali T. Abdallah
Working with R (Advanced Course)
Advanced Analysis Teaching Series • November 2026
© 2026 Dr. Ali T. Abdallah. All rights reserved.
You have 20,000 genes and 3 replicates per condition. Which genes truly changed? Without the right model, you'll miss real changes or report false positives.
⏱️ ~45-60 min | Step-by-step | No advanced math required
Every step in our statistical model
corresponds to a
biological or experimental reality
Natural first thought: To compare control vs treatment, why not just run a t-test on the counts?
We need a model that respects the count-generating process. Let's build it step-by-step...
Imagine tracking a single FOXO3A mRNA in your cell sample. During RNA-seq, this molecule either gets successfully captured and sequenced → Success (X=1), or gets lost somewhere in the process → Failure (X=0).
Key Idea: One RNA molecule → Either captured (X=1) or lost (X=0)
The overall success probability pg reflects the combined efficiency of all experimental steps:
Overall pFOXO3A = 0.90 × 0.80 × 0.95 × 0.85 × 0.75 ≈ 0.43
So each FOXO3A molecule has ~43% chance of being counted!
In a perfectly homogeneous world, each molecule of a given gene would behave as an independent Bernoulli trial with the same gene-specific success probability pg across all molecules and all replicates.
Note: This assumption breaks down in reality, which we'll address in later slides.
This binary outcome is the fundamental building block behind count modeling. Every counted read started as a single molecule that succeeded in this Bernoulli trial.
Your sample contains n = 500 FOXO3A molecules. Each has a 43% chance of being captured. How many reads will you observe? This follows a Binomial distribution.
Key Idea: Now imagine n independent molecules for the same gene, each with capture probability pg.
Expected reads = n × p = 500 × 0.43 = 215 reads
But you might observe anywhere from ~180 to ~250 reads due to random sampling variation!
In a perfect world, every replicate would share the same n and pg for a gene, giving identical expected counts.
In RNA-seq, n (total molecules) is unknown and unmeasurable. We can't directly fit a Binomial model.
Solution: Approximate with Poisson using λ = n·pg = 215 (next slide).
Key Idea: When n is large but pg is small, we can simplify the Binomial.
We don't know if there were 500 FOXO3A molecules (p=0.43) or 1000 molecules (p=0.215), but both give λ = 215 expected reads. The Poisson distribution uses only λ, eliminating the unmeasurable parameters!
When you have many molecules (large n) but each has a small chance of being captured (small p), the math simplifies beautifully.
The Poisson is the limiting case of Binomial as n → ∞ and p → 0, with np held constant.
Poisson assumes λ is fixed across replicates → variance equals the mean.
Theory predicts: If every replicate saw identical conditions, Poisson would fit perfectly.
In a perfect world: All 3 FOXO3A replicates have exactly λ=215, giving Variance = Mean = 215
This is the Poisson property: simple, elegant, but unrealistic for real biology!
Blue points: Simulated Poisson data hugging the diagonal line where Variance = Mean
Orange points: Real RNA-seq data ballooning far above the line!
This is over-dispersion-variance exceeds what Poisson predicts.
The Poisson assumption (fixed λ=215 for all FOXO3A replicates) is violated!
In reality, each replicate has a different λ value due to biological and technical variation.
We need to model λ itself as a random variable (next slides).
Biological variation in molecule counts:
Technical variation in capture:
Think of each FOXO3A replicate as sampling from its own "distinct universe" with a different λ value:
The variation in λ itself is random-we need to model this!
We model λ as a random variable following a Gamma distribution.
For FOXO3A: Instead of fixed λ=215, we have λ ~ Gamma(shape, scale) that produces values like 200, 215, 230...
This captures the heterogeneity across replicates (details in next slide).
Answer: λ varies because biological and technical factors multiply together.
Mean = α/β encodes average expression level (e.g., α/β = 215 for FOXO3A)
Variance = α/β² → larger α means less spread (more consistent λ across replicates)
Different (α, β) pairs fit different genes' variability (see figure)
Step 1: Products → Sums via logarithm: log(X₁ × X₂) = log(X₁) + log(X₂)
Step 2: Central Limit Theorem → Sum of random variables ≈ Normal
Step 3: Exponentiate → exp(Normal) = Lognormal
Step 4: Gamma ≈ Lognormal in shape, but Gamma + Poisson = NB (closed form!)
Poisson: "Given this exact concentration in the library, what range of counts will I see due to random sampling?" (additive noise)
Gamma: "How much does the actual concentration in the library vary between my samples due to biology and technical factors?" (multiplicative noise)
Key insight: Negative Binomial captures both sources of variation naturally! Variance = μ + μ²/α captures over-dispersion.