R: The Triangular Distribution

triangular {mc2d} | R Documentation

## The Triangular Distribution

### Description

Density, distribution function, quantile function and random generation for the triangular distribution with minimum equal to min, mode equal mode and maximum equal to max.

### Usage

    dtriang(x, min=-1, mode=0, max=1, log=FALSE)
    ptriang(q, min=-1, mode=0, max=1, lower.tail=TRUE, log.p=FALSE)
    qtriang(p, min=-1, mode=0, max=1, lower.tail=TRUE, log.p=FALSE)
    rtriang(n, min=-1, mode=0, max=1)

### 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.
`log, log.p` | logical; if TRUE, probabilities p are given as log(p).
`lower.tail` | logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

### Details

For the case of u := min == mode == max, there is no density in that case and dtriang will return NaN (the error condition) (Similarity with dunif).

### Value

dtriang gives the density, ptriang gives the distribution function, qtriang gives the quantile function, and rtriang generates random deviates.

### Examples

    curve(dtriang(x, min=3, mode=5, max=10), from = 2, to = 11)
    ##no density when min == mode == max
    dtriang(c(1, 2, 3), min=2, mode=2, max=2)

[Package mc2d version 0.1-18 Index]