What does Star Ratings, Self-Selection and Bayesian Ranking conclude, in numbers, about “The Dirichlet-Prior Bayesian Average: Pseudo-Reviews Borrowed from the Shop”?
Answer: Chapter 4 uses the shop's star mix as a Dirichlet prior, giving Bayesian averages of 4.415 and 4.583, and discusses how to estimate the prior strength.
Scope of the numbers: Chapter 1 explains the J-shaped star distribution with two filters, a purchasing bias and an under-reporting bias; with illustrative parameters the purchasing bias lifts the mean by +0.532 stars. Marked boxes separate published evidence, runnable Python calculations (21 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 4.415, 4.583
| catalog prior mean mu0 | 4.24 stars |
| listing n raw | post mean / lower bound at m | 5, 10, 20 |
| A | 3 x five 3 5.000 | 4.525/3.991 4.415/3.953 4.339/3.972 |
| B | 200 @ 4.6 200 4.600 | 4.591/4.496 4.583/4.488 4.567/4.472 |
| C | 12 x five 12 5.000 | 4.776/4.501 4.655/4.360 4.525/4.246 |
| D | 40 @ 4.8 40 4.800 | 4.738/4.567 4.688/4.510 4.613/4.432 |
| E | 1 x one 1 1.000 | 3.700/2.708 3.945/3.265 4.086/3.626 |
| rank by post mean, m | 5: C > D > B > A > E |
| rank by post mean, m | 10: D > C > B > A > E |
| rank by post mean, m | 20: D > B > C > A > E |
| weight on own reviews n/(n+m) at m | 10: n=3 0.231, n=200 0.952 |
| hand check, m | 10: pseudo-review star total 42.4 |
| A: (42.4 + 15) / 13 | 57.4 / 13 = 4.415 |
| B: (42.4 + 920) / 210 | 962.4 / 210 = 4.583 |
Show the full program
# Chapter 4. p41: the Dirichlet-prior Bayesian average and its lower bound.
# Prior: star mix theta ~ Dirichlet(m * PI), PI = catalog star shares
# (illustrative), m = prior strength in pseudo-reviews. With counts c the
# posterior is Dirichlet(m PI + c); the posterior mean star is
# (m * mu0 + n * xbar) / (m + n), mu0 = sum k PI_k,
# i.e. the IMDb-style weighted rating with weight n / (n + m). Posterior
# variance of the mean star: (E[k^2] - E[k]^2) / (A + 1), A = m + n.
# Lower bound = mean - 1.645 sd (normal approximation, checked in p43).
import math
PI = (0.06, 0.04, 0.08, 0.24, 0.58)
LISTINGS = (
("A: 3 x five", (0, 0, 0, 0, 3)),
("B: 200 @ 4.6", (5, 2, 7, 40, 146)),
("C: 12 x five", (0, 0, 0, 0, 12)),
("D: 40 @ 4.8", (0, 1, 1, 3, 35)),
("E: 1 x one", (1, 0, 0, 0, 0)),
)
def posterior(c, m, pi=PI):
a = [m * p + x for p, x in zip(pi, c)]
tot = math.fsum(a)
e1 = math.fsum((k + 1) * x for k, x in enumerate(a)) / tot
e2 = math.fsum((k + 1) ** 2 * x for k, x in enumerate(a)) / tot
sd = math.sqrt((e2 - e1 * e1) / (tot + 1))
return e1, sd
mu0 = math.fsum((k + 1) * p for k, p in enumerate(PI))
print("catalog prior mean mu0 = %.2f stars" % mu0)
print("%-13s %4s %6s | %s" % ("listing", "n", "raw",
"post mean / lower bound at m = 5, 10, 20"))
for name, c in LISTINGS:
n = int(math.fsum(c))
raw = math.fsum((k + 1) * x for k, x in enumerate(c)) / n
cells = []
for m in (5, 10, 20):
e, sd = posterior(c, m)
cells.append("%.3f/%.3f" % (e, e - 1.645 * sd))
print("%-13s %4d %6.3f | %s" % (name, n, raw, " ".join(cells)))
for m in (5, 10, 20):
order = sorted(LISTINGS, key=lambda r: -posterior(r[1], m)[0])
print("rank by post mean, m=%2d: %s" % (
m, " > ".join(r[0][0] for r in order)))
print("weight on own reviews n/(n+m) at m=10: n=3 %.3f, n=200 %.3f"
% (3 / 13, 200 / 210))
tot0 = 10 * round(mu0, 2)
print("hand check, m=10: pseudo-review star total %.1f" % tot0)
print(" A: (%.1f + 15) / 13 = %.1f / 13 = %.3f"
% (tot0, tot0 + 15, (tot0 + 15) / 13))
print(" B: (%.1f + 920) / 210 = %.1f / 210 = %.3f"
% (tot0, tot0 + 920, (tot0 + 920) / 210))Single source and citation
Fan, Y. (2026). J-Shaped Self-Selection in Star Ratings, Bayesian-Average Ranking and Rating Inflation from the Nine-Rank System to Online Marketplaces (Version 1.0.0), Chapter 4: The Dirichlet-Prior Bayesian Average: Pseudo-Reviews Borrowed from the Shop. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-212 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026212,
author = {Fan, Yafu},
title = {J-Shaped Self-Selection in Star Ratings, Bayesian-Average Ranking and Rating Inflation from the Nine-Rank System to Online Marketplaces},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Where the J Comes From: a U-Shaped Urge to Post and Two Self-Selection Biases
- Chapter 2 · Five Stars Do Not Sell Best: the Spiegel Curve at Source and a Small-Sample Reading
- Chapter 3 · The Wilson Lower Bound: Why Three Five-Star Reviews Rank Below Two Hundred at 4.6
- Chapter 5 · Sorting Is Soliciting: the Shelf Feedback Loop, the Cost of Exploring and the First Five Reviews
- Chapter 6 · Rating Inflation: Norm Chasing, Information Decay and the Friction of Asking
- Chapter 7 · Classic Texts East and West: Liu Yi on the Nine-Rank System and Galton's "Vox Populi"
- Chapter 8 · Closing the Loop: Shop Sorting, the Timing of Review Requests and a Falsification Plan