The Lognormal Distribution (3 Parameter)

Share:

Description

Density function, distribution function and quantile function for the Lognormal distribution.

Usage

1
2
3
dlnorm3(x, meanlog, sdlog, threshold)
plnorm3(q, meanlog, sdlog, threshold)
qlnorm3(p, meanlog, sdlog, threshold, ...)

Arguments

x, q

vector of quantiles

p

vector of probabilities

meanlog, sdlog

mean and standard deviation of the distribution on the log scale with default values of ‘0’ and ‘1’ respectively.

threshold

threshold parameter by default 0

...

Arguments that can be passed into uniroot.

Details

The Lognorm distribution with ‘meanlog’ parameter zeta, ‘meansd’ parameter sigma and ‘threshold’ parameter theta has density given by

f(x) = (1/(sqrt(2*pi)*sigma*(x-theta)))
*exp(-(((log((x-theta))-zeta)^2)/(2*(sigma)^2)))

The cumulative distribution function is given by

F(x) = pnorm((log((x-theta))-zeta)/sigma)

Value

dlnorm3 gives the density, plnorm3 gives the distribution function and qlnorm3 gives the quantile function.

Note

qlnorm3 calls uniroot for each value of the argument ‘p’. The solution is consequently not exact; the ... can be used to obtain a more accurate solution if necessary.

Author(s)

Thomas Roth thomas.roth@tu-berlin.de
Etienne Stockhausen stocdarf@mailbox.tu-berlin.de

References

Johnson, L., Kotz, S., Balakrishnan, N. (1995) Continuous Univariate Distributions-Volume 1, 2nd ed. New York: John Wiley & Sons.

See Also

uniroot

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Simple Example
dlnorm3(x=2,meanlog=0,sdlog=1/8,threshold=1)
temp=plnorm3(q=2,meanlog=0,sdlog=1/8,threshold=1)
temp
qlnorm3(p=temp,meanlog=0,sdlog=1/8,threshold=1)
#
##Visualized Example
##prepare screen
#dev.new()
#split.screen(matrix(c(0,0.5,0,1, 0.5,1,0,1),byrow=TRUE,ncol=4))
##generate values 
#x=seq(0,4,length=1000)
##plot different density functions
#screen(1)                                                                              
#plot(x,y=dlnorm3(x,0,1/8,1),col="green",xlim=c(0,3),type="l",lwd=2,xlab="x",
#     ylab="f(x)",main="Density Function of Log-Normal-Distribution")
#lines(x,y=dlnorm3(x,0,0.5,0),lwd=2,col="red")
#lines(x,y=dlnorm3(x,0,1,0),lwd=2,col="blue")
#lines(x,y=dlnorm3(x,1,1/8,0),lwd=2,col="orange")
##add legend
#legend("topleft",legend=c(expression(paste(zeta," = 0 ")*
#       paste(sigma, " = 1/8 ")*paste(theta," = 1")),
#       expression(paste(zeta," = 0 ")*paste(sigma, " = 0.5 ")*
#       paste(theta," = 0")),expression(paste(zeta," = 0 ")*
#       paste(sigma, " = 1 ")*paste(theta," = 0")),
#       expression(paste(zeta," = 1 ")*paste(sigma, " = 1/8 ")*
#       paste(theta," = 0"))),col=c("green","red","blue","orange"),
#       text.col="black",lwd=2,bty="o",inset=0.04)
#abline(v=0,lty=2,col="grey")
#abline(h=0,lty=2,col="grey")
##plot different distribution functions
#screen(2)
#plot(x,y=plnorm3(x,0,1/8,1),col="green",xlim=c(0,3),type="l",lwd=2,xlab="x",
#     ylab="F(x)",
#     main="Cumulative Distribution Function of Log-Normal-Distribution")
#lines(x,y=plnorm3(x,0,0.5,0),lwd=2,col="red")
#lines(x,y=plnorm3(x,0,1,0),lwd=2,col="blue")
#lines(x,y=plnorm3(x,1,1/8,0),lwd=2,col="orange")
##add legend
#legend("topleft",legend=c(expression(paste(zeta," = 0 ")*
#       paste(sigma, " = 1/8 ")*paste(theta," = 1")),
#       expression(paste(zeta," = 0 ")*paste(sigma, " = 0.5 ")*
#       paste(theta," = 0")),expression(paste(zeta," = 0 ")*
#       paste(sigma, " = 1 ")*paste(theta," = 0")),
#       expression(paste(zeta," = 1 ")*paste(sigma, " = 1/8 ")*
#       paste(theta," = 0"))),col=c("green","red","blue","orange"),
#       text.col="black",lwd=2,bty="o",inset=0.04)
#abline(v=0,lty=2,col="grey")
#abline(h=0,lty=2,col="grey")
#close.screen(all=TRUE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.