If a parameter value depends on a condition, it can be written with in Mlxtran
with the usual if-else-end syntax. For example, if a parameter c should be 1 if t<=10, 2 if t<20 and 3 otherwise, write
if t<=10 c = 1 elseif t<20 c = 2 else c = 3 end
Conditional derivatives
Derivatives cannot be written within an if-else-end structure. Instead, intermediate variables should be used. For example, if a derivative of x over time should be 1 if t<=10 and 2 otherwise, write
if t<=10 dx = 1 else dx = 2 end ddt_x = dx
Example: count model
Some models from the Count model library are defined with if/else statements, such as the zero-inflated Poisson model:
[LONGITUDINAL] input= {lambda0, nu, f} EQUATION: lambda = lambda0*exp(-t/nu) DEFINITION: CountNumber= {type=count, if k==0 Pk = exp(-lambda)*(1-f) + f else Pk = exp(k*log(lambda) -lambda -factln(k))*(1-f) end P(CountNumber=k) = Pk} OUTPUT: output= CountNumber