Skip to content

Linear trend Changepoints Misaligned in Plot #1672

Closed
@gdeleva

Description

@gdeleva

Running the following code:

delta = Prior(
    "Laplace",
    mu=Prior("Normal", mu=np.array([-10,-20, -30,-40]), sigma=np.array([0.001,0.001, 0.001, 0.001]), dims=("changepoint")),
    b=Prior("HalfNormal", sigma=0.001),
    dims=("changepoint"),
)
priors = dict(delta=delta)

trend = LinearTrend(
    priors=priors,
    n_changepoints=4,
)
prior = trend.sample_prior(random_seed=rng)
curve = trend.sample_curve(prior)
_, axes = trend.plot_curve(curve, sample_kwargs={"rng": rng})
ax = axes[0]
ax.set(
    xlabel="Time",
    ylabel="Trend",
    title=f"Linear Trend with {trend.n_changepoints} Change Points",
)

I get the following plot

Image

The 4 vertical lines are not aligned with the change points which are - I suppose - 0, 0.333, 0.667, 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MMMmodel componentsRelated to the various model components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions