Skip to contents

The predictive is NEGATIVE BINOMIAL, not Poisson, so its variance strictly exceeds its mean by the factor overdispersion.

Usage

Poispred(y, alpha, beta, exposure = NULL)

Arguments

y

Observed counts, non-negative.

alpha

Prior shape, > 0.

beta

Prior rate, > 0.

exposure

Optional exposure per observation (default all 1).

Value

List with alpha_post, beta_post, rate_mean, rate_var, pred_mean, pred_var, overdispersion, n.

Details

Formula: theta | y ~ Gamma(alpha + sum y_i, beta + sum e_i); ytilde mean alpha'/beta', variance (alpha'/beta')(1 + 1/beta')

References

Gelman, Carlin, Stern, Dunson, Vehtari & Rubin (2013), Bayesian Data Analysis, 3rd edition, Sections 2.6 and 2.7.

Examples

Poispred(y = c(1, 2, 3, 4, 5, 6, 7, 8), alpha = 0.5, beta = 0.5)
#> $alpha_post
#> [1] 36.5
#> 
#> $beta_post
#> [1] 8.5
#> 
#> $rate_mean
#> [1] 4.294118
#> 
#> $rate_var
#> [1] 0.5051903
#> 
#> $pred_mean
#> [1] 4.294118
#> 
#> $pred_var
#> [1] 4.799308
#> 
#> $overdispersion
#> [1] 1.117647
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Gamma-Poisson posterior and negative-binomial predictive"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"