Skip to main content

No project description provided

Reason this release was yanked:

syntax error with python versions <= 3.10

Project description

stacked_quantile

'Stacked' quantile functions. Close to weighted quantile functions.

These functions are used to calculate quantiles of a set of values, where each value has a weight. The typical process for calculating a weighted quantile is to create a CDF from the weights, then interpolate the values to find the quantile.

These functions, however, treat weighted values (given integer weights) exactly as multiple values.

So, values (1, 2, 3) with weights (4, 5, 6) will be treated as

(1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3)

If the quantile falls exactly between two values, the non-weighted average of the two values is returned. This is consistent with the "weights as occurrences" interpretation. Strips all zero-weight values, so these will never be included in such averages.

If using non-integer weights, the results will be as if some scalar were applied to make all weights into integers.

This "weights as occurrences" interpretation has two pitfalls:

  1. Identical values will be returned for different quantiles (e.g., the results for quantiles == 0.5, 0.6, and 0.7 might be identical). The effect of this is that some some common data practices like "robust scalar" will not be robust because of the potential for a 0 interquartile range. Again this is consistent, because the same thing could happen with repeated, non-weighted values.

  2. With any number of values, the stacked_median could still be the first or last value (if it has enough weight), so separating by the median is not robust. This could also happen with repeaded, non-weighted values. One workaround is to divide the values into group_a = values strictly < median, group_b = values strictly > median, then add == median to the smaller group.

Project details


Download files

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

Source Distribution

stacked_quantile-0.2.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

stacked_quantile-0.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file stacked_quantile-0.2.0.tar.gz.

File metadata

  • Download URL: stacked_quantile-0.2.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Windows/10

File hashes

Hashes for stacked_quantile-0.2.0.tar.gz
Algorithm Hash digest
SHA256 627233e362a7b65b1bfbb2efdd3fc8a6e04501342cfce41a152749dc9b42d213
MD5 d30635045a230885b2c67bfa985f36a5
BLAKE2b-256 8d804850bad516e63eb49885d66c7fba2e406123045b771eed91445f0f089fd4

See more details on using hashes here.

File details

Details for the file stacked_quantile-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stacked_quantile-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Windows/10

File hashes

Hashes for stacked_quantile-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a5fd6d3b05b731e89376158d923a39ec95be152446c25ec2e4458ddb99c5b2
MD5 689b10019ed73573438ed81869344fcd
BLAKE2b-256 bbd574682eaad9da03571e032da2b90fea94aca7b2be65d173f712172315f4c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page