Your earlier statistics was almost certainly frequentist: fixed (but unknown) parameters, p-values, confidence intervals. Today we meet the other big framework — Bayesian reasoning — and see how they differ.
Probability as a degree of belief, updated by data — not just a long-run frequency.
Bayes’ rule in one line: \text{posterior} \propto \text{prior} \times \text{likelihood}.
Frequentist vs Bayesian: fixed parameters + p-values vs distributions of belief + credible intervals.
One worked biology example: estimating a proportion (fraction of cells expressing a marker) with a prior.
Why a biologist might want this: honest uncertainty, using prior knowledge, and a natural fit for hierarchy.
This is a concept and intuition day. The maths stays light; the goal is to think in the Bayesian way and read a posterior.
Problem: how sure can we be from only a few cells?
You stain a population of cells for a marker and count, under the microscope, how many are positive. Out of 20 cells, 6 are positive.
Your instinct (frequentist): the fraction is \hat p = 6/20 = 0.30. Done.
But you have only 20 cells. How sure are you? Could the true fraction be 0.2? 0.45?
And you are not starting from nothing: in three previous experiments this marker sat around 20%. Should that count?
Frequentist analysis gives you a single number plus a confidence interval and ignores the earlier experiments. Bayesian analysis gives you a full distribution of belief over p and lets you fold in what you already knew.
Bayesians use probability to describe belief
The split between the two schools comes from what the word probability even means.
Frequentist
Bayesian
Probability is…
a long-run frequency
a degree of belief
The parameter p is…
fixed, just unknown
uncertain — described by a distribution
Data is…
random (repeatable)
the fixed thing you actually saw
A result is…
a point estimate + CI, a p-value
a posterior distribution
Frequentist question: “If p were really 0.2, how surprising is my data?” Bayesian question: “Given my data, what should I now believe about p?”
Bayes’ rule updates a belief using the data
In one sentence:
What you believe after the data = what you believed before × how well each possibility explains the data — then rescaled so the beliefs add up to 1.
The four pieces, for a hypothesis H (a value of p) and the data D you saw:
priorP(H): what you believed about Hbefore the data.
likelihoodP(D \mid H): how probable the data is ifH were true.
posteriorP(H \mid D): your updated belief after seeing the data.
evidenceP(D): the total of all the products; dividing by it makes the posterior add up to 1.
In symbols: P(H \mid D) = P(D \mid H)\,P(H)\,/\,P(D).
Try it: Bayes’ rule on five guesses
Five possible infection rates; 2 of 5 cells infected. Prior × likelihood, add up, divide.
The posterior is the prior reweighted by the data
The denominator P(D) does not depend on H — it is the same for every hypothesis. So the shape of the posterior is fixed entirely by the numerator:
(“\propto” means “proportional to” — equal up to a constant that we fix at the end so the total probability is 1.)
This is the sentence to memorise:
Posterior belief = prior belief, reweighted by how well each hypothesis explains the data.
Where the data is strong, the likelihood dominates and the prior barely matters. Where the data is weak (few cells!), the prior still has a say.
Our example: a belief curve for p
Estimate p = the true fraction of marker-positive cells. Data: k = 6 positive out of n = 20.
Likelihood: for each possible p, how probable is “6 positive out of 20”? It is highest at p = 6/20 = 0.30. (In R: dbinom(6, 20, p).)
Prior: a curve over p from 0 to 1. We use a Beta(\alpha, \beta) curve: read it as a belief worth \alpha imagined positive cells and \beta imagined negative cells.
Updating a Beta prior just adds the cell counts
With a Beta prior and counted cells, prior × likelihood is another Beta curve, and the update is just tallying:
Add your positives to \alpha, and your negatives to \beta.
The imagined cells of the prior and the real cells of the experiment are simply pooled. A prior with few imagined cells is soon outnumbered by the data; one with many imagined cells takes a lot of data to move.
(The mean of \text{Beta}(\alpha,\beta) is \alpha/(\alpha+\beta): the share of positives among all cells, imagined and real.)
The informative prior pulls the estimate down toward the earlier experiments — and with only 20 cells, that pull is real. Collect 200 cells and both posteriors would sit almost on top of the data.
Only credible intervals give a probability for the parameter
Bayesian uncertainty comes straight from the posterior. A 95% credible interval is the range holding 95% of the area under the posterior curve: for Beta(7,15), from about 0.15 to 0.52.
You are allowed to say the honest sentence: “there is a 95% probability that p lies in this interval.”
A frequentist 95% confidence interval does not mean that. It means: if you repeated the whole experiment many times, 95% of the intervals so constructed would contain the true fixed p. Any single interval either contains p or does not — no probability attached.
Credible interval
Confidence interval
Statement about
the parameter
the procedure
“95% probability p is inside”
✓ allowed
✗ not allowed
Try it: what “95% confidence” means
The same experiment repeated 100 times: each bar is one 95% confidence interval.
A p-value is not the probability the hypothesis is true
Suppose you care whether the true fraction exceeds 25%.
Frequentist: set up H_0: p = 0.25, compute a p-value = probability of data at least this extremeif H_0 were true. A small p-value means “the data would be surprising under H_0.” It does not tell you the probability that H_0 is true.
Bayesian: just read it off the posterior. P(p > 0.25 \mid \text{data}) is the shaded area under the posterior to the right of 0.25: for Beta(7,15) about 0.74. A direct probability that the hypothesis is true, given your data.
The Bayesian answers the question people think a p-value answers.
Try it: updating a prior with cells
The same computation in R
Everything above is a couple of built-in functions. (Static examples — nothing to install.)
k <-6; n <-20# Frequentist point estimatep_hat <- k / n # 0.30# Bayesian update with a uniform prior Beta(1, 1)a0 <-1; b0 <-1a <- a0 + k # 7 (prior successes + observed)b <- b0 + (n - k) # 15 (prior failures + observed)a / (a + b) # posterior mean -> 0.318qbeta(c(0.025, 0.975), a, b) # 95% credible interval -> ~0.15 .. 0.521-pbeta(0.25, a, b) # P(p > 0.25 | data) -> ~0.74
# An informative prior Beta(2, 8) (earlier experiments, ~20% positive)a0 <-2; b0 <-8a <- a0 + k # 8b <- b0 + (n - k) # 22a / (a + b) # posterior mean -> 0.267
Bayesian methods suit small samples and prior knowledge
Honest uncertainty. You get a full posterior, not a lone point estimate — and a credible interval you are actually allowed to interpret as “where the parameter probably is.”
Use what you already know. Prior experiments, known biology, or literature values enter formally through the prior instead of being ignored or hand-waved.
Small samples behave sensibly. With few cells the prior gently regularises the estimate; with many cells the data takes over automatically.
Natural hierarchy. Genes within pathways, cells within patients, patients within cohorts — Bayesian hierarchical models let lower levels “borrow strength” from the group, which is exactly how modern tools shrink noisy per-gene estimates in differential expression.
With lots of clean data, both approaches agree
Bayesian is not automatically “better.” Trade-offs:
The prior is a choice, and a bad or overconfident prior biases the answer. You must be able to defend it — and check how much it matters (sensitivity analysis).
Frequentist methods are fast, standard, and prior-free — for a large, clean dataset the two usually agree, and a t-test is simpler than a model.
Computation. Only lucky cases (like today’s Beta prior with counted cells) give a formula; realistic models need MCMC sampling — more machinery, more that can go wrong.
Reproducibility. A frequentist pipeline has fewer subjective knobs, which some fields prefer.
Rule of thumb: lots of clean data → they agree; little data, strong prior knowledge, or nested structure → Bayesian earns its keep.
Summary
Concept
Key fact
Probability
frequentist = frequency; Bayesian = degree of belief
Parameter p
frequentist: fixed unknown; Bayesian: has a distribution
Bayes’ rule
posterior = prior × likelihood, rescaled to add up to 1
Prior
Beta(\alpha,\beta): a belief curve, like \alpha imagined positives and \beta imagined negatives
Update
add positives to \alpha, negatives to \beta: Beta(\alpha+k,\ \beta+n-k)
Posterior mean
\alpha/(\alpha+\beta)
Credible interval
“95% probability p is inside” — allowed
P(p > 0.25)
the area under the posterior to the right of 0.25
Confidence interval
about the procedure: about 95 of 100 repeated intervals contain p
p-value
how surprising the data are if H_0 is true, not the probability H_0 is true
When it matters
small data / strong prior / hierarchy
Next: work the cell-counting posterior by hand and in R in the exercise, then the quiz.
Optional: the maths behind the Beta update
For readers who like formulas; nothing in the deck depends on this slide.
Likelihood (binomial): P(k \mid p) = \binom{n}{k}\, p^{k}(1-p)^{n-k} \ \propto\ p^{k}(1-p)^{n-k} — for our data p^{6}(1-p)^{14}.
Multiply — the exponents add: p^{\alpha-1}(1-p)^{\beta-1}\cdot p^{k}(1-p)^{n-k} = p^{(\alpha+k)-1}(1-p)^{(\beta+n-k)-1}, which is again a Beta shape: Beta(\alpha+k,\ \beta+n-k). A prior that gives a posterior of the same family is called conjugate.
Tail area:P(p > 0.25 \mid \text{data}) = \int_{0.25}^{1} \text{Beta}(p;\,7,15)\, dp \approx 0.74, which is 1 - pbeta(0.25, 7, 15) in R.