ipsos-credibility-interval

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.

Installation

The package is available in the Python Package Index. You can install it with pipenv or another package manager.

pipenv install ipsos-credibility-interval

Usage

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:

import ipsos_credibility_interval

ipsos_credibility_interval.get(1000)
3.5333753221609374

You can provide a custom confidence level. The default is 95%. This would return the interval for a 99% confidence level:

ipsos_credibility_interval.get(1000, confidence_level=0.99)
4.643642315394128

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:

ipsos_credibility_interval.get(1000, weight=1.5)
3.7954539356449795

Other resources