A Python tool that calculates Bayesian credibility intervals for online polling using the Ipsos method
The Ipsos credibility interval is a Bayesian metric that can be used to calculate the margin of error. It estimates accuracy plus or minus a number of percentage points. You can learn more by reading the Ipsos white paper.
The package is available in the Python Package Index. You can install it with pipenv or another package manager.
pipenv install ipsos-credibility-interval
To get an estimate, you must import the library and provide the sample size to the
get function. It will return the credibility interval in percentage points. Here’s an example with a sample size of 1,000:
You can provide a custom confidence level. The default is 95%. This would return the interval for a 99% confidence level:
You can also customize the weighting factor designed by Ipsos. The default is 1.3. This example would return the interval for a weighting factor of 1.5: