relative_risk#

rojak.turbulence.metrics.relative_risk(first_var: DataArray, second_var: DataArray, sum_over: str, *, use_log: bool = False) DataArray[source]#

Relative risk of an outcome with respect to an exposure variable

The relative risk is the ratio of the probability of an outcome occurring in the exposed group to the probability of that outcome occurring in the unexposed group.

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

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

  • sum_over (str) – Dimension to sum over to obtain counts

  • use_log (bool) – If True, returns the natural logarithm of the relative risk. Default is False.

Returns:

The relative risk (or log relative risk if use_log=True).

Dimensions are preserved except for the summed dimension.

Return type:

xr.DataArray

Notes

  • Relative risk = P(outcome=1 | exposure=1) / P(outcome=1 | exposure=0)

  • RR > 1 indicates increased risk with exposure

  • RR < 1 indicates decreased risk with exposure

  • RR = 1 indicates no association between exposure and outcome