Non-parametric p-boxes#
Functions that can be used to generate non-parametric p-boxes. These functions are used to generate p-boxes based upon the minimum, maximum, mean, median, mode, standard deviation, variance, and coefficient of variation of the variable.
- pba.pbox_constructors.non_parametric.what_I_know(minimum: Interval | float | int | None = None, maximum: Interval | float | int | None = None, mean: Interval | float | int | None = None, median: Interval | float | int | None = None, mode: Interval | float | int | None = None, std: Interval | float | int | None = None, var: Interval | float | int | None = None, cv: Interval | float | int | None = None, percentiles: dict[Interval | float | int] | None = None, debug: bool = False, steps: int = 200) Pbox#
Generates a distribution free p-box based upon the information given. This function works by calculating every possible non-parametric p-box that can be generated using the information provided. The returned p-box is the intersection of these p-boxes.
Parameters:
minimum: Minimum value of the variablemaximum: Maximum value of the variablemean: Mean value of the variablemedian: Median value of the variablemode: Mode value of the variablestd: Standard deviation of the variablevar: Variance of the variablecv: Coefficient of variation of the variablepercentiles: Dictionary of percentiles and their values (e.g. {0.1: 1, 0.5: 2, 0.9: Interval(3,4)})steps: Number of steps to use in the p-boxError
ValueError: If any of the arguments are not consistent with each other. (i.e. ifstdandvarare both given, butstd != sqrt(var))Returns:
Pbox: Imposition of possible p-boxes
- pba.pbox_constructors.non_parametric.box(a: Interval | float | int, b: Interval | float | int | None = None, steps=200, shape='box') Pbox#
Returns a box shaped Pbox. This is equivalent to an Interval expressed as a Pbox.
Parameters:
a: Left side of boxb: Right side of boxReturns:
Pbox
- pba.pbox_constructors.non_parametric.min_max(a: Interval | float | int, b: Interval | float | int | None = None, steps=200, shape='box') Pbox#
Returns a box shaped Pbox. This is equivalent to an Interval expressed as a Pbox.
Parameters:
a: Left side of boxb: Right side of boxReturns:
Pbox
- pba.pbox_constructors.non_parametric.min_max_mean(minimum: Interval | float | int, maximum: Interval | float | int, mean: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum and mean of the variable
Parameters:
minimum: minimum value of the variablemaximum: maximum value of the variablemean: mean value of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.min_max_mean_std(minimum: Interval | float | int, maximum: Interval | float | int, mean: Interval | float | int, std: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum, mean and standard deviation of the variable
Parameters
minimum: minimum value of the variablemaximum: maximum value of the variablemean: mean value of the variablestd:standard deviation of the variableReturns
PboxSee also
- pba.pbox_constructors.non_parametric.min_max_mean_var(minimum: Interval | float | int, maximum: Interval | float | int, mean: Interval | float | int, var: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum, mean and standard deviation of the variable
Parameters
minimum: minimum value of the variablemaximum: maximum value of the variablemean: mean value of the variablevar:variance of the variableReturns
PboxImplementation
Equivalent to
min_max_mean_std(minimum,maximum,mean,np.sqrt(var))See also
- pba.pbox_constructors.non_parametric.min_max_mode(minimum: Interval | float | int, maximum: Interval | float | int, mode: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum, and mode of the variable
Parameters:
minimum: minimum value of the variablemaximum: maximum value of the variablemode: mode value of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.min_max_median(minimum: Interval | float | int, maximum: Interval | float | int, median: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum and median of the variable
Parameters:
minimum: minimum value of the variablemaximum: maximum value of the variablemedian: median value of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.min_max_median_is_mode(minimum: Interval | float | int, maximum: Interval | float | int, m: Interval | float | int, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon the minimum, maximum and median/mode of the variable when median = mode.
Parameters:
minimum: minimum value of the variablemaximum: maximum value of the variablem: m = median = mode value of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.mean_std(mean: Interval | float | int, std: Interval | float | int, steps=200) Pbox#
Generates a distribution-free p-box based upon the mean and standard deviation of the variable
Parameters:
mean: mean of the variablestd: standard deviation of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.mean_var(mean: Interval | float | int, var: Interval | float | int, steps=200) Pbox#
Generates a distribution-free p-box based upon the mean and variance of the variable
Equivalent to mean_std(mean,np.sqrt(var))
Parameters:
mean: mean of the variablevar: variance of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.pos_mean_std(mean: Interval | float | int, std: Interval | float | int, steps=200) Pbox#
Generates a positive distribution-free p-box based upon the mean and standard deviation of the variable
Parameters:
mean: mean of the variablestd: standard deviation of the variableReturns:
Pbox
- pba.pbox_constructors.non_parametric.symmetric_mean_std(mean: Interval | float | int, std: Interval | float | int, steps: int = 200) Pbox#
Generates a symmetrix distribution-free p-box based upon the mean and standard deviation of the variable
Parameters:
mean: mean value of the variablestd: standard deviation of the variableReturns
Pbox
- pba.pbox_constructors.non_parametric.from_percentiles(percentiles: dict, steps: int = 200) Pbox#
Generates a distribution-free p-box based upon percentiles of the variable
Parameters
percentiles: dictionary of percentiles and their values (e.g. {0: 0, 0.1: 1, 0.5: 2, 0.9: Interval(3,4), 1:5})steps: number of steps to use in the p-boxImportant
The percentiles dictionary is of the form {percentile: value}. Where value can either be a number or an Interval. If value is a number, the percentile is assumed to be a point percentile. If value is an Interval, the percentile is assumed to be an interval percentile.
Warning
If no keys for 0 and 1 are given,
-np.infandnp.infare used respectively. This will result in a p-box that is not bounded and raise a warning.If the percentiles are not increasing, the percentiles will be intersected. This may not be desired behaviour.
Error
ValueError: If any of the percentiles are not between 0 and 1.Returns
PboxExample:
pba.from_percentiles( {0: 0, 0.25: 0.5, 0.5: pba.I(1,2), 0.75: pba.I(1.5,2.5), 1: 3} ).show()