poisBayes | R Documentation |
The function provides the Bayesian prediction limits of a Poisson random variable derived based on a gamma prior. The resulting prediction bounds quantify the uncertainty associated with the predicted future number of occurences in a time window of size t.
poisBayes(xobs, n, s, t, a, b, alpha = 0.05)
xobs |
a numeric value denoting the number of the observed occurrencies. |
n |
a numeric value representing the total number of the time windows |
s |
a numeric value corresponding to the fixed size (or average size) of the observed time windows. |
t |
a numeric value indicating the size of the future time window. |
a |
a poisitive real number denoting the shape hyperparameter of a gamma prior distribution. |
b |
a poisitive real number representing the rate hyperparameter of a gamma prior distribution. |
alpha |
a numeric value associated to the credible probability. By default |
When the argument b = Inf
, one can obtain prediction limits with uniform prior by setting the argument a = 1
. Similarly, one can get the limits with a Jeffreys prior by setting the argument a = 0
.
A list containing the following components:
lower |
An integer value representing the lower bound of the prediction limit. |
upper |
An integer value representing the upper bound of the prediction limit. |
Valbona Bejleri, Luca Sartore and Balgobin Nandram
Bejleri, V., & Nandram, B. (2018). Bayesian and frequentist prediction limits for the Poisson distribution. Communications in Statistics-Theory and Methods, 47(17), 4254-4271.
Bejleri, V. (2005). Bayesian Prediction Intervals for the Poisson Model, Noninformative Priors, Ph.D. Dissertation, American University, Washington, DC.
poiss
, poisJEFF
, poisUNIF
# Loading the package library(plpoisson) set.seed(2020L) # Number of observed time windows n <- 555L # Simulating a dataset data <- cbind.data.frame( occ_obs = rpois(n, rgamma(n, 5.5, .5)), win_siz = rgamma(n, 1.44, .777) ) ## Bayesian prediction limits ## (with gamma prior) poisBayes(sum(data$occ_obs), # Past occurrencies nrow(data), # Total past time windows mean(data$win_siz), # Window size 333, # Size of future window 2, 2.22) # Hyper-parameters for gamma prior
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.