# genbetaIIUC: The Generalized Beta Distribution of the Second King In VGAMextra: Additions and Extensions of the 'VGAM' Package

 genbetaIIDist R Documentation

## The Generalized Beta Distribution of the Second King

### Description

Density, distribution function, inverse distribution (quantile function) and random generation for the Generalized Beta of the Second Kind (GB2).

### Usage

  dgen.betaII(x, scale = 1.0, shape1.a = 1.0, shape2.p = 1.0, shape3.q = 1.0,
log = FALSE)
pgen.betaII(q, scale = 1.0, shape1.a = 1.0, shape2.p = 1.0, shape3.q = 1.0,
lower.tail = TRUE, log.p = FALSE)
qgen.betaII(p, scale = 1.0, shape1.a = 1.0, shape2.p = 1.0, shape3.q = 1.0,
lower.tail = TRUE, log.p = FALSE)
rgen.betaII(n, scale = 1.0, shape1.a = 1.0, shape2.p = 1.0, shape3.q = 1.0)



### Arguments

 x, q Vector of quantiles. p Vector of probabilities. n Number of observations. If length(n) > 1, its length is taken to be the numbre required. scale, shape1.a, shape2.p, shape3.q Strictly positive scale and shape parameters. log, log.p, lower.tail Same meaning as in Beta

### Details

The GB2 Distribution is defined by the probability density (pdf)

f(y) = \frac{a x^{ap - 1}}{b^{ap} B(p, q) [1 + (y/b)^{a}]^{p + q},}

for y > 0, and b, a, p, q > 0. Here, B(p, q) is the beta function as in beta.

The GB2 Distribution and the Beta Distribution (see Beta) are linked, as follows: Let X be a random variable with the Beta density and parameters p = shape_{1} and q = shape_{2}. Then, introducing additional b = scale and a = shape parameters, the variable

Y = \frac{(x/b)^{a}}{1 + (x/b)^{a}}

has the GB2 Distribution, with parameters b, a, p, q.

The GB2 k^{th} moment exists for -ap < k < aq and is given by

E(Y^{k}) = \frac{b^{k} B(p + k/a, q - k/a)}{B(p, q)}

or, equivalently,

E(Y^{k}) = \frac{b^{k} \Gamma(p + k/a) \Gamma(q - k/a)} {\Gamma(p) \Gamma(q)}).

Here, \Gamma(\cdot) is the gamma function as in gamma.

### Value

dgen.betaII() returns the density (p.d.f), pgen.betaII() gives the distribution function (p.d.f), qgen.betaII() gives the quantile function (Inverse Distribution function), and rgen.betaII() generates random numbers from the GB2 distribution.

### Note

Values of the shape2.p parameter moderately close to zero may imply obtaning numerical values too close to zero or values represented as zero in computer arithmetic from the function rgen.betaII().

Additionally, for specific values of the arguments x, q, p such as Inf, -Inf, NaN and NA, the functions qgen.betaII(), pgen.betaII() and qgen.betaII() will return the limit when the argument tends to such value.

In particular, the quantile qgen.betaII() retunrs zero for negative values and Inf for missed probabilities greater than 1.0.

### Author(s)

V. Miranda and T. W. Yee

### References

Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, ch.6, p.255. Dover, New York, USA.

Kleiber, C. and Kotz, S. (2003) Statistical Size Distributions in Economics and Actuarial Sciences. Wiley Series in Probability and Statistics. Hoboken, New Jersey, USA.

McDonald, J. B. and Xu, Y. J. (1995) A generalization of the beta distribution with applications. Journal of Econometrics, 66, p.133–152.

McDonald, J. B. (1984) Some generalized functions for the size distribution of income. Econometrica, 52, p.647–663.

Beta, beta.

### Examples


# Setting parameters to both examples below.
b  <- exp(0.4)      # Scale parameter.
a  <- exp(0.5)      # Shape1.a
p  <- exp(0.3)      # Shape2.p
q  <- exp(1.4)      # Shape3.q

# (1) ______________
probs.y <- seq(0.0, 1.0, by = 0.01)
data.1  <- qgen.betaII(p = probs.y, scale = b, shape1.a = a,
shape2.p = p, shape3.q = q)
max(abs(pgen.betaII(q = data.1, scale = b, shape1.a = a,
shape2.p = p, shape3.q = q)) - probs.y) # Should be 0.

# (2)_________________
xx    <- seq(0, 10.0, length = 200)
yy    <- dgen.betaII(xx, scale = b, shape1.a = a, shape2.p = p, shape3.q = q)
qtl   <- seq(0.1, 0.9, by = 0.1)
d.qtl <- qgen.betaII(qtl, scale = b, shape1.a = a, shape2.p = p, shape3.q = q)
plot(xx, yy, type = "l", col = "red",
main = "Red is the GB2 density, blue is the GB2 Distribution Function",
sub  = "Brown dashed lines represent the 10th, ..., 90th percentiles",
las = 1, xlab = "x", ylab = "", xlim = c(0, 3), ylim = c(0,1))
abline(h = 0, col = "navy", lty = 2)
abline(h = 1, col = "navy", lty = 2)
lines(xx, pgen.betaII(xx, scale = b, shape1.a = a,
shape2.p = b, shape3.q = q), col= "blue")
lines(d.qtl, dgen.betaII(d.qtl, scale = b, shape1.a = a,
shape2.p = p, shape3.q = q),
type ="h", col = "brown", lty = 3)



VGAMextra documentation built on Nov. 2, 2023, 5:59 p.m.