ShiftedLognormal | R Documentation |
Density, distribution and quantile functions, and random number generation for the shifted log-normal distribution.
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)
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 |
vector of probabilities. |
n |
number of observations. If |
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.
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.
Lognormal
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.