mrtool.evidence_score package

scorelator

class Scorelator(ln_rr_draws, exposures, exposure_domain=None, ref_exposure=None, score_type='area')[source]

Bases: object

Evaluate the score of the result. Warning: This is specifically designed for the relative risk application. Haven’t been tested for others.

static annotate_between_curve(annotation, x, y_lower, y_upper, ax, mark_area=False)[source]

Annotate between the curve.

Parameters:
  • annotation (str) – the annotation between the curve.
  • x (np.ndarray) – independent variable.
  • y_lower (np.ndarray) – lower bound of the curve.
  • y_upper (np.ndarray) – upper bound of the curve.
  • ax (Axes) – axis of the plot.
  • mark_area (bool, optional) – If True mark the area. Default to False.
get_evidence_score(lower_draw_quantile=0.025, upper_draw_quantile=0.975, path_to_diagnostic=None)[source]

Get evidence score.

Parameters:
  • lower_draw_quantile (float, optional) – Lower quantile of the draw for the score.
  • upper_draw_quantile (float, optioanl) – Upper quantile of the draw for the score.
  • path_to_diagnostic (Union[str, Path, None], optional) – Path of where the picture is saved, if None the plot will not be saved. Default to None.
Returns:

Evidence score.

Return type:

float

normalize_ln_rr_draws()[source]

Normalize log relative risk draws.

area_between_curves(lower, upper, ind_var=None, normalize_domain=True)[source]

Compute area between curves.

Parameters:
  • lower (np.ndarray) – Lower bound curve.
  • upper (np.ndarray) – Upper bound curve.
  • ind_var (Union[np.ndarray, None], optional) – Independent variable, if None, it will assume sample points are evenly spaced. Default to None.
  • normalize_domain (bool, optional) – If True, when ind_var is None, will normalize domain to 0 and 1. Default to True.
Returns:

Area between curves.

Return type:

float

seq_area_between_curves(lower, upper, ind_var=None, normalize_domain=True)[source]

Sequence areas_between_curves.

Args: Please check the inputs for area_between_curves.

Returns:Return areas defined from the first two points of the curve to the whole curve.
Return type:np.ndarray