Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial documentation of EpiAware and also sets documentation standard #85

Merged
merged 16 commits into from
Feb 29, 2024
4 changes: 3 additions & 1 deletion EpiAware/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.1.0-DEV"
[deps]
DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Expand All @@ -17,7 +18,9 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"

[compat]
DataFramesMeta = "0.14"
Distributions = "0.25"
DocStringExtensions = "0.9"
LinearAlgebra = "1.9"
SamuelBrand1 marked this conversation as resolved.
Show resolved Hide resolved
LogExpFunctions = "0.3"
Optim = "1.9"
Expand All @@ -27,5 +30,4 @@ Random = "1.9"
ReverseDiff = "1.15"
SparseArrays = "1.10"
Turing = "0.30"
DataFramesMeta = "0.14"
SamuelBrand1 marked this conversation as resolved.
Show resolved Hide resolved
julia = "1.9"
66 changes: 39 additions & 27 deletions EpiAware/src/EpiAware.jl
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
"""
EpiAware

This module provides functionality for calculating Rt (effective reproduction number) with and without
considering renewal processes.

# Dependencies

- Distributions: for working with probability distributions.
- Turing: for probabilistic programming.
- LogExpFunctions: for working with logarithmic, logistic and exponential functions.
- LinearAlgebra: for linear algebra operations.
- SparseArrays: for working with sparse arrays.
- Random: for generating random numbers.
- ReverseDiff: for automatic differentiation.
- Optim: for optimization algorithms.
- Zygote: for automatic differentiation.
module EpiAware

`EpiAware` provides functionality for fitting epidemiological models to data. It is built on
top of the `Turing` probabilistic programming language, and provides a set of utilities
for constructing and fitting models to data.

## Core model structure

An epidemiological model in `EpiAware` consists of composable structs with core abstract
types. The core types are:
1. `AbstractModel`: This overarching type is used to abstract `Turing` models and is inheried by the other abstract types we use.
2. `AbstractEpiModel`: Subtypes of this abstract type represent different models for the
spread of an infectious disease. Each model type has a corresponding
`make_epi_aware` function that constructs a `Turing` model for fitting the
model to data. Implemented concrete subtypes:
- `Renewal`: A renewal process model for the spread of an infectious disease.
- `ExpGrowthRate`: An exponential growth rate model for the spread of an infectious
disease.
- `DirectInfections`: A model for the spread of an infectious disease based on modelling
direct infections.
3. `AbstractLatentModel`: Subtypes of this abstract type represent different latent
processes that can be used in an epidemiological model. Implemented concrete subtype:
- `RandomWalk`: A random walk latent process.
4. `AbstractObservationModel`: Subtypes of this abstract type represent different
observation models that can be used in an epidemiological model.
Implemented concrete subtypes:
- `DelayObservation`: An observation process that models the delay between the time
of infection and the time of observation as a convolution, followed by a negative
binomial distributed sample.

## Imports

$(IMPORTS)

## Exports

$(EXPORTS)

"""
module EpiAware

using Distributions,
Turing,
LogExpFunctions,
LinearAlgebra,
SparseArrays,
Random,
ReverseDiff,
Optim,
Parameters,
QuadGK,
DataFramesMeta
using Distributions, Turing, LogExpFunctions, LinearAlgebra, SparseArrays, Random,
ReverseDiff, Optim, Parameters, QuadGK, DataFramesMeta, DocStringExtensions

# Exported utilities
export create_discrete_pmf, spread_draws, scan
Expand Down
1 change: 0 additions & 1 deletion EpiAware/test/predictive_checking/toy_model_log_infs_RW.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ In this case we use the `DirectInfections` model.

rwp = EpiAware.RandomWalk(Normal(),
truncated(Normal(0.0, 0.01), 0.0, 0.5))
obs_mdl = delay_observations_model()

#Define the observation model - no delay model
time_horizon = 100
Expand Down
Loading