Skip to content

The two renewal models duplicate their setup, so seeding changes have to be made twice #356

Open

Description

@seabbs-bot

as_turing_model(::Renewal, ::ModelShape) and as_turing_model(::StochasticRenewal, ::Int) share about thirty lines: drawing Z_t and mapping it to Rt, resolving the generation interval and baking the step, the SeedingPath branch on the initialisation slot, and building the initial state.
Only the recursion differs.
Renewal calls accumulate_scan; StochasticRenewal runs the propose/commit loop so it can draw in between.

That means a change to seeding or to generation-interval handling has to be made in two places.
#347 changed both of those, which is exactly the kind of edit that would now need doing twice.

Shape

A @model helper returning the resolved pieces, called with to_submodel(..., false) from both so the variable names stay flat.
Something like

setup ~ to_submodel(_renewal_setup(infection, n), false)

returning (; Rt, Rts, gen_int, scan_step, init).

Two things to check when doing it.
The helper draws Z_t, init_incidence, gen and scan_step, so the prefixing has to stay off or every existing chain is renamed.
Renewal takes a ModelShape and StochasticRenewal takes an Int, so the helper has to be shape-generic even though only one caller uses the matrix shape.

Why it was not done in #348

#348 rebased across #347 while both files were moving, and the refactor touches Renewal's model body, which is the part most likely to be edited concurrently.
Doing it separately keeps the risk off a change that is otherwise additive.

This was opened by a bot. Please ping @seabbs for any questions.

Activity

  1. added a commit that references this issue on Sep 3, 2026
    0f7923a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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