Learn R Programming

metaBMA (version 0.3.9)

dtriangular: Triangular Distribution

Description

Distribution with a triangular density function.

Usage

dtriangular(x, min, peak, max, log = FALSE)

rtriangular(n, min, peak, max)

Arguments

x

vector of quantiles

min

lower bound of distribution

peak

peak of triangle density

max

upper bound of distribution

log

logical; if TRUE, probabilities p are given as log(p)

n

number of samples

Examples

Run this code
# NOT RUN {
plot(prior("triangular", c(.2, .6, 1.3)), 0, 2)

samples <- rtriangular(1e5, .2, .5, 1)
hist(samples, 200, FALSE)
curve(dtriangular(x, .2, .5, 1), col = 2,
      add = TRUE, lwd = 2)
# }

Run the code above in your browser using DataLab