invweibullDist | R Documentation |
Density, distribution function, quantile function and random numbers generator for the Inverse Weibull Distribution.
dinvweibull(x, scale = 1, shape, log = FALSE)
pinvweibull(q, scale = 1, shape, lower.tail = TRUE, log.p = FALSE)
qinvweibull(p, scale = 1, shape, lower.tail = TRUE, log.p = FALSE)
rinvweibull(n, scale = 1, shape)
x, q, p, n |
Same as |
scale, shape |
Scale and shape parameters, same as |
log, log.p, lower.tail |
Same as |
The Inverse Weibull density with parameters scale = b and
shape = s
, is
f(y) = s b^s y^{-s-1} \exp{[-(y/b)^{-s}}],
for y > 0
, b > 0
, and s > 0
.
The Weibull distribution and the Inverse Weibull distributions are related as follows:
Let X
be a Weibull random variable with paramaters scale =b
and shape =s
. Then, the random variable Y = 1/X
has
the Inverse Weibull density with parameters scale = 1/b
and
shape = s
. Thus, algorithms of [dpqr]-Inverse Weibull
underlie on Weibull
.
Let Y
be a r.v. distributed as Inverse Weibull (b, s
).
The k^{th}
moment exists for
-\infty < k < s
and is given by
E[Y^k] = b^{k} \ \Gamma(1 - k/s).
The mean (if s > 1
) and variance (if s > 2
) are
E[Y] = b \ \Gamma(1 - 1/s); \ \ \ Var[Y] = b^{2} \
[\Gamma(1 - 2/s) - (\Gamma(1 - 1/s))^2].
Here, \Gamma(\cdot)
is the gamma function as in
gamma
.
dinvweibull()
returns the density, pinvweibull()
computes the
distribution function, qinvweibull()
gives the quantiles, and
rinvweibull()
generates random numbers from the Inverse Weibull
distribution.
The order of the arguments of [dpqr]-Inverse Weibull does not match
those in Weibull
.
Small values of scale or shape will provide Inverse Weibull
values too close to zero. Then, function rinvweibull()
with such
characteristics will return either values too close to zero or values
represented as zero in computer arithmetic.
The Inverse Weibull distribution, which is that of X
where
1/X
has the Weibull density, is known as the log-Gompertz
distribution. Thus, in order to emphazise the continuity concept of the
Inverse Weibull density, if x = 0
, then dinvweibull
returns zero, which is the limit of such a density when 'x'
tends to zero.
V. Miranda and T. W. Yee.
Kleiber, C. and Kotz, S. (2003) Statistical Size Distributions in Economics and Actuarial Sciences. Wiley Series in Probability and Statistics. Hoboken, New Jersey, USA.
Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. ch.6, p.255. Dover, New York, USA.
Weibull
,
gamma
.
#(1) ______________
n <- 20
scale <- exp(2)
shape <- exp(1)
data.1 <- runif(n, 0, 1)
data.q <- qinvweibull(-data.1, scale = scale, shape = shape, log.p = TRUE)
data.p <- -log(pinvweibull(data.q, scale = scale, shape = shape))
arg.max <- max(abs(data.p - data.1)) # Should be zero
#(2)_________________
scale <- exp(1.0)
shape <- exp(1.2)
xx <- seq(0, 10.0, len = 201)
yy <- dinvweibull(xx, scale = scale, shape = shape)
qtl <- seq(0.1, 0.9, by =0.1)
d.qtl <- qinvweibull(qtl, scale = scale, shape = shape)
plot(xx, yy, type = "l", col = "red",
main = "Red is density, blue is cumulative distribution function",
sub = "Brown dashed lines represent the 10th, ... 90th percentiles",
las = 1, xlab = "x", ylab = "", ylim = c(0,1))
abline(h = 0, col= "navy", lty = 2)
lines(xx, pinvweibull(xx, scale = scale, shape = shape), col= "blue")
lines(d.qtl, dinvweibull(d.qtl, scale = scale, shape = shape),
type ="h", col = "brown", lty = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.