Skip to content

math-utils/wilson-score

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wilson Score Build Status

Calculates the lower bound of the binomial proportion confidence interval as calculated by the Wilson score interval. If you're not retarded, you would use this score instead of averages when sorting and ranking (doesn't matter what the user sees). This is what reddit uses for "best".

API

var wilson = require('wilson-score')

wilson(up, total [, z-score])

  • up - the total number of "yes"s
  • total - the total number of votes
  • z-score - the z-score of the interval. By default, it's ~2.3 which corresponds to a 99% confidence interval. Use 1.644853 for 95%.

Instead of calculating the average as up / total, calculate the wilson score via wilson(up, total). The wilson score will always be lower than the average.