medianrange
Compute median plus error bounds using binomial probabilities from eqn 1 of Gott et al. 2001, ApJ, 549, 1
This computes the percentile range about the median (using a simple model fit for N>10 points and a direct summation for N<10) and then uses the np.percentile() function to calculate the range.
White, 2023 June 21
Attributes
Functions
|
Compute percentile bounds using binomial probabilities. |
|
Compute median and error bounds using binomial probabilities. |
Module Contents
- medianrange.getbounds(ndata, ncut=10, a=1.2, verbose=False)
Compute percentile bounds using binomial probabilities.
Based on equation 1 of Gott et al. 2001, ApJ, 549, 1. https://ui.adsabs.harvard.edu/abs/2001ApJ…549….1G/abstract
Parameters
- ndataint
Number of input values
- ncutint, optional
Use direct calculation for ndata <= ncut points, and model fit for ndata > ncut points. Default is 10.
- afloat, optional
Parameter in model fit. Default is 1.2.
- verbosebool, optional
If True, prints the percentile range. Default is False.
Returns
- pct_medfloat
Percentile for median of array (always 50.0)
- pct_medlofloat
Percentile for lower bound of confidence interval
- pct_medhifloat
Percentile for upper bound of confidence interval
- medianrange.medianrange(data, **kw)
Compute median and error bounds using binomial probabilities.
Based on equation 1 of Gott et al. 2001, ApJ, 549, 1. https://ui.adsabs.harvard.edu/abs/2001ApJ…549….1G/abstract
Parameters
- dataarray-like
Array of input values
- kwdict
Additional keyword arguments passed to getbounds()
Returns
- medfloat
Median of array
- medlofloat
Lower bound of confidence interval
- medhifloat
Upper bound of confidence interval
Notes
Requires numpy >= 1.23.5 for the percentile method.
- medianrange.rng