ltriangle: The Logarithmic Triangle Distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These functions provide information about the triangle distribution on the logarithmic interval from a to b with a maximum at c. dltriangle gives the density, pltriangle gives the distribution function, qltriangle gives the quantile function, and rltriangle generates n random deviates.

Usage

1
2
3
4
dltriangle(x, a=1, b=100, c=10^((log10(a)+log10(b))/2), logbase=10)
pltriangle(q, a=1, b=100, c=10^((log10(a)+log10(b))/2), logbase=10)
qltriangle(p, a=1, b=100, c=10^((log10(a)+log10(b))/2), logbase=10)
rltriangle(n=1, a=1, b=100, c=10^((log10(a)+log10(b))/2), logbase=10)

Arguments

x,q

vector of quantiles.

p

vector of probabilities.

a

lower limit of the distribution.

b

upper limit of the distribution.

c

mode of the distribution.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

logbase

the base of the logarithm to use.

Details

All probabilities are lower tailed probabilties.

a, b, and c may be appropriate length vectors except in the case of rtriangle.

Value

dltriangle gives the density, pltriangle gives the distribution function, qltriangle gives the quantile function, and rltraingle generates random deviates.

Invalid arguments will result in return value NaN or NA.

Author(s)

Rob Carnell

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth \& Brooks/Cole.

See Also

.Random.seed about random number generation, runif, etc for other distributions.

Examples

1
2
3
4
5
6
7
## view the distribution
tri <- rltriangle(100000, 1, 100, 10)
hist(log10(tri), breaks=100, main="Triangle Distribution", xlab="x")

dltriangle(10, 1, 100, 10) # 2/(log10(b)-log10(a)) = 1

qltriangle(pltriangle(10)) # 10

Example output

[1] 1
[1] 10

triangle documentation built on May 2, 2019, 5:54 p.m.