A stochastic simulation is a simulation of a system that has variables that can change stochastically (randomly) with individual probabilities. Realizations of these random variables are generated and inserted into a model of the system. Outputs of the model are recorded, and then the process is repeated with a new set of random values. These steps are repeated until a sufficient amount of data is gathered. In the end, the distribution of the outputs shows the most probable estimates as well as a frame of expectations regarding what ranges of values the variables are more or less likely to fall in. Often random variables inserted into the model are created on a computer with a random number generator (RNG). The U(0,1) uniform distribution outputs of the random number generator are then transformed into random variables with probability distributions that are used in the system model.
Etymology Stochastic originally meant "pertaining to conjecture"; from Greek stokhastikos "able to guess, conjecturing": from stokhazesthai "guess"; from stokhos "a guess, aim, target, mark". The sense of "randomly determined" was first recorded in 1934, from German Stochastik.
Discrete-event simulation In order to determine the next event in a stochastic simulation, the rates of all possible changes to the state of the model are computed, and then ordered in an array. Next, the cumulative sum of the array is taken, and the final cell contains the number R, where R is the total event rate. This cumulative array is now a discrete cumulative distribution, and can be used to choose the next event by picking a random number z~U(0,R) and choosing the first event, such that z is less than the rate associated with that event.
Probability distributions A probability distribution is used to describe the potential outcome of a random variable. Limits the outcomes where the variable can only take on discrete values.
Bernoulli distribution
A random variable X is Bernoulli-distributed with parameter p if it has two possible outcomes usually encoded 1 (success or default) or 0 (failure or survival) where the probabilities of success and failure are P ( X = 1 ) = p {\displaystyle P(X=1)=p} and P ( X = 0 ) = 1 − p {\displaystyle P(X=0)=1-p} where 0 ≤ p ≤ 1 {\displaystyle 0\leq p\leq 1} . To produce a random variable X with a Bernoulli distribution from a U(0,1) uniform distribution made by a random number generator, we define
X = { 1 , if 0 ≤ U < p 0 , if 1 ≥ U ≥ p {\displaystyle X={\begin{cases}1,&{\text{if }}0\leq U<p\\0,&{\text{if }}1\geq U\geq p\end{cases}}}
such that the probability for P ( X = 1 ) = P ( 0 ≤ U < p ) = p {\displaystyle P(X=1)=P(0\leq U<p)=p} and P ( X = 0 ) = P ( 1 ≥ U ≥ p ) = 1 − p {\displaystyle P(X=0)=P(1\geq U\geq p)=1-p} .
Example: Toss of coin Define
X = { 1 if heads comes up 0 if tails comes up {\displaystyle X={\begin{cases}1&{\text{if heads comes up}}\\0&{\text{if tails comes up}}\end{cases}}}
For a fair coin, both realizations are equally likely. We can generate realizations of this random variable X from a U ( 1 , 0 ) {\displaystyle U(1,0)} uniform distribution provided by a random number generator (RNG) by having X = 1 {\displaystyle X=1} if the RNG outputs a value between 0 and 0.5 and X = 0 {\displaystyle X=0} if the RNG outputs a value between 0.5 and 1.
… excerpt ends here. Continue reading the full article.
