Forecasting

Forecasting with the inferred parameters, error bars and, if there are latent variables, inferred initial conditions.

SIR

class pyross.forecast.SIR

Susceptible, Infected, Removed (SIR) Ia: asymptomatic Is: symptomatic

Parameters:
  • parameters (dict) –
    Contains the following keys:
    alpha: float
    Estimate mean value of fraction of infected who are asymptomatic.
    beta: float
    Estimate mean value of rate of spread of infection.
    gIa: float
    Estimate mean value of rate of removal from asymptomatic individuals.
    gIs: float
    Estimate mean value of rate of removal from symptomatic individuals.
    fsa: float
    fraction by which symptomatic individuals do not self-isolate.
    cov: np.array( )
    covariance matrix for all the estimated parameters.
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(3*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • S0 (np.array(M,)) – Initial number of susceptables.
  • Ia0 (np.array(M,)) – Initial number of asymptomatic infectives.
  • Is0 (np.array(M,)) – Initial number of symptomatic infectives.
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float, optional) – Final time of integrator. The default is 100.
  • Nf (Int, optional) – Number of time points to evaluate.The default is 101,
  • Ns (int, optional) – Number of samples of parameters to take. The default is 1000.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) –
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories.

Return type:

dict

SIR_latent

class pyross.forecast.SIR_latent

Susceptible, Infected, Removed (SIR) Ia: asymptomatic Is: symptomatic

Latent inference class to be used when observed data is incomplete. …

Parameters:
  • parameters (dict) –
    Contains the following keys:
    alpha: float
    Estimate mean value of fraction of infected who are asymptomatic.
    beta: float
    Estimate mean value of rate of spread of infection.
    gIa: float
    Estimate mean value of rate of removal from asymptomatic individuals.
    gIs: float
    Estimate mean value of rate of removal from symptomatic individuals.
    fsa: float
    fraction by which symptomatic individuals do not self-isolate.
    cov: np.array( )
    Covariance matrix for all the estimated parameters.
    S0: np.array(M,)
    Estimate initial number of susceptables.
    Ia0: np.array(M,)
    Estimate initial number of asymptomatic infectives.
    Is0: np.array(M,)
    Estimate initial number of symptomatic infectives.
    cov_init : np.array((3*M, 3*M)) :
    Covariance matrix for the initial state.
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(3*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float) – Final time of integrator.
  • Nf (Int) – Number of time points to evaluate.
  • Ns (int) – Number of samples of parameters to take.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) – TODO
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories. sample_inits : List of initial state vectors tried.

Return type:

dict

SEIR

class pyross.forecast.SEIR

Susceptible, Exposed, Infected, Removed (SEIR) Ia: asymptomatic Is: symptomatic :param parameters:

Contains the following keys:
alpha: float
Estimate mean value of fraction of infected who are asymptomatic.
beta: float
Estimate mean value of rate of spread of infection.
gIa: float
Estimate mean value of rate of removal from asymptomatic individuals.
gIs: float
Estimate mean value of rate of removal from symptomatic individuals.
fsa: float
fraction by which symptomatic individuals do not self-isolate.
gE: float
Estimated mean value of rate of removal from exposed individuals.
cov: np.array( )
covariance matrix for all the estimated parameters.
Parameters:
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(4*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • S0 (np.array(M,)) – Initial number of susceptables.
  • E0 (np.array(M,)) – Initial number of exposed.
  • Ia0 (np.array(M,)) – Initial number of asymptomatic infectives.
  • Is0 (np.array(M,)) – Initial number of symptomatic infectives.
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float, optional) – Final time of integrator. The default is 100.
  • Nf (Int, optional) – Number of time points to evaluate.The default is 101,
  • Ns (int, optional) – Number of samples of parameters to take. The default is 1000.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) –
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories.

Return type:

dict

SEIR_latent

class pyross.forecast.SEIR_latent

Susceptible, Exposed, Infected, Removed (SEIR) Ia: asymptomatic Is: symptomatic

Latent inference class to be used when observed data is incomplete.

Parameters:
  • parameters (dict) –
    Contains the following keys:
    alpha: float
    Estimate mean value of fraction of infected who are asymptomatic.
    beta: float
    Estimate mean value of rate of spread of infection.
    gIa: float
    Estimate mean value of rate of removal from asymptomatic individuals.
    gIs: float
    Estimate mean value of rate of removal from symptomatic individuals.
    fsa: float
    fraction by which symptomatic individuals do not self-isolate.
    gE: float
    Estimated mean value of rate of removal from exposed individuals.
    cov: np.array( )
    covariance matrix for all the estimated parameters.
    S0: np.array(M,)
    Estimate initial number of susceptables.
    E0: np.array(M,)
    Estimate initial number of exposed.
    Ia0: np.array(M,)
    Estimate initial number of asymptomatic infectives.
    Is0: np.array(M,)
    Estimate initial number of symptomatic infectives.
    cov_init : np.array((3*M, 3*M)) :
    Covariance matrix for the initial state.
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(4*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float, optional) – Final time of integrator. The default is 100.
  • Nf (Int, optional) – Number of time points to evaluate.The default is 101,
  • Ns (int, optional) – Number of samples of parameters to take. The default is 1000.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) –
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories. sample_inits : List of initial state vectors tried.

