bayesia logo

Special Functions

If(c,t,e)

Description: Conditional instruction: If c is True then t else e.

Number of Parameters: 3

Parameter type: boolean, all, all, but the last two parameters have to be of the same type or comparable (integer and real).

Result type: The type of the result is the type of the last two parameters. If one of them is real and the other integer, then the result type is real.

Example

The following probability distributions correspond to:

P(?Opinion? | ?Note?) =
If(?Opinion? == "Very Weak", Normal(?Note?, 0, 3.5),
If(?Opinion? == "Weak", Normal(?Note?, 7, 3),
If(?Opinion? == "Fair", Normal(?Note?, 10, 3),
If(?Opinion? == "Good", Normal(?Note?, 13, 3),
Normal(?Note?, 20, 3.5)))))

where Opinion is a Discrete variable that has 5 states (Very weak, Weak, Fair, Good, Very good) and Note is a Discrete variable with 21 integer states from 0 to 20.

2556115

Switch(s, ki, vi, ..., d)

Description: Branch instruction. According to the value ki that s can take, the corresponding value vi is returned. If no ki is corresponding, then the default value d is returned.

Number of Parameters: >= 4

Parameter type: all, all, all, ..., all but the parameters s and ki must have the same type or comparable (integer and real for example) and it must be the same thing for the parameters vi and d.

Result type: The return type is the common type of the parameters vi and d. If one of them is real and the other integer, then the result type is real.

Example

The following probability distributions correspond to:

P(?Opinion? | ?Note?) = Switch(?Opinion?, "Very Weak", Normal(?Note?, 0, 3.5), "Weak", Normal(?Note?, 7, 3), "Fair", Normal(?Note?, 10, 3), "Good", Normal(?Note?, 13, 3), Normal(?Note?, 20, 3.5))

where Opinion is a Discrete variable that has 5 states (Very weak, Weak, Fair, Good, Very good) and Note is a Discrete variable with 21 integer states from 0 to 20.

CumulBinomial(k, n, p)

Description: Normalized cumulated probability of ending up with K or less occurrences of the same event of probability p among n independent experiments.

Number of Parameters: 3

Parameter type: integer, integer, numerical

Result type: real

RandomUniform(min, max)

Description: Returns a real value greater than or equal to min and less than max. Returned values are chosen pseudo randomly with (approximately) uniform distribution from that range.

Number of Parameters: 2

Parameter type: numerical, numerical

Result type: real

RandomGaussian(m, s)

Description: Returns the next pseudo random, Gaussian ("normally") distributed real value with mean m and standard deviation s from this random number generator's sequence.

Number of Parameters: 2

Parameter type: numerical, numerical

Result type: real


Copyright © 2025 Bayesia S.A.S., Bayesia USA, LLC, and Bayesia Singapore Pte. Ltd. All Rights Reserved.