Discrete Weibull (Type 1) {DiscreteWeibull} | R Documentation |
The type 1 discrete Weibull distribution
Description
Probability mass function, distribution function, quantile function and random generation for the discrete Weibull distribution with parameters q
and \beta
Usage
ddweibull(x, q, beta, zero = FALSE)
pdweibull(x, q, beta, zero = FALSE)
qdweibull(p, q, beta, zero = FALSE)
rdweibull(n, q, beta, zero = FALSE)
Arguments
x |
vector of quantiles |
p |
vector of probabilities |
q |
first parameter |
beta |
second parameter |
zero |
|
n |
sample size |
Details
The discrete Weibull distribution has probability mass function given by P(X=x;q,\beta)=q^{(x-1)^{\beta}}-q^{x^{\beta}}
, x=1,2,3,\ldots
, if zero
=FALSE
; or P(X=x;q,\beta)=q^{x^{\beta}}-q^{(x+1)^{\beta}}
, x=0,1,2,\ldots
, if zero
=TRUE
. The cumulative distribution function is F(x;q,\beta)=1-q^{x^{\beta}}
if zero
=FALSE
; F(x;q,\beta)=1-q^{(x+1)^{\beta}}
otherwise
Value
ddweibull
gives the probability function, pdweibull
gives the distribution function, qdweibull
gives the quantile function, and rdweibull
generates random values.
Author(s)
Alessandro Barbiero
Examples
# Ex.1
x <- 1:10
q <- 0.6
beta <- 0.8
ddweibull(x, q, beta)
t <- qdweibull(0.99, q, beta)
t
pdweibull(t, q, beta)
#
x <- 0:10
ddweibull(x, q, beta, zero=TRUE)
t <- qdweibull(0.99, q, beta, zero=TRUE)
t
pdweibull(t, q, beta, zero=TRUE)
# Ex.2
q <- 0.4
beta <- 0.7
n <- 100
x <- rdweibull(n, q, beta)
tabulate(x)/sum(tabulate(x))
y <- 1:round(max(x))
# compare with
ddweibull(y, q, beta)