Return type:

dict

SEAIRQ

class pyross.forecast.SEAIRQ

Susceptible, Exposed, Infected, Removed (SEIR) Ia: asymptomatic Is: symptomatic A: Asymptomatic and infectious :param parameters:

Contains the following keys:
alpha: float
Estimate mean value of fraction of infected who are asymptomatic.
beta: float
Estimate mean value of rate of spread of infection.
gIa: float
Estimate mean value of rate of removal from asymptomatic individuals.
gIs: float
Estimate mean value of rate of removal from symptomatic individuals.
fsa: float
fraction by which symptomatic individuals do not self-isolate.
gE: float
Estimated mean value of rate of removal from exposed individuals.
gA: float
Estimated mean value of rate of removal from activated individuals.
cov: np.array( )
covariance matrix for all the estimated parameters.
tE : float
testing rate and contact tracing of exposeds
tA : float
testing rate and contact tracing of activateds
tIa: float
testing rate and contact tracing of asymptomatics
tIs: float
testing rate and contact tracing of symptomatics
Parameters:
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(4*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • S0 (np.array) – Initial number of susceptables.
  • E0 (np.array) – Initial number of exposeds.
  • A0 (np.array) – Initial number of activateds.
  • Ia0 (np.array) – Initial number of asymptomatic infectives.
  • Is0 (np.array) – Initial number of symptomatic infectives.
  • Q0 (np.array) – Initial number of quarantineds.
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float, optional) – Final time of integrator. The default is 100.
  • Nf (Int, optional) – Number of time points to evaluate.The default is 101,
  • Ns (int, optional) – Number of samples of parameters to take. The default is 1000.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) –
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories.

Return type:

dict

SEAIRQ_latent

class pyross.forecast.SEAIRQ_latent

Susceptible, Exposed, Infected, Removed (SEIR) Ia: asymptomatic Is: symptomatic A: Asymptomatic and infectious

Latent inference class to be used when observed data is incomplete. :param parameters:

Contains the following keys:
alpha: float
Estimate mean value of fraction of infected who are asymptomatic.
beta: float
Estimate mean value of rate of spread of infection.
gIa: float
Estimate mean value of rate of removal from asymptomatic individuals.
gIs: float
Estimate mean value of rate of removal from symptomatic individuals.
fsa: float
fraction by which symptomatic individuals do not self-isolate.
gE: float
Estimated mean value of rate of removal from exposed individuals.
gA: float
Estimated mean value of rate of removal from activated individuals.
cov: np.array( )
covariance matrix for all the estimated parameters.
tE : float
testing rate and contact tracing of exposeds
tA : float
testing rate and contact tracing of activateds
tIa: float
testing rate and contact tracing of asymptomatics
tIs: float
testing rate and contact tracing of symptomatics
S0: np.array(M,)
Estimate initial number of susceptables.
E0: np.array(M,)
Estimate initial number of exposed.
A0: np.array(M,)
Estimate initial number of activated.
Ia0: np.array(M,)
Estimate initial number of asymptomatic infectives.
Is0: np.array(M,)
Estimate initial number of symptomatic infectives.
Q0: np.array(M,)
Estimate initial number of quarantined.
cov_init : np.array((3*M, 3*M)) :
Covariance matrix for the initial state.
Parameters:
  • M (int) – Number of compartments of individual for each class. I.e len(contactMatrix)
  • Ni (np.array(4*M, )) – Initial number in each compartment and class
simulate()
simulate()
Parameters:
  • contactMatrix (python function(t), optional) – The social contact matrix C_{ij} denotes the average number of contacts made per day by an individual in class i with an individual in class j The default is None.
  • Tf (float, optional) – Final time of integrator. The default is 100.
  • Nf (Int, optional) – Number of time points to evaluate.The default is 101,
  • Ns (int, optional) – Number of samples of parameters to take. The default is 1000.
  • nc (int, optional) –
  • epsilon (np.float64, optional) – Acceptable error in leap. The default is 0.03.
  • tau_update_frequency (int, optional) –
  • verbose (bool, optional) – Verbosity of output. The default is False.
  • Ti (float, optional) – Start time of integrator. The default is 0.
  • method (str, optional) – Pyross integrator to use. The default is “deterministic”.
  • events (list of python functions, optional) – List of events that the current state can satisfy to change behaviour of the contact matrix. Event occurs when the value of the function changes sign. Event.direction determines which direction triggers the event, takign values {+1,-1}. The default is [].
  • contactMatricies (list of python functions) – New contact matrix after the corresponding event occurs The default is [].
  • events_repeat (bool, optional) – Wheither events is periodic in time. The default is false.
  • events_subsequent (bool, optional) – TODO
Returns:

out_dict

Dictionary containing the following keys:
X: list

List of resultant trajectories

t: list

List of times at which X is evaluated.

X_mean : list

Mean trajectory of X

X_std : list

Standard devation of trajectories of X at each time point.

<init params> : Initial parameters passed at object instantiation. sample_parameters : list of parameters sampled to make trajectories. sample_inits : List of initial state vectors tried.

Return type:

dict