Learn R Programming

VGAMextra (version 0.0-1)

invweibullDist: The Inverse Weibull Distribution

Description

Density, distribution function, quantile function and random numbers generator for the Inverse Weibull Distribution.

Usage

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)

Arguments

x, q, p, n

Same as Weibull.

scale, shape

Scale and shape parameters, same as Weibull. Both must be positive.

log, log.p, lower.tail

Same as Weibull.

Value

dinvweibull() returns the density, pinvweibull() computes the distribution function, qinvweibull() gives the quantiles, and rinvweibull() generates random numbers from the Inverse Weibull distribution.

Warning

The order of the arguments of [dpqr]-Inverse Weibull does not match those in Weibull.

Details

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.

References

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.

See Also

Weibull, gamma.

Examples

Run this code
# NOT RUN {
  #(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
  
# }
# NOT RUN {
  #(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)
        
# }

Run the code above in your browser using DataLab