Learn R Programming

decisionSupport (version 1.114)

random.estimate1d: Generate univariate random numbers defined by a 1-d estimate.

Description

This function generates random numbers for univariate parametric distributions, whose parameters are determined by a one dimensional estimate (estimate1d).

Usage

# S3 method for estimate1d
random(rho, n, method = "calculate", relativeTolerance = 0.05, ...)

Arguments

rho

estimate1d: Univariate distribution to be randomly sampled.

n

integer: Number of observations to be generated

method

character: Particular method to be used for random number generation. It can be either "calculate" (the default) or "fit". Details below.

relativeTolerance

numeric: the relative tolerance level of deviation of the generated confidence interval from the specified interval. If this deviation is greater than relativeTolerance a warning is given.

...

Optional arguments to be passed to the particular random number generating function (cf. below). @details

rho[["distribution"]]:

The follwing table shows the available distributions and the implemented generation method:

rho[["distribution"]]Distribution Namemethod
"const"Deterministic casenot applicable
"norm"Normalcalculate, fit
"posnorm"Positive normalcalculate, fit
"tnorm_0_1"0-1-truncated normalcalculate, fit
"beta"Betafit
"cauchy"Cauchyfit
"logis"Logisticfit
"t"Student tfit
"chisq"Central Chi-Squaredfit
"chisqnc"Non-central Chi-Squaredfit
"exp"Exponentialfit
"f"Central Ffit
"gamma"Gamma with scale=1/ratefit
"lnorm"Log Normalcalculate, fit
"unif"Uniformcalculate, fit
"weibull"Weibullfit
"triang"Triangularfit
"gompertz"Gompertzfit
"pert"(Modified) PERTfit

For distribution="const" the argument method is obsolete, as a constant is neither fitted nor calculated.

rho[["method"]]

If supplied, i.e. !is.null(rho[["method"]]), this value overwrites the function argument method.

method

This parameter defines, how the parameters of the distribution to be sampled are derived from rho[["lower"]], rho[["upper"]] and possibly rho[["median"]]. Possibilities are "calculate" (the default) or "fit":

method="calculate"

The parameters are calculated if possible using the exact (analytical) formula or, otherwise, numerically. This calculation of the distribution parameters is independent of rho[["median"]] being supplied or not. For the implemented distributions, it only depends on rho[["lower"]] and rho[["upper"]]. However, if it is supplied, i.e. is.numeric(rho[["median"]]), a check is performed, if the relative deviation of the generated median from rho[["median"]] is greater than relativeTolerance. In this case a warning is given.

method="fit"

The parameters are obtained by fitting the distribution on the supplied quantiles. Given that rho[["median"]]==NULL the distribution is fitted only to lower and upper and a warning is given; due to the used numerical procedure, the calculated parameters might define a distribution which strongly deviates from the intended one. There is larger control on the shape of the distribution to be generated by supplying the estimate of the median. If is.numeric(rho[["median"]]) the distribution is fitted to lower, upper and median.

...

For passing further parameters to the function which generates the random numbers, cf. the above table and follow the link in the column method.

See Also

estimate1d; For method="calculate": rdist90ci_exact; for method="fit": rdistq_fit; for both methods: rposnorm90ci and rtnorm_0_1_90ci. For the default method: random.