ShiftedLognormal: The Shifted Log-normal Distribution

ShiftedLognormalR Documentation

The Shifted Log-normal Distribution

Description

Density, distribution and quantile functions, and random number generation for the shifted log-normal distribution.

Usage

dslnorm(x, shift, meanlog = 0, sdlog = 1, log = FALSE)

pslnorm(q, shift, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE)

qslnorm(p, shift, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE)

rslnorm(n, shift, meanlog = 0, sdlog = 1)

Arguments

x, q

vector of quantiles.

shift

vector of shifts.

meanlog, sdlog

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

log, log.p

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

lower.tail

logical; if TRUE (default), probabilities are P[X \leq 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

Let Y have a log-normal distribution with parameters \mu (meanlog) and \sigma (sdlog). Then X = Y + s has a shifted log-normal distribution with shift s (shift), mean E(X) = exp(\mu + 1/2 \sigma^2) + s and variance Var(X) = exp(2*\mu + \sigma^2)*(exp(\sigma^2) - 1).

Note [dpqr]slnorm are wrappers for the corresponding [dpqr]lnorm functions.

Value

dslnorm gives the density, pslnorm gives the distribution function, qslnorm gives the quantile function, and rslnorm 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.

See Also

Lognormal

Examples

curve(dslnorm(x, shift=6.5), from=0, to=15, n=1e3)
rr <- rslnorm(1e3, shift=6.5)
lines(density(rr, adj=.1), lty=2)

all.equal (qslnorm(c(.025, .9), shift=6.5) - 6.5, qlnorm(c(.025, .9)))
all.equal (pslnorm(10, shift=6.5), plnorm(10 - 6.5))


dosreislab/bppr documentation built on April 10, 2023, 6:12 p.m.