Lognormalb {mc2d}R Documentation

The Log Normal Distribution parameterized through its mean and standard deviation.

Description

Density, distribution function, quantile function and random generation for a log normal distribution whose arithmetic mean equals to ‘⁠mean⁠’ and standard deviation equals to ‘⁠sd⁠’.

Usage

dlnormb(x, mean = exp(0.5), sd = sqrt(exp(2) - exp(1)), log = FALSE)

plnormb(
  q,
  mean = exp(0.5),
  sd = sqrt(exp(2) - exp(1)),
  lower.tail = TRUE,
  log.p = FALSE
)

qlnormb(
  p,
  mean = exp(0.5),
  sd = sqrt(exp(2) - exp(1)),
  lower.tail = TRUE,
  log.p = FALSE
)

rlnormb(n, mean = exp(0.5), sd = sqrt(exp(2) - exp(1)))

Arguments

x, q

vector of quantiles.

mean

the mean of the distribution.

sd

the standard deviation of the distribution.

log, log.p

logical. if 'TRUE' probabilities 'p' are given as 'log(p)'.

lower.tail

logical. if 'TRUE', probabilities are P[X \le 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

This function calls the corresponding density, distribution function, quantile function and random generation from the log normal (see Lognormal) after evaluation of meanlog = log(mean^2 / sqrt(sd^2+mean^2)) and sqrt{(log(1+sd^2/mean^2))}

Value

⁠dlnormb⁠’ gives the density, ‘⁠plnormb⁠’ gives the distribution function, ‘⁠qlnormb⁠’ gives the quantile function, and ‘⁠rlnormb⁠’ generates random deviates. The length of the result is determined by ‘⁠n⁠’ for ‘⁠rlnorm⁠’, and is the maximum of the lengths of the numerical arguments for the other functions. The numerical arguments other than ‘⁠n⁠’ are recycled to the length of the result. Only the first elements of the logical arguments are used.

The default ‘⁠mean⁠’ and ‘⁠sd⁠’ are chosen to provide a distribution close to a lognormal with ‘⁠meanlog = 0⁠’ and ‘⁠sdlog = 1⁠’.

See Also

Lognormal

Examples

x <- rlnormb(1E5,3,6)
mean(x) 
sd(x)
dlnormb(1) == dnorm(0)
dlnormb(1) == dlnorm(1)


[Package mc2d version 0.2.1 Index]