{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
at the London School of Hygiene and Tropical Medicine as part of the
Epiverse Initiative.
You can install the development version of quickfit from GitHub with:
# check whether {pak} is installed
if(!require("pak")) install.packages("pak")
pak::pak("epiverse-trace/quickfit")
The examples below show the existing functionality; this is not currently planned to be developed further.
These examples illustrate some of the current functionalities:
library(quickfit)
Generate some simulated data, define a likelihood, then estimate MLE, or MLE and 95% confidence interval based on profile likelihood:
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
#> a b
#> 3.896134 1.987079
#>
#> $log_likelihood
#> [1] -105.2867
# 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
)
#> $estimate
#> a b
#> 3.896134 1.987079
#>
#> $profile_out
#> a1 a2 b1 b2
#> 3.331714 4.461714 1.651760 2.456527
Additionally, multiple distribution models can be compared (for censored and non-censored data).
multi_fitdist(
data = rlnorm(n = 100, meanlog = 1, sdlog = 1),
models = c("lnorm", "gamma", "weibull"),
func = fitdistrplus::fitdist
)
#> models loglik aic bic
#> 1 lnorm -243.5509 491.1018 496.3121
#> 2 weibull -255.4449 514.8898 520.1001
#> 3 gamma -255.5247 515.0494 520.2597
To report a bug please open an
issue;
please note that development on {quickfit}
has been suspended,
therefore it is not guaranteed that all issues will be responded to.
Contributions are welcome via pull requests.
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.
Please note that the quickfit project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.