conditional_odds_ratio#
- rojak.turbulence.metrics.conditional_odds_ratio(effect_of, on_var, *control_var, sum_over, use_log=True)[source]#
Sample odds ratio between two binary variables, conditional on one or more control variables
See
stratified_contingency_table()for details on how the contingency tables are stratified bycontrol_var.- 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 condition on
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:
List of the conditional (log) odds ratio, one per stratum. See
stratified_contingency_table()for how strata are determined- Return type: