The function `BCCG`

defines the Box-Cox Cole and Green distribution (Box-Cox normal), a three parameter distribution,
for a `gamlss.family`

object to be used in GAMLSS fitting using the function `gamlss()`

.
The functions `dBCCG`

, `pBCCG`

, `qBCCG`

and `rBCCG`

define the density, distribution function, quantile function and random generation for the specific parameterization of the Box-Cox Cole and Green distribution.
[The function `BCCGuntr()`

is the original version of the function suitable only for the untruncated Box-Cox Cole and Green distribution
See Cole and Green (1992) and Rigby and Stasinopoulos (2003a,2003b) for details.
The function `BCCGo`

is identical to `BCCG`

but with log link for mu.

```
BCCG(mu.link = "identity", sigma.link = "log", nu.link = "identity")
BCCGo(mu.link = "log", sigma.link = "log", nu.link = "identity")
BCCGuntr(mu.link = "identity", sigma.link = "log", nu.link = "identity")
dBCCG(x, mu = 1, sigma = 0.1, nu = 1, log = FALSE)
pBCCG(q, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)
qBCCG(p, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)
rBCCG(n, mu = 1, sigma = 0.1, nu = 1)
dBCCGo(x, mu = 1, sigma = 0.1, nu = 1, log = FALSE)
pBCCGo(q, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)
qBCCGo(p, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)
rBCCGo(n, mu = 1, sigma = 0.1, nu = 1)
```

mu.link

Defines the `mu.link`

, with "identity" link as the default for the mu parameter, other links are "inverse", "log" and "own"

sigma.link

Defines the `sigma.link`

, with "log" link as the default for the sigma parameter, other links are "inverse", "identity" and "own"

nu.link

Defines the `nu.link`

, with "identity" link as the default for the nu parameter, other links are "inverse", "log" and "own"

x,q

vector of quantiles

mu

vector of location parameter values

sigma

vector of scale parameter values

nu

vector of skewness 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

`BCCG()`

returns a `gamlss.family`

object which can be used to fit a Cole and Green distribution in the `gamlss()`

function.
`dBCCG()`

gives the density, `pBCCG()`

gives the distribution
function, `qBCCG()`

gives the quantile function, and `rBCCG()`

generates random deviates.

The `BCCGuntr`

distribution may be unsuitable for some combinations of the parameters
(mainly for large \(\sigma\))
where the integrating constant is less than 0.99. A warning will be given if this is the case.
The BCCG distribution is suitable for all combinations of the distributional parameters within
their range [i.e. \(\mu>0\), \(\sigma>0\), \(\nu=(-\infty, +\infty)\)]

The probability distribution function of the untrucated Box-Cox Cole and Green distribution, `BCCGuntr`

, is defined as
$$f(y|\mu,\sigma,\nu)=\frac{1}{\sqrt{2\pi}\sigma}\frac{y^{\nu-1}}{\mu^\nu} \exp(-\frac{z^2}{2})$$

where if \(\nu \neq 0\) then \(z=[(y/\mu)^{\nu}-1]/(\nu \sigma)\) else \(z=\log(y/\mu)/\sigma\), for \(y>0\), \(\mu>0\), \(\sigma>0\) and \(\nu=(-\infty,+\infty)\).

The Box-Cox Cole anf Green distribution, `BCCG`

, adjusts the above density \(f(y|\mu,\sigma,\nu)\) for the
truncation resulting from the condition \(y>0\). See Rigby and Stasinopoulos (2003a,2003b) for details.

Cole, T. J. and Green, P. J. (1992) Smoothing reference centile curves: the LMS method and penalized likelihood, *Statist. Med.* **11**, 1305--1319

Rigby, R. A. and Stasinopoulos, D. M. (2004). Smooth centile curves for skew and kurtotic data modelled using the Box-Cox Power
Exponential distribution. *Statistics in Medicine*, **23**: 3053-3076.

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. (2006). Using the Box-Cox *t* distribution in GAMLSS to mode skewnees and and kurtosis. *Statistical Modelling*, 6(3) :209. 10.1191/1471082X06st122oa

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. 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, 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. 10.1201/b21973

(see also https://www.gamlss.com/).

# NOT RUN { BCCG() # gives information about the default links for the Cole and Green distribution # library(gamlss) #data(abdom) #h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCCG, data=abdom) #plot(h) plot(function(x) dBCCG(x, mu=5,sigma=.5,nu=-1), 0.0, 20, main = "The BCCG density mu=5,sigma=.5,nu=-1") plot(function(x) pBCCG(x, mu=5,sigma=.5,nu=-1), 0.0, 20, main = "The BCCG cdf mu=5, sigma=.5, nu=-1") # }