Description Usage Arguments Details Value Note Author(s) References See Also Examples

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

1 2 3 4 5 6 7 | ```
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)
``` |

`x, q` |
Vector of quantiles. |

`p` |
Vector of probabilities. |

`n` |
Number of observations. If |

`scale, shape1.a, shape2.p, shape3.q` |
Strictly positive scale and shape parameters. |

`log, log.p, lower.tail` |
Same meaning as in |

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

*
f(y) = a * x^(ap - 1) / b^(ap) * B(p, q) * [1 + (x/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 = shape1* and *q = shape2*.
Then, introducing additional *b = scale* and
*a = shape* parameters, the variable

*
Y = (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) = b^k * B(p+ k/a, q - k/a) / B(p, q)
*

or, equivalently,

*
E(Y^k) = Γ(p + k/a) * Γ(q - k/a) / Γ(p) * Γ(q).*

Here, *Γ(.)* is the gamma function as in
`gamma`

.

`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.

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.

V. Miranda and T. W. Yee

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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
# 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.