Skip to contents

Draw n samples from uniform, normal, truncated normal (-> positive only), lognormal or gamma distributions based on two input values

Usage

rdist(dist_name, value_1, value_2, n, shift = 0, seed = NULL)

Arguments

dist_name

Character vector specifying the Name of the distribution. Either "none", "uniform", "normal" "tnormal" (for truncated), "lognormal", "gamma", "derived", "tderived" or "logderived"

value_1, value_2

Distribution parameters based on dist_name:
"none": value_1 is used as constantvalue, value_2 not used
"normal": value_1 is mean, value_2 is standard deviation
"tnormal": value_1 is mean, value_2 is standard deviation
"lognormal": value_1 is log mean, value_2 is standard log deviation (both natural logarithms)
"gamma": value_1 is shape, value_2 is rate
"uniform": value_1 is minimum, value_2 is maximum
"derived": value_1 is minimum of uniform distribution, value_2 is maximum of uniform distribution. Uniform distribution accounts for 95% of all data
"tderived": value_1 is minimum of uniform distribution, value_2 is maximum of uniform distribution. Uniform distribution accounts for 95% of all data
"logderived": value_1 is minimum of log-uniform distribution, value_2 is maximum of log-uniform distribution (values not log-scaled). Log-Uniform distribution accounts for 95% of all data

n

Number of samples to be drawn

shift

An numeric value defining a subsequent shift of the distribution The default is 0 (-> no shift)

seed

A numeric value to set the seed for random selection. The default is NULL -> no seed

Value

Numeric vector of length n with randomly drawn samples of the specified distribution

Details

The values specified in value_1 and value_2 represent min and max for "uniform", mean and standard deviation for "normal" and "tnormal", log mean and log standard deviation (both natural logarithm) for "lognormal", shape and rate for"gamma". The shift value is especially interesting for lognormal or gamma distributions.