Skip to content

Unexpected behaviour in plot_dist and plot_forest when models have different number of chains. #333

@aloctavodia

Description

@aloctavodia
from arviz_base import load_arviz_data

import arviz_plots as azp

azp.style.use("arviz-variat")

c = load_arviz_data("centered_eight")
n = load_arviz_data("non_centered_eight").sel(chain=slice(0, 2))

pc = azp.plot_forest(
    {"Centered": c, "Non Centered": n},
    var_names=["tau"],
    combined=True,  # works correctly if combined=False
    backend="matplotlib"
)
Image

This also generates the wrong result.

pc = azp.plot_dist(
    {"Centered": c, "Non Centered": n},
    var_names=["tau"],
    backend="matplotlib"
)
Image

There are also issues for plot_dist and kind="ecdf", the model with fewer chains does not saturate at 1 (I think it saturates at the ratio of the number chains in the model with fewer chains over the number of chains in the model with more chains)
When kde="hist" it fails with ValueError: Number of samples, -9223372036854775807, must be non-negative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions