documair (version 0.6-0)

dpert: The (Modified) PERT Distribution

Description

((just an example extracted from the mc2d package to illustrate the use of reduced documentation with a series of related and aliased functions.)) Density, distribution function, quantile function and random generation for the PERT (aka Beta PERT) distribution with minimum equals to min, mode equals to mode and maximum equals to max.

Usage

dpert(x,min=-1,mode=0,max=1,shape=4,log=FALSE) ppert(q,min=-1,mode=0,max=1,shape=4,lower.tail=TRUE,log.p=FALSE) qpert(p,min=-1,mode=0,max=1,shape=4,lower.tail=TRUE,log.p=FALSE) rpert(n,min=-1,mode=0,max=1,shape=4)

Arguments

x,q
Vector of quantiles.
p
Vector of probabilities.
n
Number of observations. If length(n) > 1, the length is taken to be the number required.
min
Vector of minima.
mode
Vector of modes.
max
Vector of maxima.
shape
Vector of scaling parameters. Default value: 4.
log, log.p
Logical; if TRUE, probabilities p are given as log(p).
lower.tail
Logical; if TRUE (default), probabilities are P[X <= x]<="" span="">, otherwise, P[X > x].

Value

dpert gives the density, ppert gives the distribution function, qpert gives the quantile function, and rpert generates random deviates.

Details

The PERT distribution is a beta distribution extended to the domain [min, max] with mean $$\mu=\frac{min+shape\times mode+max}{shape+2}$$ The underlying beta distribution is specified by $shape1$ and $shape2$ defined as $$\alpha_{1}=\frac{(\mu-min)(2\times mode-min-max)}{(mode-\mu)(max-min)}$$ $$\alpha_{2}=\frac{\alpha_{1}\times (max-\mu)}{mu-min}$$ If $mu=mode$, $shape1$ is set to $1+shape/2$. David Vose proposed a modified PERT distribution with a shape parameter different from 4. The PERT distribution is frequently used to translate expert estimates of the min, max and mode of a random variable in a smooth parametric distribution.

Examples

Run this code
  curve(dpert(x,min=3,mode=5,max=10,shape=6), from = 2, to = 11, lty=3) 
  curve(dpert(x,min=3,mode=5,max=10), from = 2, to = 11, add=TRUE) 
  curve(dpert(x,min=3,mode=5,max=10,shape=2), from = 2, to = 11, add=TRUE,lty=2) 
  legend(x = 8, y = 2, c("Default","shape:2","shape:6"), lty=1:3) 

Run the code above in your browser using DataLab