Weib | R Documentation |
The Weibull distribution is an absolute continuous probability distribution,
parameterized by a shape parameter k > 0
and a scale parameter
\lambda > 0
.
Weib(shape = 1, scale = 1)
## S4 method for signature 'Weib,numeric'
d(distr, x, log = FALSE)
## S4 method for signature 'Weib,numeric'
p(distr, q, lower.tail = TRUE, log.p = FALSE)
## S4 method for signature 'Weib,numeric'
qn(distr, p, lower.tail = TRUE, log.p = FALSE)
## S4 method for signature 'Weib,numeric'
r(distr, n)
## S4 method for signature 'Weib'
mean(x)
## S4 method for signature 'Weib'
median(x)
## S4 method for signature 'Weib'
mode(x)
## S4 method for signature 'Weib'
var(x)
## S4 method for signature 'Weib'
sd(x)
## S4 method for signature 'Weib'
skew(x)
## S4 method for signature 'Weib'
kurt(x)
## S4 method for signature 'Weib'
entro(x)
llweibull(x, shape, scale)
## S4 method for signature 'Weib,numeric'
ll(distr, x)
eweibull(x, type = "mle", ...)
## S4 method for signature 'Weib,numeric'
mle(
distr,
x,
par0 = "lme",
method = "L-BFGS-B",
lower = 1e-05,
upper = Inf,
na.rm = FALSE
)
## S4 method for signature 'Weib,numeric'
me(distr, x, par0 = "lme", lower = 0.5, upper = Inf, na.rm = FALSE)
shape , scale |
numeric. The non-negative distribution parameters. |
distr |
an object of class |
x |
For the density function, |
log , log.p |
logical. Should the logarithm of the probability be returned? |
q |
numeric. Vector of quantiles. |
lower.tail |
logical. If TRUE (default), probabilities are
|
p |
numeric. Vector of probabilities. |
n |
number of observations. If |
type |
character, case ignored. The estimator type (mle, me or lme). |
... |
extra arguments. |
par0 , method , lower , upper |
arguments passed to optim for the mle and me optimization. See Details. |
na.rm |
logical. Should the |
The probability density function (PDF) of the Weibull distribution is:
f(x; k, \lambda) = \frac{k}{\lambda}\left(\frac{x}{\lambda}
\right)^{k - 1} \exp\left[-\left(\frac{x}{\lambda}\right)^k\right],
\quad x \geq 0 .
For the parameter estimation, both the MLE and the ME cannot be explicitly
derived. However, the L-moment estimator (type = "lme"
) is available, and
is used as initialization for the numerical approximation of the MLE and the
ME.
The MLE and ME of the Weibull distribution parameters is not available in
closed form and has to be approximated numerically. The optimization can be
performed on the shape parameter k\in(0,+\infty)
.
For the MLE, this is done with optim()
. The default method used is the
L-BFGS-B method with lower bound 1e-5
and upper bound Inf
. The par0
argument can either be a numeric (satisfying lower <= par0 <= upper
) or a
character specifying the closed-form estimator to be used as initialization
for the algorithm ("lme"
- the default value).
For the ME, this is done with uniroot()
. Again, the par0
argument can
either be a numeric (satisfying lower <= par0 <= upper
) or a character
specifying the closed-form estimator to be used as initialization for the
algorithm ("mle"
or "lme"
- the default value). The lower and upper
bounds are set by default to 0.5
and Inf
, respectively. Note that the
ME equations involve the \Gamma(1 + 1 \ k)
, which can become unreliable
for small values of k
, hence the 0.5
lower bound. Specifying a lower
bound below 0.5
will result in a warning and be ignored.
Each type of function returns a different type of object:
Distribution Functions: When supplied with one argument (distr
), the
d()
, p()
, q()
, r()
, ll()
functions return the density, cumulative
probability, quantile, random sample generator, and log-likelihood functions,
respectively. When supplied with both arguments (distr
and x
), they
evaluate the aforementioned functions directly.
Moments: Returns a numeric, either vector or matrix depending on the moment
and the distribution. The moments()
function returns a list with all the
available methods.
Estimation: Returns a list, the estimators of the unknown parameters. Note that in distribution families like the binomial, multinomial, and negative binomial, the size is not returned, since it is considered known.
Variance: Returns a named matrix. The asymptotic covariance matrix of the estimator.
Kim, H. M., Jang, Y. H., Arnold, B. C., & Zhao, J. (2024). New efficient estimators for the Weibull distribution. Communications in Statistics-Theory and Methods, 53(13), 4576-4601.
Functions from the stats
package: dweibull()
, pweibull()
, qweibull()
,
rweibull()
# -----------------------------------------------------
# Weibull Distribution Example
# -----------------------------------------------------
# Create the distribution
a <- 3 ; b <- 5
D <- Weib(a, b)
# ------------------
# dpqr Functions
# ------------------
d(D, c(0.3, 2, 10)) # density function
p(D, c(0.3, 2, 10)) # distribution function
qn(D, c(0.4, 0.8)) # inverse distribution function
x <- r(D, 100) # random generator function
# alternative way to use the function
df <- d(D) ; df(x) # df is a function itself
# ------------------
# Moments
# ------------------
mean(D) # Expectation
median(D) # Median
mode(D) # Mode
var(D) # Variance
sd(D) # Standard Deviation
skew(D) # Skewness
kurt(D) # Excess Kurtosis
entro(D) # Entropy
# List of all available moments
mom <- moments(D)
mom$mean # expectation
# ------------------
# Point Estimation
# ------------------
ll(D, x)
llweibull(x, a, b)
eweibull(x, type = "mle")
eweibull(x, type = "me")
eweibull(x, type = "lme")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
mle("weib", x) # the distr argument can be a character
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.