# Counts collected in a single sampling bout
counts <- c(1, 2, 3)
# Calculate posterior probability from a naive 0.5 prior for H1:mu>2
# (a population being >2 individuals per sampling unit) with
# a poisson kernel
stbp_posterior_composite(data = counts,
greater_than = TRUE,
hypothesis = 2,
density_func = "poisson",
prior = 0.5,
lower_bnd = 0,
upper_bnd = Inf) # returns 0.60630278
# Same analysis but with a negative binomial kernel.
# Note that 'overdispersion' can either be a positive number or a function.
stbp_posterior_composite(data = counts,
greater_than = TRUE,
hypothesis = 2,
density_func = "negative binomial",
overdispersion = 2,
prior = 0.5,
lower_bnd = 0,
upper_bnd = Inf) # returns 0.72558593
## End (Not run)
Run the code above in your browser using DataLab