Public Documentation

Documentation for EpiAwareBae.jl's public interface.

See the Internals section of the manual for internal package docs covering all submodules.

Contents

Index

Public API

EpiAware.EpiAwareBase.AbstractEpiOptMethodType
abstract type AbstractEpiOptMethod <: AbstractEpiMethod

Abstract supertype for infence/generative methods that are based on optimization, e.g. MAP estimation or variational inference.


Fields

source
EpiAware.EpiAwareBase.EpiAwareObservablesType
struct EpiAwareObservables

The EpiAwareObservables struct represents the observables used in the EpiAware model.

Fields

  • model: The model used for the observables.
  • data: The data used for the observables.
  • samples: Samples from the posterior distribution.
  • generated: The generated observables.

Fields

  • model::Any

  • data::Any

  • samples::Any

  • generated::Any

source
EpiAware.EpiAwareBase.EpiMethodType
struct EpiMethod{O<:AbstractEpiOptMethod, S<:AbstractEpiSamplingMethod} <: AbstractEpiMethod

EpiMethod represents a method for performing EpiAware inference and/or generative modelling, which combines a sequence of optimization steps to pass initialisation information to a sampler method.


Fields

  • pre_sampler_steps::Vector{O} where O<:AbstractEpiOptMethod: Pre-sampler optimization steps.

  • sampler::AbstractEpiSamplingMethod: Sampler method.

source
EpiAware.EpiAwareBase.EpiProblemType
struct EpiProblem{E<:AbstractEpiModel, L<:AbstractLatentModel, O<:AbstractObservationModel} <: AbstractEpiProblem

Defines an inference/generative modelling problem for case data.

EpiProblem wraps the underlying components of an epidemiological model:

  • epi_model: An epidemiological model for unobserved infections.
  • latent_model: A latent model for underlying latent process.
  • observation_model: An observation model for observed cases.

Along with a tspan tuple for the time span of the case data.


Fields

  • epi_model::AbstractEpiModel: Epidemiological model for unobserved infections.

  • latent_model::AbstractLatentModel: Latent model for underlying latent process.

  • observation_model::AbstractObservationModel: Observation model for observed cases.

  • tspan::Tuple{Int64, Int64}: Time span for either inference or generative modelling of case time series.

source
EpiAware.EpiAwareBase._apply_methodFunction
_apply_method(
    model::AbstractEpiModel,
    method::AbstractEpiMethod;
    ...
)
_apply_method(
    model::AbstractEpiModel,
    method::AbstractEpiMethod,
    prev_result;
    kwargs...
)

Apply the inference/generative method method to the AbstractEpiModel object mdl.

Arguments

  • model::AbstractEpiModel: The model to apply the method to.
  • method::AbstractEpiMethod: The epidemiological method to apply.
  • prev_result: The previous result of the method.
  • kwargs: Additional keyword arguments passed to the method.

Returns

  • nothing: If no concrete implementation is defined for the given method.
source
EpiAware.EpiAwareBase.apply_methodMethod
apply_method(
    model,
    method,
    data;
    kwargs...
) -> EpiAwareObservables

Wrap the _apply_method function by calling it with the given model, method, data, and optional keyword arguments (kwargs). The resulting solution is then passed to the generated_observables function, along with the model and input data, to compute the generated observables.

Arguments

  • model: The model to apply the method to.
  • method: The method to apply to the model.
  • data: The data to pass to the apply_method function.
  • kwargs: Optional keyword arguments to pass to the apply_method function.

Returns

The generated observables computed from the solution.

source
EpiAware.EpiAwareBase.apply_methodMethod
apply_method(
    epiproblem::EpiProblem,
    method::AbstractEpiMethod,
    data;
    fix_parameters,
    condition_parameters,
    kwargs...
) -> EpiAwareObservables

Run the EpiAware algorithm to estimate the parameters of an epidemiological model.

Arguments

  • epiproblem::EpiProblem: An EpiProblem object specifying the epidemiological problem.
  • method::EpiMethod: An EpiMethod object specifying the inference method.
  • data: The observed data used for inference.

Keyword Arguments

  • fix_parameters::NamedTuple: A NamedTuple of fixed parameters for the model.
  • condition_parameters::NamedTuple: A NamedTuple of conditioned parameters for the model.
  • kwargs...: Additional keyword arguments passed to the inference methods.

Returns

  • A NamedTuple with a samples field which is the output of applying methods and a model field with the model used. Optionally, a gens field with the generated quantities from the model if that makes sense with the inference method.
