interpret: Parse human readable distribution definitions

Description Usage Arguments Details Value Author(s) Examples

View source: R/Interpret.r

Description

Interpret textual data into probability distributions using regular expressions.

Usage

1
interpret(idata, N = NULL, rescol = "Result", dbug = FALSE, ...)

Arguments

idata

input, character or data.frame

N

number of iterations

rescol

name of result column, defaults to "Result"

dbug

use TRUE to turn on debug prints

...

excess arguments are ignored

Details

Interpretation rules are as follows: Empty space is stripped away. "X-Y" defines a uniform distribution between X and Y, if Y/X is greater than 100 then logarithmic uniform distribution is assumed.
Negative X and Y are determined by the number of "-": if 2, X is negative; if 3, both are.
"<X" defines a uniform distribution between 0 and X.
"X+-Y" defines a normal distribution with mean X and sd Y.
"X(Y-Z)" defines a normal distribution where Y-Z is assumed the 95-percent confidence interval, from which sd is determined.
If distance from mean to the higher boundary is 50-percent higher than to lower boundary log normality is assumed.
"X:Y:Z" defines a triangular distribution with min, mode and max (can be given in any order).
"X1;X2;...;Xn" defines a random unbiased sample (with replacement) between the given elements.
Numeric values are left as is.
See http://en.opasnet.org/w/Interpret for a table.

See also: http://en.opasnet.org/

Value

Returns a data.frame with an "Iter" column added. Uninterpretable values are converted to NAs.

Author(s)

T. Rintala [email protected]

Examples

1
interpret(c("1-4", "1-1000"), N = 5)

OpasnetUtils documentation built on July 4, 2017, 9:44 a.m.