An open API service indexing awesome lists of open source software.

https://github.com/epiverse-trace/epiparameter

R package with classes and helper functions for working with epidemiological parameters and access to a library of epidemiological parameters for infectious diseases
https://github.com/epiverse-trace/epiparameter

data-access data-package epidemiology epiverse probability-distribution r r-package

Last synced: 4 months ago
JSON representation

R package with classes and helper functions for working with epidemiological parameters and access to a library of epidemiological parameters for infectious diseases

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "75%",
fig.align = "center"
)
```

# epiparameter

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![R-CMD-check](https://github.com/epiverse-trace/epiparameter/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/epiverse-trace/epiparameter/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/epiverse-trace/epiparameter/branch/main/graph/badge.svg)](https://app.codecov.io/gh/epiverse-trace/epiparameter?branch=main)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11110881.svg)](https://doi.org/10.5281/zenodo.11110881)
[![CRAN status](https://www.r-pkg.org/badges/version/epiparameter)](https://CRAN.R-project.org/package=epiparameter)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/epiparameter)](https://cran.r-project.org/package=epiparameter)

`{epiparameter}` is an `R` package that contains a library of epidemiological parameters for infectious diseases as well as classes and helper functions to work with the data. It also includes functions to extract and convert parameters from reported summary statistics.

`{epiparameter}` is developed at the [Centre for the Mathematical Modelling of Infectious Diseases](https://www.lshtm.ac.uk/research/centres/centre-mathematical-modelling-infectious-diseases) at the [London School of Hygiene and Tropical Medicine](https://www.lshtm.ac.uk/) as part of [Epiverse-TRACE](https://data.org/initiatives/epiverse/).

## Installation

The package can be installed from CRAN using

```r
install.packages("epiparameter")
```

The development version of `{epiparameter}` can be installed from [GitHub](https://github.com/epiverse-trace/epiparameter) using the `{pak}` package:

``` r
# check whether {pak} is installed
if(!require("pak")) install.packages("pak")
pak::pak("epiverse-trace/epiparameter")
```

Alternatively, install pre-compiled binaries from [the Epiverse TRACE R-universe](https://epiverse-trace.r-universe.dev/epiparameter)

``` r
install.packages("epiparameter", repos = c("https://epiverse-trace.r-universe.dev", "https://cloud.r-project.org"))
```

## Quick start

```{r load-epiparameter}
library(epiparameter)
```

To load the library of epidemiological parameters into `R`:

```{r load-data}
epiparameters <- epiparameter_db()
epiparameters
```

This results in a list of database entries. Each entry of the library is an `` object.

Alternatively, the library of epiparameters can be viewed as a vignette locally (`vignette("database", package = "epiparameter")`) or on the [{epiparameter} website](https://epiverse-trace.github.io/epiparameter/articles/database.html).

The results can be filtered by disease and epidemiological distribution. Here we set `single_epiparameter = TRUE` as we only want a single database entry returned, and by default (`single_epiparameter = FALSE`) it will return all database entries that match the disease (`disease`) and epidemiological parameter (`epi_name`).

```{r load-single-epiparameter}
influenza_incubation <- epiparameter_db(
disease = "influenza",
epi_name = "incubation period",
single_epiparameter = TRUE
)
influenza_incubation
```

To quickly view the list of epidemiological distributions returned by `epiparameter_db()` in a table, the `parameter_tbl()` gives a summary of the data, and offers the ability to subset you data by `disease`, `pathogen` and epidemiological parameter (`epi_name`).

```{r parameter-tbl}
parameter_tbl(epiparameters)
parameter_tbl(
epiparameters,
epi_name = "onset to hospitalisation"
)
```

The `` object can be plotted.

```{r plot-epiparameter}
plot(influenza_incubation)
```

The CDF can also be plotted by setting `cumulative = TRUE`.

```{r, plot-epiparameter-cdf}
plot(influenza_incubation, cumulative = TRUE)
```

### Parameter conversion and extraction

The parameters of a distribution can be converted to and from mean and standard deviation. In `{epiparameter}` we implement this for a variety of distributions:

- gamma
- lognormal
- Weibull
- negative binomial
- geometric

The parameters of a probability distribution can also be extracted from other summary statistics, for example, percentiles of the distribution, or the median and range of the data. This can be done for:

- gamma
- lognormal
- Weibull
- normal

## Contributing to library of epidemiological parameters

The library of epidemiological parameters that can be loaded by `{epiparameter}` using the `epiparameter_db()` function is stored in the [`{epiparameterDB}` R package](https://github.com/epiverse-trace/epiparameterDB). If you would like to contribute to the library of epiparameters you can either:

1. Add data to a public [google sheet](https://docs.google.com/spreadsheets/d/1eCL3n_woseg5Npu7XD7TcuNoLUIhMBu8ZoLCkVdATUE/edit?usp=sharing). This spreadsheet contains two example entries as a guide to what fields are accepted. We are monitoring this sheet for new entries that will subsequently be included in the package.

2. Add to the [JSON file holding the database](https://github.com/epiverse-trace/epiparameterDB/blob/main/inst/extdata/parameters.json) directly via a Pull Request. See the [contributing guide](https://github.com/epiverse-trace/.github/blob/main/CONTRIBUTING.md) for instructions.

You can find a description of the epidemiological parameter data structure and contents in the [data dictionary](https://github.com/epiverse-trace/epiparameterDB/blob/main/inst/extdata/data_dictionary.json). This documents the valid format and data types to ensure consistency and accuracy. All entries in the parameter library are automatically validated against the data dictionary using an GitHub action workflow.

## Help

To report a bug please open an [issue](https://github.com/epiverse-trace/epiparameter/issues/new/choose)

## Contribute

Contributions to `{epiparameter}` are welcomed. [package contributing guide](https://github.com/epiverse-trace/.github/blob/main/CONTRIBUTING.md).

## Code of Conduct

Please note that the `{epiparameter}` project is released with a [Contributor Code of Conduct](https://github.com/epiverse-trace/.github/blob/main/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.

## Citing this package

```{r message=FALSE, warning=FALSE}
citation("epiparameter")
```