tombolo.plots.league_table

 1import jsonschema
 2import matplotlib.pyplot as plt
 3
 4from .primitives.grid import _grid
 5
 6_matrix = {
 7    "type": "object",
 8    "additionalProperties": {
 9        "type": "object",
10        "additionalProperties": {"type": ["number", "null"]},
11    },
12}
13
14_schema = {
15    "type": "object",
16    "required": ["league"],
17    "properties": {
18        "league": {
19            "type": "object",
20            "required": ["md", "lower", "upper"],
21            "properties": {
22                "md": _matrix,
23                "lower": _matrix,
24                "upper": _matrix,
25                "pval": _matrix,
26            },
27        }
28    },
29}
30
31
32def league_table(data: dict) -> plt.Figure:
33    """Grid of pairwise treatment comparisons.
34
35    Args:
36        data: Result dict from `tombolo.nma` or `tombolo.bnma`. Only `league` is used.
37
38    Returns:
39        A matrix where each cell shows the mean difference and confidence (or credible)
40        interval for the row treatment relative to the column treatment. Diagonal cells
41        show the treatment name. P-values are included for NMA results.
42    """
43    jsonschema.validate(instance=data, schema=_schema)
44    return _grid(data["league"])
def league_table(data: dict) -> matplotlib.figure.Figure:
33def league_table(data: dict) -> plt.Figure:
34    """Grid of pairwise treatment comparisons.
35
36    Args:
37        data: Result dict from `tombolo.nma` or `tombolo.bnma`. Only `league` is used.
38
39    Returns:
40        A matrix where each cell shows the mean difference and confidence (or credible)
41        interval for the row treatment relative to the column treatment. Diagonal cells
42        show the treatment name. P-values are included for NMA results.
43    """
44    jsonschema.validate(instance=data, schema=_schema)
45    return _grid(data["league"])

Grid of pairwise treatment comparisons.

Args: data: Result dict from tombolo.nma or tombolo.bnma. Only league is used.

Returns: A matrix where each cell shows the mean difference and confidence (or credible) interval for the row treatment relative to the column treatment. Diagonal cells show the treatment name. P-values are included for NMA results.