Skip to content

Promote the survival machinery to heormodel.survival (item 18, phase 2) #60

Description

@pedroliman

Problem

Phase 1 (#58) proved the survival-to-engine path with bespoke, Weibull-only helpers inside an example. They are not reusable and are tied to one distribution and one hand-rolled maximum-likelihood fit.

Goal

Promote the machinery into a public heormodel.survival module with a clean, functional, composition-first interface that ingests a model fit from lifelines (any of its parametric families) and supports the curve operations a health economist needs. Phase 2 changes no acceptance number; it re-expresses the passing replication through the extracted layer.

Acceptance criteria

  • SurvivalCurve is one composed value object (a cumulative-hazard function of time); the families, curve algebra, and adapter are functions returning curves, with no class hierarchy.
  • Public surface: SurvivalCurve; families exponential, weibull, gompertz; adapter from_lifelines, sample_params; curve algebra apply_hazard_ratio, apply_acceleration_factor, mix, splice; and to_transition_matrix.
  • The adapter is duck-typed, so the module imports without lifelines; the fitting package installs with a new survival extra.
  • The two engines and the parameter recovery reproduce the item-18 acceptance values through the public interface: reference table (5.64394 / 4.92709 / 4.18803), both engines recover the discounted life expectancy, closed forms for a constant hazard and a hazard ratio hold, and the fitted-model and probabilistic discounted life expectancies converge to 4.92709 as the sample grows.
  • Ship examples/survival_models.py, a website tutorial, an API reference section, changelog and roadmap updates, and doctest, closed-form, and convergence tests.

Follows #58.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions