# ddweibull3: The type 3 discrete Weibull distribution In DiscreteWeibull: Discrete Weibull Distributions (Type 1 and 3)

## Description

Probability mass function, distribution function, quantile function, random generation, and hazard function for the type 3 discrete Weibull distribution with parameters c and β

## Usage

 ```1 2 3 4 5``` ```ddweibull3(x, c, beta) pdweibull3(x, c, beta) qdweibull3(p, c, beta) rdweibull3(n, c, beta) hdweibull3(x, c, beta) ```

## Arguments

 `x` vector of values/quantiles `p` vector of probabilities `c` first parameter `beta` second parameter `n` sample size

## Details

The type 3 discrete Weibull distribution is characterized by the following cumulative distribution function: F(x;c,β)=1-\exp(-c∑_{j=0}^{x+1}j^{β}), for x=0,1,2,…, with c>0 and β>=-1.

## Value

`ddweibull3` gives the probability function, `pdweibull3` gives the distribution function, `qdweibull3` gives the quantile function, `hdweibull3` gives the hazard 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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53``` ```# ddweibull3 x <- 0:10 c <- 0.3 beta <- 0.75 p <- ddweibull3(x, c, beta) p plot(x, p, type="b", ylab=expression(P(X)==x)) # pdweibull3 x <- 0:10 c <- 0.5 beta <- 0.5 p <- pdweibull3(x, c, beta) p cumsum(ddweibull3(x, c, beta)) plot(x, p, type="s", ylab=expression(P(X<=x))) # qdweibull3 p <- c(1:9)/10 p c <- 0.1 beta <- 0.5 qdweibull3(p, c, beta) pdweibull3(10, c, beta) pdweibull3(9, c, beta) # rdweibull3 n <- 20 c <- 0.25 beta <- -0.25 x <- rdweibull3(n, c, beta) x beta <- 0 x <- rdweibull3(n, c, beta) x beta <- 0.25 x <- rdweibull3(n, c, beta) x n <- 1000 x <- rdweibull3(n, c, beta) obs <- c(sum(x==0), tabulate(x)) obs <- obs/sum(obs) theo <- ddweibull3(min(x):max(x), c, beta) barplot(rbind(obs, theo), beside=TRUE, names.arg=min(x):max(x), ylab="relative frequency/probability", col=1:2) legend(24, 0.1, c("observed", "theoretical"), pch=15, col=1:2) #hdweibull3 x <- 0:15 c <- 0.5 hn<-hdweibull3(x, c, beta = -0.5) h0<-hdweibull3(x, c, beta = 0) hp<-hdweibull3(x, c, beta = 0.5) plot(x, hn, type="b", ylim = c(0, 1), ylab="hazard rate") points(x, h0, type = "b", col=2) points(x, hp, type = "b", col=3) legend(11, 0.5, c("beta<0", "beta=0", "beta>0"), col=1:3, pch=21) ```

DiscreteWeibull documentation built on May 2, 2019, 8:58 a.m.