OpasnetUtils/Interpret

From Testiwiki
Jump to: navigation, search



Description

Interpret takes a vector or data.frame as argument. And returns a data.frame with certain textual inputs interpreted as probability distributions.

Example Regular expression Interpretation
12 000 # # 12000. Text is interpreted as number if space removal makes it a number.
-14,23 -# -14.23. Minus in the beginning of entry is interpreted as minus, not a sign for a range.
50 - 125 # - # Uniform distribution between 50 and 125.
< 4 < # Uniform distribution between 0 and 4.
-12 345 - -23.56 -# - -# Uniform distribution between -12345 and -23.56.
1 - 150 # - # Loguniform distribution between 1 and 150 (Loguniformity is assumed if the ratio of upper to lower is > 100)
3.1 ± 1.2 or 3.1 +- 1.2 # ± # or # +- # Normal distribution with mean 3.1 and SD 1.2
2.4 (1.8 - 3.0) # (# - #) Normal distribution with mean 2.4 and 95 % confidence interval from 1.8 to 3.0
2.4 (2.0 - 3.2) # (# - #) Lognormal distribution with mean 2.4 and 95 % confidence interval from 2.0 to 3.0. Lognormality is assumed if the difference from mean to upper limit is => 50 % greater than from mean to lower limit.
0:0.5:1 #:#:# Triangular distribution. Inputs are always sorted so order of arguments doesn't matter.

--# : This would be nice as well: 2;4;7: Each entry (2, 4, and 7 in this case) are equally likely to occur. Entries can also be text. --Jouni 19:45, 24 January 2013 (EET)

Code

https://www.opasnet.org/svn/opasnet_utils/trunk/R/Interpret.r

See also