marginal_odds_ratio#

rojak.turbulence.metrics.marginal_odds_ratio(effect_of, on_var, *control_var, sum_over, use_log=True)[source]#

Marginal (pooled) sample odds ratio between two binary variables, aggregated over one or more control variables

The contingency tables for each stratum (see stratified_contingency_table()) are computed, and their cell counts are summed together before the odds ratio is computed from the pooled counts.

Parameters:
  • effect_of (DataArray) – A binary xarray DataArray representing the exposure variable

  • on_var (DataArray) – A binary xarray DataArray representing the outcome variable

  • *control_var (DataArray) – One or more binary variables to marginalise over

  • sum_over (str | list[str] | None) – Dimension(s) to sum over when computing the 2x2 contingency table for each stratum

  • use_log (bool) – If True (default), returns the natural logarithm of the odds ratio

Returns:

The marginal (log) odds ratio, pooled across all strata

Return type:

DataArray