Fit an Integer Adjusted Exponential, Gamma or Lognormal distributions
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 valuessamples
: 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 ("exp"
) but gamma ("gamma"
) and lognormal ("lognormal"
) are also supported.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 )
Useful links