variation

mpsci.stats.variation(x, ddof=1)

The variation of x.

The variation the ratio of the standard deviation to the mean:

std(x, ddof) / mean(x)

Note that, unlike var and std, the default value of ddof is 1. This is the more typical value used when computing the variation.

(The implementation is simply std(x, ddof) / mean(x); no special handling is provided for nan values, a mean of 0, etc.)

Examples

>>> from mpsci.stats import variation
>>> variation([2, 3, 5, 8, 13, 21])
>>> mpf('0.83418102841390518')

For comparison to scipy.stats.variation, use ddof=0:

>>> variation([2, 3, 5, 8, 13, 21], ddof=0)
>>> mpf('0.76149961050858964')