Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A library for cause-effect relationships.

Project Description

Install it

You can install cause_effect via:

$ pip install cause_effect

Alternatively, you can install from the code repository directly:

$ pip install hg+

Core Functions

Is a pareto distribution present for a list of numbers (ratio <= 1)?
Which causes have the highest concentration (rank * value)?
Which effects have the highest concentration?
From which value (including) does the highest concentration begin?
causes(values, effects=0.8)
Determine causes for specified share of effects.
effects(values, causes=0.2)
Determine effects for specified share of causes.

Secondary Functions

entropy divided by control_limit.
Calculate entropy for values.
Calculate control entropy for count number of elements (length of values).

Tertiary Functions

Return list of causes that is cumulative percent of count number of elements.
Return list of effects that is cumulative percent of values.
Return list of concentration for list of values that is rank * value.
Return sorted list of numbers.


values is a list of numbers. effects and causes must be a number between 0 and 1 (including). count is the length of the list of values.

Use it

The function pareto tells you whether a pareto distribution is present for a list of numbers:

from pareto import pareto, mccauses, mceffects
pareto([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])

Here, we have a pareto distribution present. That is a minority causes a majority of effects.

But which minority causes which majority?

mccauses([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])
mceffects([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])

20% of causes effect 82% of results.

But which values are that 20%?

separator([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])

All values greater or equal than 621 are those 20% causing 82% of results.

That’s it.

Dig Deeper

How many causes are required for only 90% of effects?

from pareto import causes, effects
causes([789, 621, 109, 65, 45, 30, 27, 15, 12, 9], 0.9)


How many effects are behind only 10% of causes?

effects([789, 621, 109, 65, 45, 30, 27, 15, 12, 9], 0.1)


How does it work?

pareto calculates the entropy for a list of effects:

from pareto import entropy, control_limit, ratio
entropy([789, 621, 109, 65, 45, 30, 27, 15, 12, 9])

It calculates the entropy for a control group of ten elements. That is the length of our list.


It then checks entropy is less or equal than control_limit.

This can be simplified to:

values = [789, 621, 109, 65, 45, 30, 27, 15, 12, 9]
entropy(values) / control_limit(len(values)) <= 1

The left side of the comparison is done by ratio. So, if you want to find out how nearby or far off you are from a pareto distribution, do:

ratio([109, 65, 45, 30, 27, 15, 12, 9])

If we remove the first two effects, the control_limit will be exceeded by the values. So, we learn here that the pareto distribution disappears with the first two effects.

mccauses and mceffects return the respective share of the causes and effects where concentration (rank * value) is highest.


0.2.0 (2016-10-21)

  • Add function separator().
  • Streamline tests.

0.1.0 (2016-10-20)

  • First release on PyPI.

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.5 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Oct 20, 2016
(5.2 kB) Copy SHA256 Hash SHA256
Source None Oct 20, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting