cdfwei.RdDistribution function and quantile function of the Weibull distribution.
The Weibull distribution with location parameter \(\zeta\), scale parameter \(\beta\) and shape parameter \(\delta\) has distribution function $$F(x)=1-\exp[-\lbrace(x-\zeta)/\beta\rbrace^\delta]$$ for \(x>\zeta\).
cdfwei gives the distribution function;
quawei gives the quantile function.
The functions expect the distribution parameters in a vector,
rather than as separate arguments as in the standard R
distribution functions pnorm, qnorm, etc.
cdfgev for the generalized extreme-value distribution,
of which the Weibull (reflected through the origin) is a special case.
# Random sample from a 2-parameter Weibull distribution
# with scale parameter 2 and shape parameter 1.5.
quawei(runif(100), c(0,2,1.5))
#> [1] 1.03437107 0.58618974 2.74540513 0.65806475 2.66747735 1.47747819
#> [7] 1.37061702 1.80105758 2.39352992 3.43015623 0.79127358 0.98331405
#> [13] 2.82204676 0.25145850 1.58236799 0.84908331 1.84982272 4.65014856
#> [19] 0.82494160 3.19651672 0.47949518 2.75522162 2.09582607 2.07360533
#> [25] 0.80760963 3.09386542 1.37814943 0.97710106 2.01990311 0.91068006
#> [31] 1.24001533 1.95368433 1.69496665 1.52108210 2.55648592 4.38358565
#> [37] 0.92691604 2.39637721 0.54961940 0.27002348 2.27860405 0.58759273
#> [43] 2.58099995 0.67026365 0.47948678 3.96004923 3.03987548 1.78989200
#> [49] 2.17822673 0.41220118 2.66581000 0.80933102 1.41409786 0.62767593
#> [55] 0.66959688 0.73091685 1.16148222 0.68416848 1.75725962 2.10024258
#> [61] 2.10471476 0.03588782 5.86960260 1.98328413 0.12022566 0.74999499
#> [67] 2.11554667 1.45911254 1.16894036 2.21959957 0.89541792 3.07365354
#> [73] 1.50679187 1.68106332 2.11002645 1.00817262 0.90789130 1.01943413
#> [79] 3.25797682 2.34228152 1.29731734 0.14513911 0.27678347 2.27289841
#> [85] 0.33540067 0.22127829 0.14912214 1.20292734 0.80582695 1.54218782
#> [91] 1.40969454 2.22301932 3.01385070 1.21130043 5.20000317 4.20210370
#> [97] 5.52787515 1.39961509 0.60640966 4.06296766
# Illustrate the relation between Weibull and GEV distributions.
# weifit() fits a Weibull distribution to data and returns
# quantiles of the fitted distribution
# gevfit() fits a Weibull distribution as a "reverse GEV",
# i.e. fits a GEV distribution to the negated data,
# then computes negated quantiles
weifit <- function(qval, x) quawei(qval, pelwei(samlmu(x)))
gevfit <- function(qval, x) -quagev(1-qval, pelgev(samlmu(-x)))
# Compare on Ozone data
data(airquality)
weifit(c(0.2,0.5,0.8), airquality$Ozone)
#> [1] 14.29301 32.85596 65.02996
gevfit(c(0.2,0.5,0.8), airquality$Ozone)
#> [1] 14.29301 32.85596 65.02996