rnorm_within: Normal distribution within a defined tolerance interval

Description Usage Arguments Details Value Examples

View source: R/norm.r

Description

Returns a normally distributed vector within the tolerance interval defined by lower and upper.

Usage

1
2
rnorm_within(n, lower = 0, upper = 1, confidence_level = 0.9,
  sigma = NA)

Arguments

n

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

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 interval lower, upper is obtained. To specify sigmas instead, set confidence_level = NA.

sigma

(optional) numeric. If confidence_level = NA, the number of standard deviations between lower and upper.

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 * 100 percent of values will fall between lower and upper. If there is a problem, will return NULL and print an error message.

Examples

1
2
3
rnorm_within(10)
rnorm_within(10, 10, 20)
summary(rnorm_within(10000, 10, 20))

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