Age-Stratified SIR (per-age transmission)¶
An SIR model in which each age group has its own transmission rate, with age mixing through a contact matrix and spatial mixing through a travel matrix.
AgeStratifiedSIRModel(config)
¶
Bases: Model
A schema-based SIR model whose transmission rate varies by age group.
Initialize the model from a validated simulation config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict
|
Validated simulation configuration produced by the framework's config loader. |
required |
Source code in compartment/models/age_stratified_sir_model/model.py
define_parameters(schema)
classmethod
¶
Declare compartments, transmission edges, per-age betas and demographics.
Called once by the framework to build the model schema, from which the config validator and parameter set are generated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
ParameterSchemaBuilder
|
Schema builder to populate. |
required |
Source code in compartment/models/age_stratified_sir_model/model.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
build_travel_matrix(admin_zones)
¶
Build an inverse-square gravity travel matrix from travel_sigma.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
admin_zones
|
list[dict]
|
Admin-zone dicts with |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The |
Source code in compartment/models/age_stratified_sir_model/model.py
prepare_initial_state()
¶
Return the age-stratified initial populations for the solver.
Returns:
| Type | Description |
|---|---|
ndarray
|
Populations shaped (compartments, age groups, zones),
including the appended |
Source code in compartment/models/age_stratified_sir_model/model.py
equation(y, t, p)
¶
Compute the compartment derivatives with an age-stratified force of infection.
The standard I->R edge is handled by the framework; the S->I force of
infection is built manually so it can mix age groups through the contact
matrix and regions through the travel matrix, using the per-age beta
vector, and is applied via :meth:_apply_flow (which also accumulates
I_total). Interventions scale each per-age beta directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
ndarray
|
Current compartment values, ordered by
|
required |
t
|
float
|
Current time in days since the simulation start date. |
required |
p
|
tuple
|
Packed parameter tuple, unpacked via |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Stacked per-compartment derivatives (dy/dt). |