The type 1 discrete Weibull distribution

Share:

Description

Probability mass function, distribution function, quantile function and random generation for the discrete Weibull distribution with parameters q and β

Usage

1
2
3
4
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

TRUE, if the support contains 0; FALSE otherwise

n

sample size

Details

The discrete Weibull distribution has probability mass function given by P(X=x;q,β)=q^{(x-1)^{β}}-q^{x^{β}}, x=1,2,3,…, if zero=FALSE; or P(X=x;q,β)=q^{x^{β}}-q^{(x+1)^{β}}, x=0,1,2,…, if zero=TRUE. The cumulative distribution function is F(x;q,β)=1-q^{x^{β}} if zero=FALSE; F(x;q,β)=1-q^{(x+1)^{β}} 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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)