Last active
August 3, 2016 16:15
-
-
Save technetium/de8e58df900c5b11c372346c3d911893 to your computer and use it in GitHub Desktop.
A function to calculate Lower bound of Wilson score confidence interval for a Bernoulli parameter @see http://www.evanmiller.org/how-not-to-sort-by-average-rating.html For this formula the interval is set at 95%
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION wilson(stars INT, total INT) | |
RETURNS REAL DETERMINISTIC | |
RETURN IF ( | |
total, | |
( | |
(stars + 1.9208) / total - | |
1.96 * SQRT((stars * (total-stars)) / total + 0.9604) / total | |
) / (1 + 3.8416 / total), | |
0 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment