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

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

[SUSPENDED] Toolbox of model fitting helper functions
https://github.com/epiverse-trace/quickfit

distributions likelihood mle r r-package

Last synced: 3 months ago
JSON representation

[SUSPENDED] Toolbox of model fitting helper functions

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 = "100%"
)
```

# _quickfit_: Toolbox of model fitting helper functions

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![R-CMD-check](https://github.com/{{ gh_repo }}/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/{{ gh_repo }}/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/{{ gh_repo }}/branch/main/graph/badge.svg)](https://app.codecov.io/gh/{{ gh_repo }}?branch=main)
[![Project Status: Suspended – Initial development has started, but there has not yet been a stable, usable release; work has been stopped for the time being but the author(s) intend on resuming work.](https://www.repostatus.org/badges/latest/suspended.svg)](https://www.repostatus.org/#suspended)

`{quickfit}` was intended to be an `R` package to help with simple model fitting tasks in epidemiology and as a central place to store helper functions used in Epiverse-TRACE.

The development of `{quickfit}` has been **suspended** it is no longer considered necessary to have a dedicated package within Epiverse-TRACE to conduct model fitting, and helper functions will remain in the package they were developed in and shared/copied directly across packages rather than requiring taking on a dependency to import them. Development may resume if the need for a utility package becomes apparent.

`{quickfit}` was 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 as part of the [Epiverse Initiative](https://data.org/initiatives/epiverse/).

## Installation

You can install the development version of {{ packagename }} from
[GitHub](https://github.com/) with:

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

## Quick start

**The examples below show the existing functionality; this is not currently planned to be developed further.**

These examples illustrate some of the current functionalities:

```{r}
library(quickfit)
```

Generate some simulated data, define a likelihood, then estimate MLE,
or MLE and 95% confidence interval based on profile likelihood:

```{r}
sim_data <- rnorm(50, 4, 2)

# Define likelihood function
log_l <- function(x,a,b) dnorm(x, a, b, log = TRUE)

# Estimate MLE
estimate_mle(log_l, sim_data, n_param = 2, a_initial = 3, b_initial = 1)

# Estimate 95% CI based on profile likelihood
calculate_profile(
log_l,
data_in = sim_data,
n_param = 2,
a_initial = 3,
b_initial = 1,
precision = 0.01
)
```

Additionally, multiple distribution models can be compared (for censored and
non-censored data).

```{r}
multi_fitdist(
data = rlnorm(n = 100, meanlog = 1, sdlog = 1),
models = c("lnorm", "gamma", "weibull"),
func = fitdistrplus::fitdist
)
```

## Help

To report a bug please open an [issue](https://github.com/epiverse-trace/quickfit/issues/new/choose); please note that development on `{quickfit}` has been suspended, therefore it is not guaranteed that all issues will be responded to.

### Contributions

Contributions are welcome via [pull requests](https://github.com/{{ gh_repo }}/pulls).

Development on `{quickfit}` has been suspended.

However, if you think this package could be developed for a specific use case then contributions are very welcome as issues, or on the main [Epiverse Discussion board](https://github.com/orgs/epiverse-trace/discussions).

### Code of Conduct

Please note that the {{ packagename }} 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.