LNO {gamlss.dist} | R Documentation |
Log Normal distribution for fitting in GAMLSS
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=(-\infty,+\infty)
, the function LOGNO2
use mu
as the median, so \mu=(0,+\infty)
.
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
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 |
sigma.link |
Defines the |
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 |
Details
The probability density function in LOGNO
is defined as
f(y|\mu,\sigma)=\frac{1}{y \sqrt{2\pi}\sigma} \exp [-\frac{1}{2 \sigma^2}(\log y-\mu)^2 ]
for y>0
, -\infty<\mu<\infty
and \sigma>0
see pp. 428-429 of Rigby et al. (2019).
The probability density function in LOGNO2
is defined as
f(y|\mu,\sigma)=\frac{1}{y \sqrt{2\pi}\sigma} \exp [-\frac{1}{2 \sigma^2}(\log y-\log\mu)^2 ]
for y>0
, -\infty<\mu<\infty
and \sigma>0
see pp. 429-430 of Rigby et al. (2019).
The probability density function in LNO
is defined as
f(y|\mu,\sigma,\nu)=\frac{y^{\nu-1}}{\sqrt{2\pi}\sigma} \exp [-\frac{1}{2 \sigma^2}(z-\mu)^2 ]
where if \nu \neq 0
z =(y^{\nu}-1)/\nu
else z=\log(y)
and z \sim N(0,\sigma^2)
,
for y>0
, \mu>0
, \sigma>0
and \nu=(-\infty,+\infty)
. This is not a proper distribution see for example p. 447 of Rigby et al. (2019).
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.
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, 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, doi:10.18637/jss.v023.i07.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) 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. doi:10.1201/b21973
(see also https://www.gamlss.com/).
See Also
Examples
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)