I wonder, if someone could help to understand a formula from a book please.

Bayesian Methods for Hackers: Probabilistic Programming and Bayesian Inference (Addison-Wesley Data & Analytics) (Addison-Wesley Data & Analytics) by Cameron Davidson-Pilon Davidson-Pilon

See also this.

This is the formula:

I am not 100% sure what N and S is. Let us say there are 2 ratings. 1 for star 4 and 1 for star 5. Would N = 2 (2 ratings/votes/users) and S = 4 + 5 = 9?

Thanks!

PS:

I think this is related to this, which I am sorry goes right over my head.

## Best Answer

This is sloppy writing, and the author should be embarrassed :)

$N$ is the total number of ratings, and $S$ is the sum of "scores". Scores can be 1 or 0 (as in a binary voting system), or fractional (as in a star-rating system). I made a poor choice of variable names, and should have said:

In your example: observing a rating 4 and a rating 5 (assuming that $M=5$ stars is the best possible score). Then $N=2$, and $S = \frac{4}{5} + \frac{5}{5}$.