This function defines the generalized beta type 2 distribution, a four parameter distribution.
The function GB2
creates a gamlss.family
object which can be used to fit the distribution using the function
gamlss()
. The response variable is
in the range from zero to infinity.
The functions dGB2
,
GB2
, qGB2
and rGB2
define the density,
distribution function, quantile function and random
generation for the generalized beta type 2 distribution.
The generalised Pareto GP
distribution is defined by setting the parameters sigma
and nu
of the GB2
distribution to 1.
GB2(mu.link = "log", sigma.link = "log", nu.link = "log",
tau.link = "log")
dGB2(x, mu = 1, sigma = 1, nu = 1, tau = 0.5, log = FALSE)
pGB2(q, mu = 1, sigma = 1, nu = 1, tau = 0.5, lower.tail = TRUE,
log.p = FALSE)
qGB2(p, mu = 1, sigma = 1, nu = 1, tau = 0.5, lower.tail = TRUE,
log.p = FALSE)
rGB2(n, mu = 1, sigma = 1, nu = 1, tau = 0.5)GP(mu.link = "log", sigma.link = "log")
dGP(x, mu = 1, sigma = 1, log = FALSE)
pGP(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
qGP(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
rGP(n, mu = 1, sigma = 1)
GB2()
returns a gamlss.family
object which can be used to fit the GB2 distribution in the
gamlss()
function.
dGB2()
gives the density, pGB2()
gives the distribution
function, qGB2()
gives the quantile function, and rGB2()
generates random deviates.
Defines the mu.link
, with "identity" link as the default for the mu
parameter.
Defines the sigma.link
, with "log" link as the default for the sigma
parameter.
Defines the nu.link
, with "log" link as the default for the nu
parameter.
Defines the tau.link
, with "log" link as the default for the tau
parameter.
vector of quantiles
vector of location parameter values
vector of scale parameter values
vector of skewness nu
parameter values
vector of kurtosis tau
parameter values
logical; if TRUE, probabilities p are given as log(p).
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
vector of probabilities.
number of observations. If length(n) > 1
, the length is
taken to be the number required
Bob Rigby and Mikis Stasinopoulos
The qSHASH and rSHASH are slow since they are relying on golden section for finding the quantiles
The probability density function of the Generalized Beta type 2, (GB2
), is defined as
$$f(y|\mu,\sigma,\nu,\tau)= |\sigma| y^{\hspace{0.01cm}\sigma v-1 } \{\mu^{\sigma \nu} \hspace{0.05cm}B(\nu,\tau) [1+(y/\mu)^\sigma]^{\nu+\tau}\}^{-1}$$ where \( y > 0\), \(\mu>0\), \(\sigma >0\), \(\nu>0\) and \(\tau>0\) see pp. 452-453 of Rigby et al. (2019).
Note that by setting \(\sigma=1\) we have the Pearson type VI, by setting \(\nu=1\) we have the Burr type XII and by setting \(\tau=1\) the Burr type III.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape, (with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC, tools:::Rd_expr_doi("10.1201/9780429298547"). An older version can be found in https://www.gamlss.com/.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, tools:::Rd_expr_doi("10.18637/jss.v023.i07").
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC. tools:::Rd_expr_doi("10.1201/b21973")
(see also https://www.gamlss.com/).
gamlss.family
, JSU
, BCT
GB2() #
y<- rGB2(200, mu=5, sigma=2, nu=1, tau=1)
library(MASS)
truehist(y)
fx<-dGB2(seq(0.01, 20, length=200), mu=5 ,sigma=2, nu=1, tau=1)
lines(seq(0.01,20,length=200),fx)
integrate(function(x) x*dGB2(x=x, mu=5, sigma=2, nu=1, tau=1), 0, Inf)
mean(y)
curve(dGB2(x, mu=5 ,sigma=2, nu=1, tau=1), 0.01, 20,
main = "The GB2 density mu=5, sigma=2, nu=1, tau=4")
Run the code above in your browser using DataLab