Model#
Hospital Admissions#
- class HospModelSample(Rt: ArrayLike | None = None, latent_infections: ArrayLike | None = None, infection_hosp_rate: ArrayLike | None = None, latent_hosp_admissions: ArrayLike | None = None, observed_hosp_admissions: ArrayLike | None = None)[source]#
Bases:
NamedTuple
A container for holding the output from model.HospitalAdmissionsModel.sample().
- Rt#
The reproduction number over time. Defaults to None.
- Type:
ArrayLike | None, optional
- latent_infections#
The estimated number of new infections over time. Defaults to None.
- Type:
ArrayLike | None, optional
- infection_hosp_rate#
The infected hospitalization rate. Defaults to None.
- Type:
ArrayLike | None, optional
- latent_hosp_admissions#
The estimated latent hospitalizations. Defaults to None.
- Type:
ArrayLike | None, optional
- observed_hosp_admissions#
The sampled or observed hospital admissions. Defaults to None.
- Type:
ArrayLike | None, optional
-
Rt:
Union
[Array
,ndarray
,bool
,number
,bool
,int
,float
,complex
,None
]# Alias for field number 0
-
infection_hosp_rate:
Union
[Array
,ndarray
,bool
,number
,bool
,int
,float
,complex
,None
]# Alias for field number 2
-
latent_hosp_admissions:
Union
[Array
,ndarray
,bool
,number
,bool
,int
,float
,complex
,None
]# Alias for field number 3
-
latent_infections:
Union
[Array
,ndarray
,bool
,number
,bool
,int
,float
,complex
,None
]# Alias for field number 1
-
observed_hosp_admissions:
Union
[Array
,ndarray
,bool
,number
,bool
,int
,float
,complex
,None
]# Alias for field number 4
- class HospitalAdmissionsModel(latent_hosp_admissions_rv, latent_infections_rv, gen_int_rv, I0_rv, Rt_process_rv, hosp_admission_obs_process_rv)[source]#
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.
- sample(n_datapoints=None, data_observed_hosp_admissions=None, padding=0, **kwargs)[source]#
Sample from the HospitalAdmissions model
- Parameters:
n_datapoints (int, optional) – Number of timepoints to sample (passed to the basic renewal model).
data_observed_hosp_admissions (ArrayLike, optional) – The observed hospitalization data (passed to the basic renewal model). Defaults to None (simulation, rather than fit).
padding (int, optional) – Number of padding timepoints to add to the beginning of the simulation. Defaults to 0.
**kwargs (dict, optional) – Additional keyword arguments passed through to internal sample() calls, should there be any.
- Return type:
See also
basic_renewal.sample
For sampling the basic renewal model
sample_observed_admissions
For sampling observed hospital admissions
- static validate(latent_hosp_admissions_rv, hosp_admission_obs_process_rv)[source]#
Verifies types and status (RV) of latent and observed hospital admissions
- Parameters:
latent_hosp_admissions_rv (RandomVariable) – The latent process for the hospital admissions.
hosp_admission_obs_process_rv (RandomVariable) – The observed hospital admissions.
- Return type:
None
Reproduction Number Renewal Infections#
- class RtInfectionsRenewalModel(latent_infections_rv, gen_int_rv, I0_rv, Rt_process_rv, infection_obs_process_rv=None)[source]#
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.
- sample(n_datapoints=None, data_observed_infections=None, padding=0, **kwargs)[source]#
Sample from the Basic Renewal Model
- Parameters:
n_datapoints (int, optional) – Number of timepoints to sample.
data_observed_infections (ArrayLike | None, optional) – Observed infections. Defaults to None.
padding (int, optional) – Number of padding timepoints to add to the beginning of the simulation. Defaults to 0.
**kwargs (dict, optional) – Additional keyword arguments passed through to internal sample() calls, if any
Notes
Either data_observed_infections or n_datapoints must be specified, not both.
- Return type:
- static validate(gen_int_rv, I0_rv, latent_infections_rv, infection_obs_process_rv, Rt_process_rv)[source]#
Verifies types and status (RV) of the generation interval, initial infections, latent and observed infections, and the Rt process.
- Parameters:
gen_int_rv (any) – The generation interval. Expects RandomVariable.
I0_rv (any) – The initial infections. Expects RandomVariable.
latent_infections_rv (any) – Infections latent process. Expects RandomVariable.
infection_obs_process_rv (any) – Infections observation process. Expects RandomVariable.
Rt_process_rv (any) – The sample function of the process should return a tuple where the first element is the drawn Rt. Expects RandomVariable.
- Return type:
None
- class RtInfectionsRenewalSample(Rt: ArrayLike | None = None, latent_infections: ArrayLike | None = None, observed_infections: ArrayLike | None = None)[source]#
Bases:
NamedTuple
A container for holding the output from model.RtInfectionsRenewalModel.sample().
- Rt#
The reproduction number over time. Defaults to None.
- Type:
ArrayLike | None, optional
- latent_infections#
The estimated latent infections. Defaults to None.
- Type:
ArrayLike | None, optional
- observed_infections#
The sampled infections. Defaults to None.
- Type:
ArrayLike | None, optional
-
Rt:
Union
[Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
],None
]# Alias for field number 0
-
latent_infections:
Union
[Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
],None
]# Alias for field number 1
-
observed_infections:
Union
[Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
],None
]# Alias for field number 2