Learn R Programming

brr (version 1.0.0)

PGB2Dist: Poisson-Gamma-Beta2 distribution

Description

Density and random generation for the Poisson-Gamma-Beta2 distribution with shape parameters a, c, d and hyperrate parameter tau (scale of the Beta2 distribution). For tau=1 this is the same as the Beta-negative binomial distribution.

Usage

dPGB2(x, a, c, d, tau)
pPGB2(q, a, c, d, tau)
qPGB2(p, a, c, d, tau)
rPGB2(n, a, c, d, tau)
summary_PGB2(a, c, d, tau, output = "list")

Arguments

x,q
vector of non-negative integer quantiles
a,c,d
non-negative shape parameters
tau
non-negative hyperrate parameter
p
vector of probabilities
n
number of observations to be sampled
output
type of the summary_PGB2 output: "list" to return a list, "pandoc" to print a table

Value

dPGB2 gives the density, pPGB2 the cumulative function, rPGB2 samples from the distribution, and summary_PGB2 gives a summary of the distribution.

Details

This is the mixture distribution obtained by sampling a value $y$ from the Beta2 distribution with shape parameters $c$, $d$, and scale $\tau$, then sampling a value $\lambda$ from the Gamma distribution with shape $a$ and rate $y$, and then sampling the Poisson distribution with mean $\lambda$.

Examples

Run this code
a <- 2 ; c <- 5 ; d <- 30; tau <- 2
barplot(dPGB2(0:40, a, c, d, tau), names=0:40)
summary_PGB2(a,c,d,tau, output="pandoc")

Run the code above in your browser using DataLab