mathdistops.pexp

Module Contents

Functions

pexp(q[, rate, graph])

Calculates the cumulative probability of the exponential distribution at this quantile and plots corresponding PDF and CDF.

mathdistops.pexp.pexp(q, rate=1, graph=True)[source]

Calculates the cumulative probability of the exponential distribution at this quantile and plots corresponding PDF and CDF.

This function computes the cumulative probability at a specified quantile q for an exponential distribution with a given rate parameter lambda. Optionally, it can generate and return a visualization corresponding PDF and CDF.

Parameters:
  • q (float) – The quantile at which to evaluate the CDF.

  • rate (float) – The rate parameter (lambda) of the exponential distribution. Default is 1.

  • graph (bool) – Whether to plot the PDF and CDF graph. Default is True.

Returns:

result

If graph is True (default), returns a tuple consisting of a pandas DataFrame and 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 ‘q’ is None, indicating that the quantile parameter is missing. If ‘rate’ is zero or negative, indicating an invalid rate parameter.

  • TypeError: – If either ‘q’ or ‘rate’ is not a numerical value.

Examples

>>> pexp(0.5, rate=1, graph=False)
    Quantile    Cumulative probability
0   0.5         0.393469