Model
HospitalAdmissionsModel
HospitalAdmissionsModel(
latent_hosp_admissions_rv: RandomVariable,
latent_infections_rv: RandomVariable,
gen_int_rv: RandomVariable,
I0_rv: RandomVariable,
Rt_process_rv: RandomVariable,
hosp_admission_obs_process_rv: RandomVariable,
)
Bases: Model
Hospital Admissions Model (BasicRenewal + HospitalAdmissions)
This class inherits from pyrenew.models.Model. It extends the basic renewal model by adding a hospital admissions module, e.g., pyrenew.observations.HospitalAdmissions.
Default constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
latent_hosp_admissions_rv
|
RandomVariable
|
Latent process for the hospital admissions. |
required |
latent_infections_rv
|
RandomVariable
|
The infections latent process (passed to RtInfectionsRenewalModel). |
required |
gen_int_rv
|
RandomVariable
|
Generation time (passed to RtInfectionsRenewalModel) |
required |
I0_rv
|
RandomVariable
|
Initial infections (passed to RtInfectionsRenewalModel) |
required |
Rt_process_rv
|
RandomVariable
|
Rt process (passed to RtInfectionsRenewalModel). |
required |
hosp_admission_obs_process_rv
|
RandomVariable
|
Observation process for the hospital admissions. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/model/admissionsmodel.py
57 58 59 60 61 62 63 64 65 66 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 |
|
sample
sample(
n_datapoints: int | None = None,
data_observed_hosp_admissions: ArrayLike | None = None,
padding: int = 0,
**kwargs,
) -> HospModelSample
Sample from the HospitalAdmissions model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_datapoints
|
int | None
|
Number of timepoints to sample (passed to the basic renewal model). |
None
|
data_observed_hosp_admissions
|
ArrayLike | None
|
The observed hospitalization data (passed to the basic renewal model). Defaults to None (simulation, rather than fit). |
None
|
padding
|
int
|
Number of padding timepoints to add to the beginning of the simulation. Defaults to 0. |
0
|
**kwargs
|
Additional keyword arguments passed through to internal sample() calls, should there be any. |
{}
|
Returns:
Type | Description |
---|---|
HospModelSample
|
|
See Also
basic_renewal.sample : For sampling the basic renewal model sample_observed_admissions : For sampling observed hospital admissions
Source code in pyrenew/model/admissionsmodel.py
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 197 198 199 200 201 202 |
|
validate
staticmethod
validate(latent_hosp_admissions_rv, hosp_admission_obs_process_rv) -> None
Verifies types and status (RV) of latent and observed hospital admissions
Parameters:
Name | Type | Description | Default |
---|---|---|---|
latent_hosp_admissions_rv
|
The latent process for the hospital admissions. |
required | |
hosp_admission_obs_process_rv
|
The observed hospital admissions. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/model/admissionsmodel.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
RtInfectionsRenewalModel
RtInfectionsRenewalModel(
latent_infections_rv: RandomVariable,
gen_int_rv: RandomVariable,
I0_rv: RandomVariable,
Rt_process_rv: RandomVariable,
infection_obs_process_rv: RandomVariable = None,
)
Bases: Model
Basic Renewal Model (Infections + Rt)
The basic renewal model consists of a sampler of two steps: Sample from Rt and then used that to sample the infections.
Default constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
latent_infections_rv
|
RandomVariable
|
Infections latent process (e.g., pyrenew.latent.Infections.). |
required |
gen_int_rv
|
RandomVariable
|
The generation interval. |
required |
I0_rv
|
RandomVariable
|
The initial infections. |
required |
Rt_process_rv
|
RandomVariable
|
The sample function of the process should return a tuple where the first element is the drawn Rt. |
required |
infection_obs_process_rv
|
RandomVariable
|
Infections observation process (e.g., pyrenew.observations.Poisson.). |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/model/rtinfectionsrenewalmodel.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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 |
|
sample
sample(
n_datapoints: int | None = None,
data_observed_infections: ArrayLike | None = None,
padding: int = 0,
**kwargs,
) -> RtInfectionsRenewalSample
Sample from the Basic Renewal Model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_datapoints
|
int | None
|
Number of timepoints to sample. |
None
|
data_observed_infections
|
ArrayLike | None
|
Observed infections. Defaults to None. |
None
|
padding
|
int
|
Number of padding timepoints to add to the beginning of the simulation. Defaults to 0. |
0
|
**kwargs
|
Additional keyword arguments passed through to internal sample() calls, if any |
{}
|
Notes
Either data_observed_infections
or n_datapoints
must be specified, not both.
Returns:
Type | Description |
---|---|
RtInfectionsRenewalSample
|
|
Source code in pyrenew/model/rtinfectionsrenewalmodel.py
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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
validate
staticmethod
validate(
gen_int_rv: any,
I0_rv: any,
latent_infections_rv: any,
infection_obs_process_rv: any,
Rt_process_rv: any,
) -> None
Verifies types and status (RV) of the generation interval, initial infections, latent and observed infections, and the Rt process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gen_int_rv
|
any
|
The generation interval. Expects RandomVariable. |
required |
I0_rv
|
any
|
The initial infections. Expects RandomVariable. |
required |
latent_infections_rv
|
any
|
Infections latent process. Expects RandomVariable. |
required |
infection_obs_process_rv
|
any
|
Infections observation process. Expects RandomVariable. |
required |
Rt_process_rv
|
any
|
The sample function of the process should return a tuple where the first element is the drawn Rt. Expects RandomVariable. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/model/rtinfectionsrenewalmodel.py
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 |
|