Learn R Programming

brr (version 1.0.0)

GB2Dist: Gamma-Beta2 distribution

Description

Density and random generation for the Gamma-Beta2 distribution with shape parameters a, c, d and rate parameter tau (scale of the Beta2 distribution).

Usage

dGB2(x, a, c, d, tau)
pGB2(q, a, c, d, tau, ...)
qGB2(p, a, c, d, tau)
rGB2(n, a, c, d, tau)
moment_GB2(k, a, c, d, tau)
summary_GB2(a, c, d, tau, output = "list", ...)

Arguments

x,q
vector of non-negative quantiles
a,c,d
non-negative shape parameters
tau
non-negative rate parameter
...
arguemnts passed to genhypergeo function
p
vector of probabilities
n
number of observations to be sampled
k
the order of the moment
output
type of the summary_GB2 output: "list" to return a list, "pandoc" to print a table

Value

dGB2 gives the density, pGB2 the cumulative function, rGB2 samples from the distribution, and summary_GB2 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$ and then sampling a value from the Gamma distribution with shape $a$ and rate $y$. The pdf involves the Kummer confluent hypergeometric function of the second kind. The cdf involves the generalized hypergeometric function. Its current implementation does not work when a-d is an integer, and also fails for many other cases.

Examples

Run this code
a <- 2 ; c <- 4 ; d <- 3; tau <- 1.67
sims <- rGB2(1e6, a, c, d, tau)
mean(sims); moment_GB2(1,a,c,d,tau)
mean(sims^2); moment_GB2(2,a,c,d,tau)
summary_GB2(a,c,d,tau)

Run the code above in your browser using DataLab