stratified_relative_risk#
- rojak.turbulence.metrics.stratified_relative_risk(effect_of, on_var, *control_var, sum_over, use_log=False)[source]#
Relative risk of an outcome with respect to an exposure variable, stratified by 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 stratify by
sum_over (str | list[str] | None) – Dimension to sum over to obtain counts for each stratum
use_log (bool) – If True, returns the natural logarithm of the relative risk. Default is False.
- Returns:
List of the relative risk (or log relative risk if
use_logis True), one per stratum. Seestratified_contingency_table()for how strata are determined- Return type: