# Indirect Estimation and Simulation Tool (IEST) Expressions

## 13. Expressions

The system uses expressions in parameters and in simulation rules. Expressions include mathematical and logical formulas. Expressions can be a simple as 1+2; they can use another parameter as in Age +1; They can be complex expressions using mathematical functions as in Exp(-Age); They can even use if statements as in Iif(Gr(Age+1,50),1,0); These expressions can also represent tables as in Table(1,3,0,0.5,1,Age,NaN,20,30,40) . These formulas may contain, as literals parameter names (including parameters that hold values, parameters that specify user defined functions, state indicator names, and some reserved words), mathematical operators, system built in functions. Below is a list of allowed operators:

### 13.1 Supported arithmetic functions

• - : negative/subtraction operator
• * : multiplication operator
• / : division operator (note that integers will be treated as floating point numbers)
• ** : power operator

### 13.2 Other supported literals

• () : Parenthesis to determine the order of the calculation
• [,] : brackets enclosing comma separated values describe vectors and matrices. Note that this type of expression is limited to defined vectors and matrices

### 13.3 A list of comparison operators

• Eq(x1,x2): will return 1 if x1=x2 and 0 otherwise
• Ne(x1,x2): will return 1 if x1<>x2 and 0 otherwise
• Gr(x1,x2): will return 1 if x1>x2 and 0 otherwise
• Ge(x1,x2): will return 1 if x1>=x2 and 0 otherwise
• Ls(x1,x2): will return 1 if x1<x2 and 0 otherwise
• Le(x1,x2): will return 1 if x1<=x2 and 0 otherwise

### 13.4 A list of Boolean operators

In the following Boolean operators, the results are either 1 or 0. Any argument that not zero is considered be true and zero is treated as false.

• Or(x1,x2,x3�): will perform a Boolean OR operation on two or more inputs
• And(x1,x2,x3�): will perform a Boolean AND operation on two or more inputs
• Not(x): will perform a Boolean Not operation on a single input
• IsTrue(x): will return 1 for a numeric x that is not 0. Will return 0 otherwise.

### 13.5 A list of special math related functions and symbols

Note that these may be platform dependent. Boolean operators treat NaN (Not a Number) as false as well as any other non-number type such as a vector/matrix.

• Inf, inf: will be recognized by the system as infinite. This symbol is not to be used in mathematical calculations as it may generate error. It can be used for bound checks for parameters.
• NaN, nan: will be recognized by the system as not a number. Note that comparison of NaN to any number including NaN will return False. Arithmetic operations using NaN produce NaN and may raise errors and therefore should be avoided.
• IsInvalidNumber(x): will return 1 for x=NaN or for a non numeric type such as a vector , 0 otherwise
• IsInfiniteNumber(x): will return 1 for x=-Inf or x=Inf, 0 otherwise
• IsFiniteNumber(x): will return 1 if x is a finite number, 0 if x is not a valid number or an Infinite number

### 13.6 Mathematical functions

• Exp(x): exponential
• Log(x,n): logarithm of base n
• Ln(x): natural logarithm
• Log10(x): decimal logarithm
• Pow(x,n): power operator similar to **
• Sqrt(x): square root operator similar to **0.5
• Pi(): the mathematical constant approximately equal to 3.14159

### 13.7 Other functions

• Mod (x,n): Modulus of base n
• Abs(x): Absolute value of x
• Floor(x): closest integer equal to or below x
• Ceil(x): closest integer equal to or above x
• Max(a1,a2,a3�): the maximum value in the list
• Min(b1,b2,b3�): the minimum value in the list

### 13.8 Statistical Distributions - Random number generators

Note the difference in number of arguments from the CDF shown in the next section. These random functions can be used to define the Distribution of parameters:

• Bernoulli(p)
• Binomial(n,p)
• Geometric(p)
• Uniform(a,b) : the arguments a and b define the lower and upper limits of the interval
• Gaussian(mean,std)

### 13.9 Statistical Distribution - CDF evaluation at point x

Note the difference in number of arguments from the random functions shown in the section above. The last argument x represents the value at which the CDF will be calculated. These functions cannot be used to define the Distribution of parameters:

• Bernoulli(p,x)
• Binomial(n,p,x)
• Geometric(p,x)
• Uniform(a,b,x)
• Gaussian(mean,std,x)

### 13.10 Control and Data Access

• Iif(Statement,TrueResult,FalseResult): Returns TrueResult if Statement is not 0, FalseResult if Statement is 0.
• Table (TableParameters): A multi-dimensional table. TableParameters are provided as a string of comma-separated values. The Table Input argument pattern is: D,N_1,N_2,...,N_D,V_1...V_(N1*N2*...*ND),M_1,R_1_0...R_1_(N_1)......M_D,R_D_0...R_D_(N_D). Where D defines the number of dimensions, N_i the dimension size for dimension i, V_i table values, M_i dimension names, R_i_j, the j range value definition item for dimension i . NaN value in R_i_0 means the dimension is discrete rather than continuous and the range bounds provided later represent values rather than lower and upper bounds associated with cells. For example Table(2,2,3,1,2,3,4,5,6, Gender, NaN,0,1, Age,0,30,60,120) defines a D=2 dimensional table with the dimensions M_1=Gender and M_2=Age. The levels of each dimension are defined by cutpoints which represent the lower and upper bounds for each interval; > lower bound and <= upper bound. When the dimension is categorical, such as Gender, the first cutpoint should be NaN, followed by the values of the categories. When the dimension is continuous, the first cutpoint is less than the minimum and the last cutpoint is >= the maximum. In our example, . the Gender Dimension has N_1 =2 categories with the discrete values of R_1_0 =NaN, R_1_1 = 0 and R_1_2 = 1, and the Age dimension has N_2=3 categories defined by R_2_0= 0<Age<=30= R_2_1, R_2_1= 30<Age<=60= R_2_2, R_2_2= 60<Age<=120= R_2_3.The values that the table holds are V1...V6=1,2,3,4,5,6. as can be seen in the following table: ### 13.11 Application specific

• CostWizard (FunctionType, InitialValue, CoefficientVector, ValuesVector): The function calculates costs or QoL accurding to FunctionType: If FunctionType=0, costs are calculated if FunctionType=1, Quality of life is calculated. Note that CoefficientVector and ValuesVector are vectors of the same size. The system returns an error if there is an incompatibility between parameters and coefficients or if the FunctionType is not 0 or 1. The cost/QoL function is calculated according to the formula presented in Zhou H, Isaman DJ, Messinger S, Brown MB, Klein R, Brandle M, Herman WH. A computer simulation model of diabetes progression, quality of life, and cost. Diabetes Care. 2005;28(12):2856-63. Note that the values associated with the cost/QoL can be changed by the user.

Note that missing values are not supported by the system. An exception is population data upload in which case missing data values are ignored by default in simulation.