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
EpiAware.EpiAwareBaseEpiAware.EpiAwareBase.AbstractAccumulationStepEpiAware.EpiAwareBase.AbstractBroadcastRuleEpiAware.EpiAwareBase.AbstractEpiMethodEpiAware.EpiAwareBase.AbstractEpiModelEpiAware.EpiAwareBase.AbstractEpiOptMethodEpiAware.EpiAwareBase.AbstractEpiProblemEpiAware.EpiAwareBase.AbstractEpiSamplingMethodEpiAware.EpiAwareBase.AbstractLatentModelEpiAware.EpiAwareBase.AbstractObservationModelEpiAware.EpiAwareBase.AbstractTuringEpiModelEpiAware.EpiAwareBase.AbstractTuringInterceptEpiAware.EpiAwareBase.AbstractTuringLatentModelEpiAware.EpiAwareBase.AbstractTuringObservationErrorModelEpiAware.EpiAwareBase.AbstractTuringObservationModelEpiAware.EpiAwareBase.AbstractTuringRenewalEpiAware.EpiAwareBase.EpiAwareObservablesEpiAware.EpiAwareBase.EpiMethodEpiAware.EpiAwareBase.EpiProblemEpiAware.EpiAwareBase._apply_methodEpiAware.EpiAwareBase.apply_methodEpiAware.EpiAwareBase.apply_methodEpiAware.EpiAwareBase.apply_methodEpiAware.EpiAwareBase.broadcast_nEpiAware.EpiAwareBase.broadcast_ruleEpiAware.EpiAwareBase.condition_modelEpiAware.EpiAwareBase.generate_epiawareEpiAware.EpiAwareBase.generate_epiawareEpiAware.EpiAwareBase.generate_latentEpiAware.EpiAwareBase.generate_latent_infsEpiAware.EpiAwareBase.generate_observationsEpiAware.EpiAwareBase.generated_observables
Public API
EpiAware.EpiAwareBase — ModuleModule for defining abstract epidemiological types.
EpiAware.EpiAwareBase.AbstractAccumulationStep — Typeabstract type AbstractAccumulationStepAbstract type for all accumulation steps
Fields
EpiAware.EpiAwareBase.AbstractBroadcastRule — Typeabstract type AbstractBroadcastRuleAn abstract type representing a broadcast rule.
Fields
EpiAware.EpiAwareBase.AbstractEpiMethod — Typeabstract type AbstractEpiMethodAbstract supertype for all EpiAware inference/generative modelling methods.
Fields
EpiAware.EpiAwareBase.AbstractEpiModel — Typeabstract type AbstractEpiModel <: AbstractModelThe abstract supertype for all structs that define a model for generating unobserved/latent infections.
Fields
EpiAware.EpiAwareBase.AbstractEpiOptMethod — Typeabstract type AbstractEpiOptMethod <: AbstractEpiMethodAbstract supertype for infence/generative methods that are based on optimization, e.g. MAP estimation or variational inference.
Fields
EpiAware.EpiAwareBase.AbstractEpiProblem — Typeabstract type AbstractEpiProblemAbstract supertype for all EpiAware problems.
Fields
EpiAware.EpiAwareBase.AbstractEpiSamplingMethod — Typeabstract type AbstractEpiSamplingMethod <: AbstractEpiMethodAbstract supertype for infence/generative methods that are based on sampling from the posterior distribution, e.g. NUTS.
Fields
EpiAware.EpiAwareBase.AbstractLatentModel — Typeabstract type AbstractLatentModel <: AbstractModelThe abstract supertype for all structs that define a model for generating a latent process used in EpiAware models.
Fields
EpiAware.EpiAwareBase.AbstractObservationModel — Typeabstract type AbstractObservationModel <: AbstractModelA type representing an abstract observation model that is a subtype of AbstractModel.
Fields
EpiAware.EpiAwareBase.AbstractTuringEpiModel — Typeabstract type AbstractTuringEpiModel <: AbstractEpiModelA abstract type representing a Turing-based epidemiological model.
Fields
EpiAware.EpiAwareBase.AbstractTuringIntercept — Typeabstract type AbstractTuringIntercept <: AbstractTuringLatentModelA abstract type used to define the common interface for intercept models.
Fields
EpiAware.EpiAwareBase.AbstractTuringLatentModel — Typeabstract type AbstractTuringLatentModel <: AbstractLatentModelA abstract type representing a Turing-based Latent model.
Fields
EpiAware.EpiAwareBase.AbstractTuringObservationErrorModel — Typeabstract type AbstractTuringObservationErrorModel <: AbstractTuringObservationModelThe abstract supertype for all structs that defines a Turing-based model for generating observation errors.
Fields
EpiAware.EpiAwareBase.AbstractTuringObservationModel — Typeabstract type AbstractTuringObservationModel <: AbstractObservationModelA abstract type representing a Turing-based observation model.
Fields
EpiAware.EpiAwareBase.AbstractTuringRenewal — Typeabstract type AbstractTuringRenewal <: AbstractTuringEpiModelAbstract type for all Turing-based Renewal infection generating models.
Fields
EpiAware.EpiAwareBase.EpiAwareObservables — Typestruct EpiAwareObservablesThe 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::Anydata::Anysamples::Anygenerated::Any
EpiAware.EpiAwareBase.EpiMethod — Typestruct EpiMethod{O<:AbstractEpiOptMethod, S<:AbstractEpiSamplingMethod} <: AbstractEpiMethodEpiMethod 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.
EpiAware.EpiAwareBase.EpiProblem — Typestruct EpiProblem{E<:AbstractEpiModel, L<:AbstractLatentModel, O<:AbstractObservationModel} <: AbstractEpiProblemDefines 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.
EpiAware.EpiAwareBase._apply_method — Function_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 givenmethod.
EpiAware.EpiAwareBase.apply_method — Methodapply_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 theapply_methodfunction.kwargs: Optional keyword arguments to pass to theapply_methodfunction.
Returns
The generated observables computed from the solution.
EpiAware.EpiAwareBase.apply_method — Methodapply_method(
model,
method;
kwargs...
) -> EpiAwareObservables
Calls wrap_apply_method setting the data argument to nothing.
EpiAware.EpiAwareBase.apply_method — Methodapply_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: AnEpiProblemobject specifying the epidemiological problem.method::EpiMethod: AnEpiMethodobject specifying the inference method.data: The observed data used for inference.
Keyword Arguments
fix_parameters::NamedTuple: ANamedTupleof fixed parameters for the model.condition_parameters::NamedTuple: ANamedTupleof conditioned parameters for the model.kwargs...: Additional keyword arguments passed to the inference methods.
Returns
- A
NamedTuplewith asamplesfield which is the output of applying methods and amodelfield with the model used. Optionally, agensfield with the generated quantities from the model if that makes sense with the inference method.
EpiAware.EpiAwareBase.broadcast_n — Methodbroadcast_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.
EpiAware.EpiAwareBase.broadcast_rule — Methodbroadcast_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.
EpiAware.EpiAwareBase.condition_model — Methodcondition_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.
EpiAware.EpiAwareBase.generate_epiaware — Methodgenerate_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
EpiAware.EpiAwareBase.generate_epiaware — Methodgenerate_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.
EpiAware.EpiAwareBase.generate_latent — Methodgenerate_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.
EpiAware.EpiAwareBase.generate_latent_infs — Methodgenerate_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.
EpiAware.EpiAwareBase.generate_observations — Methodgenerate_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.
EpiAware.EpiAwareBase.generated_observables — Methodgenerated_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