Freedom
Building and checking models
Law or aphorism
Advanced
It’s not user friendly.
What it is
The line is Charles Margossian’s. He said it in a work meeting about a feature of the Stan software (embedded Laplace approximations): making it more flexible would complicate the interface. Gelman relates it to “the well-known tension between freedom and security in politics, or the tension between freedom and regularization in statistical inference”, and then turns it around. In the 8 schools example, the no-pooling model has the most freedom in one sense, but “in another sense, the hierarchical model gives you more freedom because it regularizes away the worst excesses of the fit”, like a trapeze artist with a net. “Ultimately, for statistical software the most user friendly thing is for it to enable users to do useful analyses.”
Flexible tools such as probabilistic programming languages let you fit almost any model. That freedom has a price: you make decisions that a constrained, “user-friendly” tool would have made for you, and every one is a chance to get something wrong.
Why it matters
There’s a real tension in tool design. Constrained software with sensible defaults protects novices from many mistakes but stops experts from building the right model. Flexible software lets experts do excellent work and lets novices produce elaborate nonsense. Neither is better in general. The right choice depends on who is using the tool and how much support, such as defaults, checks and workflow guidance, comes with the freedom.
How it works
A toy model. Analysis quality depends on matching the model to the problem. A constrained tool offers a few good default models, so its quality is moderate and fairly consistent regardless of skill. A free tool lets the analyst specify any model. Quality then depends on skill: experts land near the best model, and novices scatter widely, sometimes far below the constrained tool’s floor.
Simulated example
Simulate many analysts of varying skill using either a constrained or a free tool. Compare the distributions of analysis quality.
Show simulation code
The R version uses base R, and the Python version uses NumPy and Matplotlib. Where the simulation draws random numbers, each language draws its own, so exact numbers differ slightly but show the same pattern. The numbered markers in the R code are explained under it.
import {rng, range, quantile, fmt} from "../js/stats.js"
viewof skill = Inputs.range([0, 1], {value: 0.5, step: 0.05, label: "Average analyst skill"})
viewof seed = Inputs.range([1, 500], {value: 102, step: 1, label: "Random seed"})
freedom = {
const r = rng(seed);
return range(2000).flatMap(() => {
const s = Math.min(1, Math.max(0, r.normal(skill, 0.2)));
const constrained = 0.65 + r.normal(0, 0.05); // good defaults, limited ceiling
const free = 0.95 - (1 - s) * Math.abs(r.normal(0, 0.6)); // ceiling high, floor depends on skill
return [{tool: "Constrained, user-friendly", q: constrained}, {tool: "Free, flexible", q: Math.max(-0.5, free)}];
});
}
Plot.plot({
ariaLabel: "Freedom: simulation chart",
ariaDescription: "Horizontal axis: Analysis quality (1 = best possible). Vertical axis: Analysts. The chart updates with the controls above it, and the summary below the charts states the result in words.",
height: 280,
facet: {data: freedom, y: "tool", marginRight: 160},
x: {label: "Analysis quality (1 = best possible)", domain: [-0.5, 1]},
y: {label: "Analysts", grid: true},
marks: [Plot.rectY(freedom, Plot.binX({y: "count"}, {x: "q", fill: "tool", thresholds: 40, domain: [-0.5, 1]})), Plot.ruleY([0])],
color: {range: ["#8a8a8a", "#2166ac"]}
})# Freedom: it's not user friendly.
1skill <- 0.5 # average analyst skill
2set.seed(102)
s <- pmin(1, pmax(0, rnorm(2000, skill, 0.2))) # each analyst
3constrained <- 0.65 + rnorm(2000, 0, 0.05) # good defaults, limited ceiling
4free <- pmax(-0.5, 0.95 - (1 - s) * abs(rnorm(2000, 0, 0.6))) # skill-bound
q <- rbind(
constrained = quantile(constrained, c(0.1, 0.5)),
free = quantile(free, c(0.1, 0.5))
)
print(round(q, 2)) # worst 10% and median quality
5boxplot(
list(
"Constrained, user-friendly" = constrained,
"Free, flexible" = free
),
col = c("#2166ac", "#d6604d"), ylab = "Quality of the analysis"
)- 1
- The page’s control: the average skill of the analysts.
- 2
- Fixes the random numbers so the run is reproducible.
- 3
- A constrained, user-friendly tool: good defaults, a limited ceiling, hard to misuse.
- 4
- A free, flexible tool: a higher ceiling, but the floor depends on the analyst’s skill.
- 5
- The two distributions of analysis quality. Freedom raises the best outcomes and lowers the worst.
# Freedom: it's not user friendly.
import numpy as np
import matplotlib.pyplot as plt
skill = 0.5 # average analyst skill
rng = np.random.default_rng(102)
s = np.clip(rng.normal(skill, 0.2, 2000), 0, 1) # each analyst
constrained = 0.65 + rng.normal(0, 0.05, 2000) # good defaults, low ceiling
free = np.maximum(-0.5, 0.95 - (1 - s) * np.abs(rng.normal(0, 0.6, 2000)))
for name, q in [("Constrained", constrained), ("Free", free)]:
print(f"{name}: median quality {np.median(q):.2f}, "
f"worst 10% {np.quantile(q, 0.1):.2f}")
plt.boxplot([constrained, free], patch_artist=True)
plt.xticks([1, 2], ["Constrained, user-friendly", "Free, flexible"])
plt.ylabel("Quality of the analysis")
plt.show()Key takeaways
- Flexibility lets you build the right model, and lets you build very wrong ones.
- Constrained tools set a floor on quality. Free tools raise the ceiling.
- Good flexible tools come with good defaults, checks and workflow guidance.
Source
- Andrew Gelman, Freedom is not user-friendly (2022).