Learn R Programming

gamlss.dist (version 6.1-1)

SHASH: The Sinh-Arcsinh (SHASH) distribution for fitting a GAMLSS

Description

The Sinh-Arcsinh (SHASH) distribution is a four parameter distribution, for a gamlss.family object to be used for a GAMLSS fitting using the function gamlss(). The functions dSHASH, pSHASH, qSHASH and rSHASH define the density, distribution function, quantile function and random generation for the Sinh-Arcsinh (SHASH) distribution.

There are 3 different SHASH distributions implemented in GAMLSS.

Usage

SHASH(mu.link = "identity", sigma.link = "log", nu.link = "log", 
      tau.link = "log")
dSHASH(x, mu = 0, sigma = 1, nu = 0.5, tau = 0.5, log = FALSE)
pSHASH(q, mu = 0, sigma = 1, nu = 0.5, tau = 0.5, lower.tail = TRUE, 
     log.p = FALSE)
qSHASH(p, mu = 0, sigma = 1, nu = 0.5, tau = 0.5, lower.tail = TRUE, 
     log.p = FALSE)
rSHASH(n, mu = 0, sigma = 1, nu = 0.5, tau = 0.5)

SHASHo(mu.link = "identity", sigma.link = "log", nu.link = "identity", tau.link = "log") dSHASHo(x, mu = 0, sigma = 1, nu = 0, tau = 1, log = FALSE) pSHASHo(q, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE) qSHASHo(p, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE) rSHASHo(n, mu = 0, sigma = 1, nu = 0, tau = 1)

SHASHo2(mu.link = "identity", sigma.link = "log", nu.link = "identity", tau.link = "log") dSHASHo2(x, mu = 0, sigma = 1, nu = 0, tau = 1, log = FALSE) pSHASHo2(q, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE) qSHASHo2(p, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE) rSHASHo2(n, mu = 0, sigma = 1, nu = 0, tau = 1)

Value

SHASH() returns a gamlss.family object which can be used to fit the SHASH distribution in the gamlss() function. dSHASH() gives the density, pSHASH() gives the distribution function, qSHASH() gives the quantile function, and rSHASH()

generates random deviates.

Arguments

mu.link

Defines the mu.link, with "identity" link as the default for the mu parameter.

sigma.link

Defines the sigma.link, with "log" link as the default for the sigma parameter.

nu.link

Defines the nu.link, with "log" link as the default for the nu parameter.

tau.link

Defines the tau.link, with "log" link as the default for the tau parameter.

x,q

vector of quantiles

mu

vector of location parameter values

sigma

vector of scale parameter values

nu

vector of skewness nu parameter values

tau

vector of kurtosis tau parameter values

log, log.p

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

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]

p

vector of probabilities.

n

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

Author

Bob Rigby, Mikis Stasinopoulos and Fiona McElduff

Warning

The qSHASH and rSHASH are slow since they are relying on golden section for finding the quantiles

Details

The probability density function of the Sinh-Arcsinh distribution, SHASH, Jones(2005), is defined as

$$f(y|\mu,\sigma\,\nu,\tau) = \frac{c}{\sqrt{2 \pi} \sigma (1+z^2)^{1/2}} e^{-r^2/2}$$

where

$$r=\frac{1}{2} \left \{ \exp\left[ \tau \sinh^{-1}(z) \right] -\exp\left[ -\nu \sinh^{-1}(z) \right] \right\}$$

and

$$c=\frac{1}{2} \left \{ \tau \exp\left[ \tau \sinh^{-1}(z) \right] + \nu \exp\left[ -\nu \sinh^{-1}(z) \right] \right\}$$

and \(z=(y-\mu)/\sigma\) for \( -\infty < y < \infty \), \(-\infty<\mu<\infty\), \(\sigma>0\), \(\nu>0\) and \(\tau>0\), see pp. 396-397 of Rigby et al. (2019).

The parameters \(\mu\) and \(\sigma\) are the location and scale of the distribution. The parameter \(\nu\) determines the left hand tail of the distribution with \(\nu>1\) indicating a lighter tail than the normal and \(\nu<1\) heavier tail than the normal. The parameter \(\tau\) determines the right hand tail of the distribution in the same way.

The second form of the Sinh-Arcsinh distribution can be found in Jones and Pewsey (2009, p.2) denoted by SHASHo and the probability density function is defined as,

$$f(y|\mu,\sigma,\nu,\tau)= \frac{\tau c}{\sigma \sqrt{2 \pi} (1+z^2)^{1/2}} \exp{(-\frac{1}{2} r^2)}$$

where

$$r= \sinh(\tau \, \sinh^{-1}(z)-\nu)$$

and

$$c= \cosh(\tau \sinh^{-1}(z)-\nu)$$

and \(z=(y-\mu)/\sigma\) for \( -\infty < y < \infty \), \(-\infty<\mu<+\infty\), \(\sigma>0\), \(-\infty<\nu<+\infty\) and \(\tau>0\), see pp. 398-400 of Rigby et al. (2019)

The third form of the Sinh-Arcsinh distribution (Jones and Pewsey, 2009, p.8) divides the distribution by sigma for the density of the unstandardized variable. This distribution is denoted by SHASHo2 and has pdf

$$f(y|\mu,\sigma,\nu,\tau)= \frac{c}{\sigma} \frac{\tau}{\sqrt{2 \pi}}\frac{1}{\sqrt{1+z^2}}-\exp{-\frac{r^2}{2}}$$

where \(z=(y-\mu)/(\sigma \tau)\), with \(r\) and \(c\) as for the pdf of the SHASHo distribution, for \( -\infty < y < \infty \), \(\mu=(-\infty,+\infty)\), \(\sigma>0\), \(\nu=(-\infty,+\infty)\) and \(\tau>0\).

References

Jones, M. C. (2006) p 546-547 in the discussion of Rigby, R. A. and Stasinopoulos D. M. (2005) Appl. Statist., 54, part 3.

Jones and Pewsey (2009) Sinh-arcsinh distributions. Biometrika. 96(4), pp. 761?780.

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/).

See Also

gamlss.family, JSU, BCT

Examples

Run this code
SHASH()   # 
plot(function(x)dSHASH(x, mu=0,sigma=1, nu=1, tau=2), -5, 5, 
 main = "The SHASH  density mu=0,sigma=1,nu=1, tau=2")
plot(function(x) pSHASH(x, mu=0,sigma=1,nu=1, tau=2), -5, 5, 
 main = "The BCPE  cdf mu=0, sigma=1, nu=1, tau=2")
dat<-rSHASH(100,mu=10,sigma=1,nu=1,tau=1.5)
hist(dat)
# library(gamlss)
# gamlss(dat~1,family=SHASH, control=gamlss.control(n.cyc=30))

Run the code above in your browser using DataLab