This code-through explores the concept of Fermi Estimates and the
difference between Bayesian and Frequentist approaches in R. If this
sounds like a lot of jargon at first, don’t worry, I felt the same way
when I first heard it, and it takes a bit to become familiar with the
terms. The thin is, you probably already have an intuition for some of
these concepts.
Specifically in this code through we’ll explain and demonstrate:
We make a lot of decisions every day—some say thousands!
Sure, you could Google that number, but it’s fun (and instructive) to estimate it yourself.
This teaches you how to break down problems, make informed guesses, and refine those guesses if you collect data.
Specifically, you’ll learn: 1. Perform a quick Fermi Estimate in R 2. Understand why you might want to model uncertainty (instead of using a single guess) 3. Appreciate the key differences between Frequentist and Bayesian approaches
So who or what is a Fermi Estimate? Is it the same as a back-of-the-envelope calculation? For our purposes, yes. And what is a back-of-the-envelope calculation (BOTEC)?
Great, that explains the envelope, but what is a Fermi?
So, yes there is a difference, but not a big one. Fermi Estimates are a kind of BOTEC calculation, but with difficult to estimate things on grand scales.
Let’s do a back-of-the-envelope calculation to guess how many decisions you make in a day.
## Assume:
## - Awake ~16 hours/day
## - 1 "decision" every 2 minutes (i.e., 0.5 decisions/minute)
hours_awake <- 16
decisions_per_minute <- 0.5 # 1 decision every 2 min
daily_decisions <- hours_awake * 60 * decisions_per_minute
daily_decisions## [1] 480
See how simple that was? Of course, we made big assumptions… for instance we assumed the rate never changes, but it’s a starting point.
Before we talk about why Frequentist methods don’t work for BOTECs, let’s quickly compare the two main statistical approaches.
At a high level, Frequentists and Bayesians think about uncertainty differently:
Here’s a quick comparison table:
| Aspect | Frequentist.Approach | Bayesian.Approach |
|---|---|---|
| What is probability? | The long-run frequency of an event happening in repeated trials. | A degree of belief about an event, which updates with new data. |
| How do we treat parameters? | Fixed but unknown. There is one ‘true’ answer, we just don’t know it. | A probability distribution. We don’t assume a single ‘true’ value. |
| How do we get results? | Collect repeated samples and compute a confidence interval. | Start with a prior belief and update it using Bayes’ Theorem. |
| What do we need? | Lots of data! Frequentists rely on repeated sampling to estimate parameters. | A prior belief + data (if available). Can reason even with little data. |
| Can it handle BOTECs? | ❌ No—requires observed data and repeated trials. | ✅ Yes—can model uncertainty even without direct observations. |
A Frequentist approach is based on the idea that there is a fixed but unknown true parameter (e.g., “decisions per minute”) and that we can estimate it by collecting data and analyzing repeated samples.
But here’s the problem:
- BOTECs don’t rely on observed data—they are based on
logical reasoning and estimation, not repeatable experiments.
- Frequentist statistics assume repeated trials—without
actual data from repeated decision-making observations, you
cannot construct a confidence interval or perform
hypothesis tests. - Frequentists don’t assign probabilities to
parameters—they estimate values based on collected data, but in
a BOTEC, we aren’t working with sampled data at all.
So, if Frequentist statistics can’t be used for BOTECs, what do we do instead?
Unlike Frequentists, Bayesians treat unknown parameters as probability distributions. This means we can start with an initial belief (a prior), then refine it with new information.
BOTECs are all about reasoning under uncertainty, which is exactly what Bayesian methods are designed to do.
Let’s say we expect most people make between 0.3 and 0.7 decisions per minute, but we’re not sure. Instead of picking one number, we can use a Beta(5,5) prior to represent this uncertainty.
Now, we visualize that distribution:
A Beta(5,5) distribution is: - Centered around 0.5 (both parameters are equal) - Somewhat confident, but not too rigid - Symmetric, meaning it doesn’t skew left or right
Think of Beta(5,5) like saying:
“I believe there’s a decent chance my rate is ~0.5, but it could be
lower or higher.”
Now, let’s visualize it:
set.seed(123) # for reproducibility
alpha_prior <- 5
beta_prior <- 5
prior_samples <- rbeta(10000, alpha_prior, beta_prior)
hist(prior_samples,
breaks = 30,
col = "skyblue",
main = "Beta(5,5) Prior Distribution",
xlab = "Decisions per Minute")
abline(v = mean(prior_samples), col = "red", lwd = 2)Now, let’s take our Beta(5,5) prior and use it to simulate a range of possible daily decisions.
hours_awake <- 16
minutes_awake <- hours_awake * 60
daily_decisions_dist <- prior_samples * minutes_awake
hist(daily_decisions_dist,
breaks = 30,
col = "skyblue",
main = "Distribution of Estimated Daily Decisions (Beta(5,5) Prior)",
xlab = "Daily Decisions")
abline(v = mean(daily_decisions_dist), col = "red", lwd = 2)Now that we have seen how Bayesian methods allow us to model uncertainty through a Beta(5,5) prior and simulate a range of daily decisions, let us compare the two major statistical viewpoints.
Below is a comparison table:
| Aspect | Frequentist Approach | Bayesian Approach |
|---|---|---|
| What is probability? | The long-run frequency of an event happening in repeated trials. | A degree of belief about an event that updates as new data become available. |
| How do we treat parameters? | Fixed but unknown, meaning there is one ‘true’ value that we do not know. | A probability distribution, meaning we represent our uncertainty about the parameter. |
| How do we express uncertainty? | Confidence intervals computed from repeated sampling. | Credible intervals that directly state the probability of the parameter lying in a given range. |
| What do we need? | A large amount of data from repeated experiments. | A prior belief, which can be updated even with limited data. |
| Can it handle BOTECs? | No, because it requires observed data. | Yes, it can model uncertainty even without direct observations. |
We have covered a lot, including how to perform a Fermi Estimate to roughly gauge the number of decisions made per day, and why Bayesian reasoning is the natural choice for back-of-the-envelope calculations (BOTECs). In summary:
decision_table <- data.frame(
Situation = c(
"Having a large dataset and repeated experiments",
"Quantifying uncertainty from limited or no data",
"Making a back-of-the-envelope calculation without data",
"Updating beliefs as new data become available"
),
Frequentist = c("Yes", "No", "No", "No"),
Bayesian = c("Yes", "Yes", "Yes", "Yes"),
stringsAsFactors = FALSE
)
kable(decision_table, format = "html", escape = FALSE, caption = "When to Use Each Approach") %>%
kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))| Situation | Frequentist | Bayesian |
|---|---|---|
| Having a large dataset and repeated experiments | Yes | Yes |
| Quantifying uncertainty from limited or no data | No | Yes |
| Making a back-of-the-envelope calculation without data | No | Yes |
| Updating beliefs as new data become available | No | Yes |