View source: R/estimate_delay.R
dist_fit | R Documentation |
Fits an integer adjusted exponential, gamma or lognormal distribution using stan.
dist_fit(
values = NULL,
samples = 1000,
cores = 1,
chains = 2,
dist = "exp",
verbose = FALSE,
backend = "rstan"
)
values |
Numeric vector of values |
samples |
Numeric, number of samples to take. Must be >= 1000. Defaults to 1000. |
cores |
Numeric, defaults to 1. Number of CPU cores to use (no effect if greater than the number of chains). |
chains |
Numeric, defaults to 2. Number of MCMC chains to use. More is better with the minimum being two. |
dist |
Character string, which distribution to fit. Defaults to
exponential ( |
verbose |
Logical, defaults to FALSE. Should verbose progress messages be printed. |
backend |
Character string indicating the backend to use for fitting stan models. Supported arguments are "rstan" (default) or "cmdstanr". |
A stan fit of an interval censored distribution
# integer adjusted exponential model
dist_fit(rexp(1:100, 2),
samples = 1000, dist = "exp",
cores = ifelse(interactive(), 4, 1), verbose = TRUE
)
# integer adjusted gamma model
dist_fit(rgamma(1:100, 5, 5),
samples = 1000, dist = "gamma",
cores = ifelse(interactive(), 4, 1), verbose = TRUE
)
# integer adjusted lognormal model
dist_fit(rlnorm(1:100, log(5), 0.2),
samples = 1000, dist = "lognormal",
cores = ifelse(interactive(), 4, 1), verbose = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.