# LNO: Log Normal distribution for fitting in GAMLSS In gamlss.dist: Distributions for Generalized Additive Models for Location Scale and Shape

## Description

The functions `LOGNO` and `LOGNO2` define a `gamlss.family` distribution to fits the log-Normal distribution. The difference between them is that while `LOGNO` retains the original parametrization for `mu`, (identical to the normal distribution `NO`) and therefore mu=(-Inf,+Inf), the function `LOGNO2` use `mu` as the median, so mu=(0,+Inf).

The function `LNO` is more general and can fit a Box-Cox transformation to data using the `gamlss()` function. In the `LOGNO` (and `LOGNO2`) there are two parameters involved `mu` `sigma`, while in the `LNO` there are three parameters `mu` `sigma`, and the transformation parameter `nu`. The transformation parameter `nu` in `LNO` is a 'fixed' parameter (not estimated) and it has its default value equal to zero allowing the fitting of the log-normal distribution as in `LOGNO`. See the example below on how to fix `nu` to be a particular value. In order to estimate (or model) the parameter `nu`, use the `gamlss.family` `BCCG` distribution which uses a reparameterized version of the the Box-Cox transformation. The functions `dLOGNO`, `pLOGNO`, `qLOGNO` and `rLOGNO` define the density, distribution function, quantile function and random generation for the specific parameterization of the log-normal distribution.

The functions `dLOGNO2`, `pLOGNO2`, `qLOGNO2` and `rLOGNO2` define the density, distribution function, quantile function and random generation when `mu` is the median of the log-normal distribution.

The functions `dLNO`, `pLNO`, `qLNO` and `rLNO` define the density, distribution function, quantile function and random generation for the specific parameterization of the log-normal distribution and more generally a Box-Cox transformation.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```LNO(mu.link = "identity", sigma.link = "log") LOGNO(mu.link = "identity", sigma.link = "log") LOGNO2(mu.link = "log", sigma.link = "log") dLNO(x, mu = 1, sigma = 0.1, nu = 0, log = FALSE) dLOGNO(x, mu = 0, sigma = 1, log = FALSE) dLOGNO2(x, mu = 1, sigma = 1, log = FALSE) pLNO(q, mu = 1, sigma = 0.1, nu = 0, lower.tail = TRUE, log.p = FALSE) pLOGNO(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE) pLOGNO2(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) qLNO(p, mu = 1, sigma = 0.1, nu = 0, lower.tail = TRUE, log.p = FALSE) qLOGNO(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE) qLOGNO2(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) rLNO(n, mu = 1, sigma = 0.1, nu = 0) rLOGNO(n, mu = 0, sigma = 1) rLOGNO2(n, mu = 1, sigma = 1) ```

## Arguments

 `mu.link` Defines the `mu.link`, with "identity" or "log" link depending on te parametrization `sigma.link` Defines the `sigma.link`, with "log" link as the default for the sigma parameter. Other links are "inverse", "identity" ans "own" `x,q` vector of quantiles `mu` vector of location parameter values `sigma` vector of scale parameter values `nu` vector of shape 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

## Details

The probability density function in `LOGNO` is defined as

f(y|mu,sigma)=(1/(y*sqrt(2*pi)*sigma))*exp(-0.5*((log(y)-mu)/(sigma))^2)

for y>0, mu=(-Inf,+Inf) and σ>0.

The probability density function in `LNO` is defined as

f(y|mu,sigma,nu)=(1/(sqrt(2*pi)*sigma))*(y^(nu-1))*exp(-((z-mu)/(2sigma))^2)

where if ν!=0 z=(y^nu-1)/nu else z=\log(y) and z \sim N(0,σ^2), for y>0, μ>0, σ>0 and ν=(-Inf,+Inf).

## Value

`LNO()` returns a `gamlss.family` object which can be used to fit a log-normal distribution in the `gamlss()` function. `dLNO()` gives the density, `pLNO()` gives the distribution function, `qLNO()` gives the quantile function, and `rLNO()` generates random deviates.

## Warning

This is a two parameter fit for mu and sigma while nu is fixed. If you wish to model nu use the gamlss family `BCCG`.

## Note

mu is the mean of z (and also the median of y), the Box-Cox transformed variable and sigma is the standard deviation of z and approximate the coefficient of variation of y

## Author(s)

Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou

## References

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations (with discussion), J. R. Statist. Soc. B., 26, 211–252

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.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

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, http://www.jstatsoft.org/v23/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.

`gamlss.family`, `BCCG`
 ``` 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``` ```LOGNO()# gives information about the default links for the log normal distribution LOGNO2() LNO()# gives information about the default links for the Box Cox distribution # plotting the d, p, q, and r functions op<-par(mfrow=c(2,2)) curve(dLOGNO(x, mu=0), 0, 10) curve(pLOGNO(x, mu=0), 0, 10) curve(qLOGNO(x, mu=0), 0, 1) Y<- rLOGNO(200) hist(Y) par(op) # plotting the d, p, q, and r functions op<-par(mfrow=c(2,2)) curve(dLOGNO2(x, mu=1), 0, 10) curve(pLOGNO2(x, mu=1), 0, 10) curve(qLOGNO2(x, mu=1), 0, 1) Y<- rLOGNO(200) hist(Y) par(op) # library(gamlss) # data(abdom) # h1<-gamlss(y~cs(x), family=LOGNO, data=abdom)#fits the log-Normal distribution # h2<-gamlss(y~cs(x), family=LNO, data=abdom) #should be identical to the one above # to change to square root transformation, i.e. fix nu=0.5 # h3<-gamlss(y~cs(x), family=LNO, data=abdom, nu.fix=TRUE, nu.start=0.5) ```