rtriangle_within: Triangle distribution within a defined tolerance interval

Description Usage Arguments Details Value Examples

View source: R/triangle.r

Description

Returns a triangle-distributed vector within the confidence_level tolerance interval defined by lower and upper.

Usage

1
2
rtriangle_within(n, peak = 0.5, lower = 0, upper = 1,
  confidence_level = 0.9, lower_bound = -Inf, upper_bound = Inf)

Arguments

n

(required) integer. The number of random numbers to generate.

peak

(optional) numeric. The location of the peak (most likely value) of the triangle distribution.

lower

(optional) numeric. The lower (1 - confidence_level)/2 tolerance limit.

upper

(optional) numeric. The upper (1 + confidence_level)/2 tolerance limit.

confidence_level

(optional) numeric. The confidence level at which upper and lower are entered.

lower_bound

(optional) numeric. The lower boundary for returned values; no random values can be below this value. e.g. for processes where negative values do not make sense, lower = 0.

upper_bound

(optional) numeric. The upper boundary for returned values; no random values can be above this value.

Details

confidence_level indicates the confidence level of the interval [lower, upper]. For example, a high-confidence estimate might be 0.9973, or six standard deviations between lower and upper.

Value

numeric vector with n elements randomly distributed so that approximately confidence_level percent of values will fall between lower and upper. If an error occurs, will usually return NULL and print an error message.

Examples

1
2
3
rtriangle_within(10)
rtriangle_within(10, 12, 10, 20)
summary(rtriangle_within(10000, 12, 10, 20))

tomhopper/randr documentation built on Nov. 8, 2021, 2:01 p.m.