compute_posterior | R Documentation |
Counts
Compute the posterior probability distribution of the population size using a discrete uniform prior and a binomial likelihood ("dup" algorithm, Comoglio et al.). An approximation using a Gamma prior and a Poisson likelihood is used when applicable ("gamma" algorithm) method (see Clough et al. for details)
compute_posterior(
object,
n_start,
n_end,
replacement = FALSE,
b = 1e-10,
alg = "dup"
)
object |
object of class |
n_start |
start of prior support range |
n_end |
end of prior support range |
replacement |
was sampling performed with replacement? Default to FALSE |
b |
prior rate parameter of the gamma distribution used to compute the posterior with Clough. Default to 1e-10 |
alg |
algorithm to be used to compute posterior. One of ... . Default to "dup" |
an object of class Counts
Federico Comoglio
Comoglio F, Fracchia L and Rinaldi M (2013) Bayesian inference from count data using discrete uniform priors. PLoS ONE 8(10): e74388
Clough HE et al. (2005) Quantifying Uncertainty Associated with Microbial Count Data: A Bayesian Approach. Biometrics 61: 610-616
counts <- new_counts(counts = c(20,30), fractions = c(0.075, 0.10))
# default parameters ("dup" algorithm, sampling without replacement, default prior support)
posterior <- compute_posterior(counts)
# custom prior support ("dup" algorithm)
posterior <- compute_posterior(counts, n_start = 0, n_end = 1e3)
# gamma prior ("gamma" algorithm)
posterior <- compute_posterior(counts, alg = "gamma")
# sampling with replacement
posterior <- compute_posterior(counts, replacement = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.