pdf, cdf, inverse cdf, and random deviates of the truncated lognormal distribution.

rtlnorm(n, meanlog = 0, sdlog = 1, a = 0, b = Inf)

dtlnorm(x, meanlog = 0, sdlog = 1, a = 0, b = Inf)

ptlnorm(q, meanlog = 0, sdlog = 1, a = 0, b = Inf)

qtlnorm(p, meanlog = 0, sdlog = 1, a = 0, b = Inf)

Arguments

n

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

meanlog

vector of means on the natural log scale.

sdlog

vector of standard deviations on the natural log scale.

a

vector of lower truncation limits

b

vector of upper truncation limits

x, q

vector of quantiles.

p

vector of probabilities.

Value

dtlnorm gives the density, ptlnorm gives the distribution function, qtlnorm gives the quantile function, and rtlnorm generates random deviates.

Examples

rtlnorm(5, 1, 2, 0.5, 3.0)
#> [1] 0.6206480 1.4633739 1.5228823 2.6198411 0.9423038
dtlnorm(seq(0, 4, by=0.5), 1, 2, 0.5, 3.0)
#> [1] 0.0000000 0.8683931 0.5483099 0.3963080 0.3070233 0.2483090 0.2068539 #> [8] 0.0000000 0.0000000
ptlnorm(seq(0, 4, by=0.5), 1, 2, 0.5, 3.0)
#> [1] 0.0000000 0.0000000 0.3423844 0.5747301 0.7488480 0.8867606 1.0000000 #> [8] 1.0000000 1.0000000
qtlnorm(seq(0, 1, by=0.1), 1, 2, 0.5, 3.0)
#> [1] 0.5000000 0.6231619 0.7639012 0.9248935 1.1093433 1.3211198 1.5649337 #> [8] 1.8465726 2.1732182 2.5538798 3.0000000