random.estimate1d {decisionSupport}R Documentation

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 class '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 Name method
"const" Deterministic case not applicable
"norm" Normal calculate, fit
"posnorm" Positive normal calculate, fit
"tnorm_0_1" 0-1-truncated normal calculate, fit
"beta" Beta fit
"cauchy" Cauchy fit
"logis" Logistic fit
"t" Student t fit
"chisq" Central Chi-Squared fit
"chisqnc" Non-central Chi-Squared fit
"exp" Exponential fit
"f" Central F fit
"gamma" Gamma with scale=1/rate fit
"lnorm" Log Normal calculate, fit
"unif" Uniform calculate, fit
"weibull" Weibull fit
"triang" Triangular fit
"gompertz" Gompertz fit
"pert" (Modified) PERT fit

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.


[Package decisionSupport version 1.114 Index]