endplay.stats

Functions for statistical analysis of deals.

Functions:

average(deals, func)

Return the average of a function over a sequence of deals

cofrequency(deals, func1, func2, lb1, ub1, ...)

Calculate the value of two functions over a range of deals, and bin the results into unit-sized bins around integer values from lb to ub to form a matrix

frequency(deals, func, lb, ub)

Calculate the value of a function over a range of deals, and bin the results into unit-sized bins around integer values from lb to ub

endplay.stats.average(deals: Iterable[Deal], func: Callable[[Deal], float | int | bool])

Return the average of a function over a sequence of deals

endplay.stats.cofrequency(deals: Iterable[Deal], func1: Callable[[Deal], float | int | bool], func2: Callable[[Deal], float | int | bool], lb1: int, ub1: int, lb2: int, ub2: int) list[list[int]]

Calculate the value of two functions over a range of deals, and bin the results into unit-sized bins around integer values from lb to ub to form a matrix

Parameters:
  • deals – The input sequence of deals

  • func1 – The first function to evaluate over deals

  • func2 – The second function to evaluate over deals

  • lower_bound1 – Value below which values returned from func1 are ignored

  • upper_bound1 – Value above which values returned from func1 are ignored

  • lower_bound2 – Value below which values returned from func2 are ignored

  • upper_bound2 – Value above which values returned from func2 are ignored

endplay.stats.frequency(deals: Iterable[Deal], func: Callable[[Deal], float | int | bool], lb: int, ub: int) list[int]

Calculate the value of a function over a range of deals, and bin the results into unit-sized bins around integer values from lb to ub

Parameters:
  • deals – The input sequence of deals

  • func – The function to evaluate over deals

  • lb – Value below which values are ignored

  • ub – Value above which values are ignored

Returns:

An array of bins, and a tuple containing the left and right boundaries