Model#
Hospital Admissions#
- class HospModelSample(Rt=None, latent_infections=None, infection_hosp_rate=None, latent_hosp_admissions=None, observed_hosp_admissions=None)[source]#
Bases:
NamedTuple
A container for holding the output from model.HospitalAdmissionsModel.sample().
- Parameters:
Rt (ArrayLike | None)
latent_infections (ArrayLike | None)
infection_hosp_rate (ArrayLike | None)
latent_hosp_admissions (ArrayLike | None)
observed_hosp_admissions (ArrayLike | None)
- 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: ArrayLike | None#
Alias for field number 0
- infection_hosp_rate: ArrayLike | None#
Alias for field number 2
- latent_hosp_admissions: ArrayLike | None#
Alias for field number 3
- latent_infections: ArrayLike | None#
Alias for field number 1
- observed_hosp_admissions: ArrayLike | 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.
- Parameters:
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)
- 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:
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.
- Parameters:
latent_infections_rv (RandomVariable)
gen_int_rv (RandomVariable)
I0_rv (RandomVariable)
Rt_process_rv (RandomVariable)
infection_obs_process_rv (RandomVariable)
- 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
- Return type:
Notes
Either data_observed_infections or n_datapoints must be specified, not both.
- Return type:
- Parameters:
- 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:
- class RtInfectionsRenewalSample(Rt=None, latent_infections=None, observed_infections=None)[source]#
Bases:
NamedTuple
A container for holding the output from model.RtInfectionsRenewalModel.sample().
- Parameters:
Rt (ArrayLike | None)
latent_infections (ArrayLike | None)
observed_infections (ArrayLike | None)
- 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: ArrayLike | None#
Alias for field number 0
- latent_infections: ArrayLike | None#
Alias for field number 1
- observed_infections: ArrayLike | None#
Alias for field number 2