mathdistops.qexp¶
Module Contents¶
Functions¶
|
Calculates the quantile corresponding to given cumulative probability in an exponential distribution and plots the corresponding distribution. |
- mathdistops.qexp.qexp(p, rate=1, graph=True)[source]¶
Calculates the quantile corresponding to given cumulative probability in an exponential distribution and plots the corresponding distribution.
This function computes the quantile corresponding to a specified cumulative probability p for an exponential distribution characterized by a given rate parameter lambda. Optionally, it can also generate and return a visualization of the distribution.
- Parameters:
p (float, optional) – The cumulative probability for which to find the quantile. Must be between 0 and 1, inclusive of 1.
rate (float) – The rate parameter (lambda) of the exponential distribution. Must be a positive number. Default is 1
graph (bool, optional) – If True, generates and returns a plot of the exponential distribution with the quantile highlighted for the given cumulative probability. Default is True.
- Returns:
result – If graph is True (default), returns a tuple consisting of a pandas DataFrame giving you the cumulative probability and the quantile as well as a layered altair Chart consisting of two graphs, CDF and PDF. If graph is False, returns a pandas DataFrame.
- Return type:
pandas.DataFrame or tuple
- Raises:
ValueError: – If the cumulative probability ‘p’ is not between 0 and 1, exclusive of 1. If the rate parameter ‘rate’ is not a positive number.
Examples
>>> qexp(0.5, rate=1, graph=False) Probability Quantile 0 0.5 0.6931471805599453