Stratum

Stratum package.

class miscore.processes.Stratum(*strata, name='stratum')[source]

This process divides the population into strata, based on user-defined conditions. Any individuals that could not be assigned to a stratum are placed in stratum 0.

In the example below, all males with ‘crc_hazard’ higher than 1. are placed in stratum 1. All females are in stratum 2. Stratum 0 will contain all the remaining males (i.e. with ‘crc_hazard’ lower than or equal to 1.).

>>> stratum = Stratum(
...     [("sex", "==", "True"), ("crc_hazard", ">", 1.)],
...     [("sex", "==", "False")]
... )
Parameters:
  • strata (Sequence[Tuple[str, str, str | float]]) – All arguments passed to initialize this process are interpreted as sequences of strata conditions. Each condition should be a tuple with a property name (e.g. “sex”) as first element, an operator (e.g. “==”) as second element and a value (e.g. “True”) as third element.

  • name (str) – The name of the process. Defaults to ‘stratum’.