Learn R Programming

robustbetareg (version 0.3.1)

EGB: The Exponential Generalized Beta of the Second Type Distribution

Description

Density, distribution function, quantile function and random generation for exponential generalized beta of the second type distribution.

Usage

dEGB(y_star, mu, phi, log = FALSE)

pEGB(q, mu, phi)

qEGB(p, mu, phi)

rEGB(n, mu, phi)

Value

dEGB gives the density, pEGB gives the distribution function,

qEGB gives the quantile function, and rEGB generates random variables.

Arguments

y_star, q

vector of quantiles.

mu

mu parameter.

phi

phi parameter.

log

logical; if TRUE, probabilities p are given as log(p). Default is FALSE.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Author

Yuri S. Maluf (yurimaluf@gmail.com), Francisco F. Queiroz (ffelipeq@outlook.com) and Silvia L. P. Ferrari.

Details

The EGB distribution with parameters mu = \(\mu\) and phi = \(\phi\) has density $$f(y^\star;\mu,\phi)= B^{-1}(\mu\phi,(1-\mu)\phi) \exp\{-y^\star(1-\mu)\phi\}/ (1+\exp\{-y^\star\})^{\phi},$$ with \(\mu\in(0,1),\phi>0\) and \(y^\star \in (-\infty, \infty)\). For this distribution, \(E(y^\star)=\psi(\mu\phi)-\psi((1-\mu)\phi)\) and \(Var(y^\star)=\psi'(\mu\phi)+\psi'((1-\mu)\phi)\), where \(\psi\) is the digamma function. See Kerman and McDonald (2015) for additional details. If \(y \sim beta(\mu, \phi)\), with \(\mu\) and \(\phi\) representing the mean and precision of \(y\), then \(y^\star = \log(y/(1-y)) \sim EGB(\mu, \phi)\) with the density given above.

References

Maluf, Y.S., Ferrari, S.L.P., and Queiroz, F.F. (2022). Robust beta regression through the logit transformation. Metrika:61–81.

Kerman, S. and McDonald, J.B. (2015). Skewness-kurtosis bounds for EGB1, EGB2, and special cases. Communications in Statistics - Theory and Methods, 44:3857-3864.

Examples

Run this code
dEGB(0.2, mu = 0.3, phi = 1)
mu = 0.2; phi = 2;
set.seed(1)
EGBsample = rEGB(1000, mu, phi)
hist(EGBsample, prob = TRUE, breaks = 15, main = "", las = 1, ylim = c(0, 0.2),
     xlim = c(-20, 10))
curve(dEGB(x, mu, phi), from = -20, to = 8, add = TRUE, col = "red")


# Showing the P(Y* < -5) = 0.17, where Y* ~ EGB(0.2, 2).
x = seq(-20, 10,0.01)
y = dEGB(x, mu, phi)
plot(x, y, type = "l", lwd = 2, las = 1)
x1 = seq(-20, -5, 0.01)
y1 = dEGB(x1, mu, phi)
polygon(c(x1, -5, -5), c(y1, 0, 0), col = "lightblue")


plot(x, pEGB(x, mu, phi), type = "l", las = 1, lwd = 2,
     ylab = expression(P("Y*"

Run the code above in your browser using DataLab