A stochastic simulation is a
simulation
A simulation is the imitation of the operation of a real-world process or system over time. Simulations require the use of Conceptual model, models; the model represents the key characteristics or behaviors of the selected system or proc ...
of a
system that has variables that can change
stochastically (randomly) with individual probabilities.
[DLOUHÝ, M.; FÁBRY, J.; KUNCOVÁ, M.. Simulace pro ekonomy. Praha : VŠE, 2005.]
Realizations of these
random variable
A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the po ...
s 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 Distribution may refer to:
Mathematics
*Distribution (mathematics), generalized functions used to formulate solutions of partial differential equations
* Probability distribution, the probability of a particular value or value range of a vari ...
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
Random number generation is a process by which, often by means of a random number generator (RNG), a sequence of numbers or symbols that cannot be reasonably predicted better than by random chance is generated. This means that the particular outc ...
(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.
[Rachev, Svetlozar T. Stoyanov, Stoyan V. Fabozzi, Frank J., "Chapter 1 Concepts of Probability" in Advanced Stochastic Models, Risk Assessment, and Portfolio Optimization : The Ideal Risk, Uncertainty, and Performance Measures, Hoboken, NJ, USA: Wiley, 2008]
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
and
where
.
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
such that the probability for
and
.
= Example: Toss of coin
=
Define
For a fair coin, both realizations are equally likely. We can generate realizations of this random variable X from a
uniform distribution provided by a random number generator (RNG) by having
if the RNG outputs a value between 0 and 0.5 and
if the RNG outputs a value between 0.5 and 1.
Of course, the two outcomes may not be equally likely (e.g. success of medical treatment).
[Bernoulli Distribution, The University of Chicago - Department of Statistics, nlineavailable at http://galton.uchicago.edu/~eichler/stat22000/Handouts/l12.pdf]
Binomial distribution
A
binomial distributed random variable Y with parameters ''n'' and ''p'' is obtained as the sum of ''n'' independent and identically
Bernoulli-distributed random
In common usage, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no :wikt:order, order and does not follow an intelligible pattern or combination. Ind ...
variables ''X''
1, ''X''
2, ..., ''X''
''n''
Example: A coin is tossed three times. Find the probability of getting exactly two heads.
This problem can be solved by looking at the sample space. There are three ways to get two heads.
The answer is 3/8 (= 0.375).
Poisson distribution
A poisson process is a process where events occur randomly in an interval of time or space.
The probability distribution for Poisson processes with constant rate ''λ'' per time interval is given by the following equation.
Defining
as the number of events that occur in the time interval
It can be shown that inter-arrival times for events is
exponentially distributed
In probability theory and statistics, the exponential distribution is the probability distribution of the time between events in a Poisson point process, i.e., a process in which events occur continuously and independently at a constant averag ...
with a
cumulative distribution function (CDF) of
. The inverse of the exponential CDF is given by
where
is an
uniformly distributed random variable.
Simulating a Poisson process with a constant rate
for the number of events
that occur in interval