compute_posterior {dupiR}R Documentation

Compute the posterior probability distribution of the population size for an object of class Counts

Description

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)

Usage

compute_posterior(
  object,
  n_start,
  n_end,
  replacement = FALSE,
  b = 1e-10,
  alg = "dup"
)

Arguments

object

object of class Counts

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"

Value

an object of class Counts

Author(s)

Federico Comoglio

References

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

Examples

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)


[Package dupiR version 1.2.1 Index]