source
EpiAware.EpiAwareBase.broadcast_nMethod
broadcast_n(
    broadcast_rule::AbstractBroadcastRule,
    latent,
    n,
    period
)

This function is used to define the behavior of broadcasting for a specific type of AbstractBroadcastRule.

The broadcast_n function returns the length of the latent periods to generate using the given broadcast_rule. Which model of broadcasting to be implemented is set by the type of broadcast_rule. If no implemention is defined for the given broadcast_rule, then EpiAware will return a warning and return nothing.

source
EpiAware.EpiAwareBase.broadcast_ruleMethod
broadcast_rule(
    broadcast_rule::AbstractBroadcastRule,
    n,
    period
)

This function is used to define the behavior of broadcasting for a specific type of AbstractBroadcastRule.

The broadcast_rule function implements a model of broadcasting a latent process. Which model of broadcasting to be implemented is set by the type of broadcast_rule. If no implemention is defined for the given broadcast_rule, then EpiAware will return a warning and return nothing.

source
EpiAware.EpiAwareBase.condition_modelMethod
condition_model(
    model,
    fix_parameters,
    condition_parameters
) -> Any

Condition a model on fixed (i.e to a value) and conditioned (i.e to data) parameters.

Returns

  • model: The conditioned model.
source
EpiAware.EpiAwareBase.generate_epiawareMethod
generate_epiaware(
    y_t,
    time_step,
    epi_model::AbstractEpiModel,
    latent_model::AbstractLatentModel,
    observation_model::AbstractObservationModel
)

Create an epi-aware model using the specified epimodel, latentmodel, and observation_model.

Arguments

  • y_t: The observed data.
  • time_steps: The time steps.
  • epi_model: An abstract epi model.
  • latent_model: An abstract latent model.
  • observation_model: An abstract observation model.

Returns

  • nothing
source
EpiAware.EpiAwareBase.generate_epiawareMethod
generate_epiaware(epiproblem::EpiProblem, data) -> Any

Generate an epi-aware model given an EpiProblem and data.

Arguments

  • epiproblem: Epi problem specification.
  • data: Observed data.

Returns

A tuple containing the generated quantities of the epi-aware model.

source
EpiAware.EpiAwareBase.generate_latentMethod
generate_latent(latent_model::AbstractLatentModel, n) -> Any

Constructor function for a latent process path $Z_t$ of length n.

The generate_latent function implements a model of generating a latent process. Which model for generating the latent process infections is implemented is set by the type of latent_model. If no implemention is defined for the type of latent_model, then EpiAware will pass a warning and return nothing.

Interface to Turing.jl probablilistic programming language (PPL)

Apart from the no implementation fallback method, the generate_latent implementation function should return a constructor function for a DynamicPPL.Model object. Sample paths of $Z_t$ are generated quantities of the constructed model. Priors for model parameters are fields of epi_model.

source
EpiAware.EpiAwareBase.generate_latent_infsMethod
generate_latent_infs(
    epi_model::AbstractEpiModel,
    Z_t
) -> Any

Constructor function for unobserved/latent infections based on the type of epi_model <: AbstractEpimodel and a latent process path $Z_t$.

The generate_latent_infs function implements a model of generating unobserved/latent infections conditional on a latent process. Which model of generating unobserved/latent infections to be implemented is set by the type of epi_model. If no implemention is defined for the given epi_model, then EpiAware will return a warning and return nothing.

Interface to Turing.jl probablilistic programming language (PPL)

Apart from the no implementation fallback method, the generate_latent_infs implementation function returns a constructor function for a DynamicPPL.Model object where the unobserved/latent infections are a generated quantity. Priors for model parameters are fields of epi_model.

source
EpiAware.EpiAwareBase.generate_observationsMethod
generate_observations(
    obs_model::AbstractObservationModel,
    y_t,
    Y_t
) -> Any

Constructor function for generating observations based on the given observation model.

The generate_observations function implements a model of generating observations based on the given observation model. Which model of generating observations to be implemented is set by the type of obs_model. If no implemention is defined for the given obs_model, then EpiAware will return a warning and return nothing.

source
EpiAware.EpiAwareBase.generated_observablesMethod
generated_observables(
    model,
    data,
    solution
) -> EpiAwareObservables

Generate observables from a given model and solution and return them as a EpiAwareObservables struct.

Arguments

  • model: The model used for generating observables.
  • data: The data used for generating observables.
  • solution: The solution used for generating observables.

Returns

An instance of EpiAwareObservables struct with the provided model, data, solution, and the generated observables if specified

source