# The Triangular Distribution.

### Description

Density, distribution, quantile, random number
generation and parameter estimation functions for the triangular distribution with support *[a,b]*
and `shape`

parameter *θ*. Parameter estimation can be based on a weighted or unweighted i.i.d. sample
and can be performed numerically.

### Usage

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
dTriangular(x, a = 0, b = 1, theta = 0.5, params = list(a, b, theta),
...)
pTriangular(q, a = 0, b = 1, theta = 0.5, params = list(a, b, theta),
...)
qTriangular(p, a = 0, b = 1, theta = 0.5, params = list(a, b, theta),
...)
rTriangular(n, a = 0, b = 1, theta = 0.5, params = list(a, b, theta),
...)
eTriangular(X, w, method = "numerical.MLE", ...)
lTriangular(X, w, a = 0, b = 1, theta = 0.5, params = list(a, b, theta),
logL = TRUE, ...)
``` |

### Arguments

`x,q` |
A vector of quantiles. |

`a,b` |
Boundary parameters. |

`theta` |
Shape parameters. |

`params` |
A list that includes all named parameters. |

`...` |
Additional parameters. |

`p` |
A vector of probabilities. |

`n` |
Number of observations. |

`X` |
Sample observations. |

`w` |
An optional vector of sample weights. |

`method` |
Parameter estimation method. |

`logL` |
logical, it is assumed that the log-likelihood is desired. Set to FALSE if the likelihood is wanted. |

### Details

If `a`

, `b`

or `theta`

are not specified they assume the default values of 0, 1 and 0.5 respectively.

The `dTriangle()`

, `pTriangle()`

, `qTriangle()`

,and `rTriangle()`

functions serve as wrappers of the
`dtriangle`

, `ptriangle`

, `qtriangle`

, and
`rtriangle`

functions in the VGAM package. They allow for the parameters to be declared not only as
individual numerical values, but also as a list so parameter estimation can be carried out.

The triangular distribution has a probability density function, defined in Forbes et.al (2010), that consists of two lines joined at *theta*,
where *theta* is the location of the mode.

### Value

dTriangular gives the density, pTriangular the distribution function, qTriangular the quantile function, rTriangular generates random variables, and eTriangular estimates the parameters. lTriangular provides the log-likelihood function.

### Author(s)

Haizhen Wu and A. Jonathan R. Godfrey.

Updates and bug fixes by Sarah Pirikahu.

### References

Kotz, S. and van Dorp, J. R. (2004). Beyond Beta: Other Continuous
Families of Distributions with Bounded Support and Applications. Chapter 1.
World Scientific: Singapore.

Forbes, C., Evans, M., Hastings, N. and Peacock, B. (2010) Triangular Distribution,
in Statistical Distributions, Fourth Edition, John Wiley & Sons, Inc., Hoboken, NJ, USA.

### See Also

ExtDist for other standard distributions.