18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

5.4.1 Random Step Variables<br />

If the sampling variable is defined by the statement:<br />

the system has a SAMPLE random step variable<br />

sampling is done as follows in the statement let X = SAMPLE:<br />

1. A random number is drawn from random.f(1)<br />

2. This random number is compared with successive cumulative probability values until a value<br />

is found that equals or exceeds it<br />

3. The column 2 value (table 5-6) associated with this cumulative probability value is returned<br />

as the value of the sample. Examples are:<br />

If the random number drawn is 0.20, SAMPLE = 2.5<br />

If the random number drawn is 0.45, SAMPLE = 11.8<br />

If the random number drawn is 0.65, SAMPLE = 30.0<br />

If the random number drawn is 0.95, SAMPLE = 50.0<br />

5.4.2 Random Linear Variables<br />

Random variables defined as step can be either integer- or real-valued. If the sampling variable<br />

is defined by the statement:<br />

the system has a SAMPLE random linear variable<br />

sampling is done as follows:<br />

1. A random number is drawn from random.f(1)<br />

2. This random number is compared with successive cumulative probability values until a value<br />

is found that equals or exceeds it<br />

3. Interpolation is done between the column 2 value (table 5-6) associated with the stopping<br />

cumulative probability value and the column 2 value preceding it. If i represents the index<br />

of the stopping probability, C(i) the probability, and V(i) the sample value, the interpolation<br />

formula is:<br />

SAMPLE = V(i-1) + random.f - C(i-1) [V(i) - v(i-1)]<br />

C(i) - C(i-1)<br />

Examples are:<br />

If the random number drawn is 0.20, SAMPLE = 2.5<br />

If the random number drawn is 0.45, SAMPLE = 11.8<br />

If the random number drawn is 0.65, SAMPLE = 23.6<br />

220

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!