Skip to contents

Create random distribution

Usage

create_random_distribution(
  type = "uniform",
  number_of_repeatings = 1,
  number_of_events = 365,
  value = 10,
  min = 10,
  max = 1000,
  percent_within_minmax = 0.9,
  min_zero = 0.01,
  log10_min = default_min(min, max, min_zero, f = log10),
  log10_max = default_max(max, min_zero * 10, f = log10),
  log10_mean = (log10_min + log10_max)/2,
  log10_sdev = abs((log10_max - log10_mean)/get_percentile(percent_within_minmax)),
  mean = (default_min(min, max, min_zero) + default_max(max, 10 * min_zero))/2,
  sdev = abs((default_max(max, 10 * min_zero) -
    mean)/get_percentile(percent_within_minmax)),
  meanlog = mean(log(default_min(min, max, min_zero) + default_max(max, 10 *
    min_zero))/2),
  sdlog = abs(sd(c(default_min(min, max, min_zero, f = log), default_max(max, 10 *
    min_zero, f = log)))),
  mode = (default_min(min, max, min_zero) + default_max(max, 10 * min_zero))/2,
  debug = TRUE
)

Arguments

type

"uniform" calls runif, "log10_uniform" calls 10^runif(number_of_events, log10_min, log10_max), "triangle" calls rtri, "lognorm" calls rlnorm, "norm" calls rnorm and "log10_norm" calls 10^rnorm(number_of_events, mean = log10_mean, sdev = log10_sdev), (default: "uniform")

number_of_repeatings

how often should the random distribution with the same parameters be generated (default: 1)

number_of_events

number of events

value

constant value (no random number), gets repeated number_of_events times (if 'type' = 'value')

min

minimum value (default: 10), only used if 'type' is "uniform" or "triangle"

max

maximum value (default: 1000), only used if 'type' is "uniform" or "triangle"

percent_within_minmax

percent of data point within min/max (default: 0.9 i.e. 90 percent,see also get_percentile

min_zero

only used if 'type' is "log10_uniform" or "log10_norm", "norm" or "lognorm" and "min" value equal zero. In this case the zero is replaced by this value (default: 0.01), see also default_min

log10_min

minimum value (default: default_min(min, max, min_zero, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"

log10_max

maximum value (default: default_max(max, min_zero * 10, f = log10)), only used if 'type' is "log10_uniform" or "log10_norm"

log10_mean

mean value (default: (log10_min + log10_max)/2), only used if 'type' is "log10_norm"

log10_sdev

standard deviation (default: abs((log10_max- log10_mean) / get_percentile(percent_within_minmax))), only used if 'type' is "log10_norm"

mean

mean value (default: (default_min(min, max, min_zero) / default_max(max, 10*min_zero)) / 2), only used if 'type' is "norm"

sdev

standard deviation (default: abs((log10_max - log10_mean) / get_percentile(percent_within_minmax))), only used if 'type' is "norm"

meanlog

log mean value (default: mean(log( default_min(min, max, min_zero) + default_max(max, 10 * min_zero)) / 2)), only used if 'type' is "lognorm"

sdlog

standard deviation (default: abs(sd(c( default_min(min, max, min_zero, f = log), default_max(max, 10 * min_zero, f = log)))), only used if 'type' is "lognorm"

mode

(default: default_min(min, max, min_zero) + default_max(max, 10 * min_zero) / 2), only used if 'type' is "triangle"

debug

print debug information (default: TRUE)

Value

list with parameters of user defined random distribution and corresponding values

See also

for random triangle see rtri, for default min/max see default_min, default_max and get_percentile