Skip to content

Measles SEIR calibrated to the 2025 Texas outbreak (Gonzalez-Parra et al.)

SEIR measles model whose transmission rate is calibrated to the 2025 Texas weekly case series (rising limb) via the dataset input, then simulated forward. The transmission rate is fixed by the data and is not a user input; the latent and infectious periods remain adjustable.

MeaslesSeirCalibratedGonzalezparraModel(config)

Bases: Model

SEIR measles model with a data-calibrated (non-user-facing) transmission rate.

Source code in compartment/models/measles_seir_calibrated_gonzalezparra_model/model.py
def __init__(self, config):
    super().__init__(config)  # sets self.sigma, self.gamma, population_matrix, and disease params
    # Defensive default for legacy configs that pre-date this parameter.
    self.initial_immune_fraction = getattr(self, "initial_immune_fraction", INITIAL_IMMUNE_FRACTION_DEFAULT)
    self.beta = self._calibrated_beta()  # fitted transmission rate (not from config)

prepare_initial_state()

Redistribute S -> R to reflect pre-existing population immunity.

Uses the user-defined initial_immune_fraction parameter (percentage 0-100) to set the immune count at t=0. The default 92.15% = 0.95 x 0.97 (MMR coverage × two-dose efficacy) for the TX 2025 5-county community under the all-or-nothing vaccine model (Anderson & May 1991).

This parameter is independent of CALIBRATION_SUSCEPTIBLE_FRACTION: changing it adjusts S(0) and R(0) but does NOT alter the fitted beta, which is locked to the outbreak dataset's f_s = 0.0785.

The small seed of initially infectious individuals is applied by the platform on top of this redistribution via the case-file infected_population field.

Source code in compartment/models/measles_seir_calibrated_gonzalezparra_model/model.py
def prepare_initial_state(self):
    """Redistribute S -> R to reflect pre-existing population immunity.

    Uses the user-defined ``initial_immune_fraction`` parameter (percentage 0-100)
    to set the immune count at t=0.  The default 92.15% = 0.95 x 0.97 (MMR
    coverage × two-dose efficacy) for the TX 2025 5-county community under the
    all-or-nothing vaccine model (Anderson & May 1991).

    This parameter is independent of CALIBRATION_SUSCEPTIBLE_FRACTION: changing
    it adjusts S(0) and R(0) but does NOT alter the fitted beta, which is locked
    to the outbreak dataset's f_s = 0.0785.

    The small seed of initially infectious individuals is applied by the platform
    on top of this redistribution via the case-file infected_population field.
    """
    y0 = np.array(self.population_matrix, dtype=float)
    s_idx = self.compartment_list.index("S")
    r_idx = self.compartment_list.index("R")
    N = float(y0.sum())
    immune_frac = float(self.initial_immune_fraction) / 100.0   # PERCENTAGE -> fraction
    immune_count = immune_frac * N
    # Guard: never move more than what is in S
    immune_count = min(immune_count, float(y0[s_idx]))
    y0[s_idx] -= immune_count
    y0[r_idx] += immune_count
    return y0