distrib: distrib

Description Usage Arguments Details Value Author(s)

View source: R/Utility.R

Description

produces random samples from distributuions

Usage

1
2
3
distrib(shape = "", par1 = NA, par2 = NA, par3 = NA, par4 = NA,
  lt = NA, ut = NA, resamp = "y", n = 1, q = NA, p = c(1),
  v = "")

Arguments

shape

Required with no default. The permited inputs are Bernoulli, binomial, beta, discrete, empirical, exponential, gamma, lognormal, normal, point, probability, triangle, uniform, and Weibull.

par1

optional value requared for some shapes. Defulat = none

par2

optional value requared for some shapes. Defulat = none

par3

optional value requared for some shapes. Defulat = none

par4

optional value requared for some shapes. Defulat = none

resamp

optional value requared for some shapes. Defulat = 'y'

n

Optional Default = 1

q

Optional Default = none

p

Optional Default = c(1)

v

Optional Default = none

It

optional value requared for some shapes. Defulat = none

Ut

optional value requared for some shapes. Defulat = none

Details

This process is central to SHEDS because it is a stochastic model. The "shape" is the essential argument, with others being required for certain shapes. For all shapes, one of "n" or "q" must be specified. If "n" is given, then Distrib returns a vector of "n" independent random samples from the specified distribution. If "q" is given, it must be a vector of numeric values, each between zero and one. These are interpreted as the quantiles of the distribution to be returned. When "q" is given, Distrib does not generate any random values, it just evaluates the requested quantiles. The empirical shape requires argument "v" as a list of possible values to be returned, each with equal probability. The other shapes require one or more of par1-par4 to be specified. See the SHEDS Technical Manual for more details on the meanings of par1-par4, which vary by shape. "Lower.trun" is the lower truncation point, meaning the smallest value that can be returned. Similarly, "upper.trun" is the largest value that may be returned. Not all distributions use lower.trun and/or upper.trun, but they should be specified for unbounded shapes like the Normal distribution. "Resamp" is a flag to indicate the resolution for generated values outside the truncation limits. If resamp="yes" then effectively new values are generated until they are within the limits. If resamp="no", values outside the limits are moved to those limits. "P" is a list of probabilities that are used only with the "discrete" or "probability" shapes. The "p" values are essentially weights for a list of discrete values that may be returned. The "empirical" distribution also returns discrete values, but assigns them equal weights, so then "p" is not needed.

Value

A vector of "n" values from one distribution, where "n" is either the input argument (if given), or the length of the input vector "q".

Author(s)

Kristin Isaacs, Graham Glen


HumanExposure/SHEDSDevel documentation built on Oct. 30, 2019, 6:49 p.m.