LECTURE 2. Algorithmic Models in Economics and Enterprise
LECTURE 2. Algorithmic Models in Economics and Enterprise
Summary
General provisions and basic concepts of algorithmic (simulation) modeling.
Statistical modeling method. The main stages of the simulation process. Statistical
estimates of distribution parameters. Determining the required sample size.
Plan
2.1 The essence of algorithmic (simulation) modeling
2.2 The main stages of the simulation process
2.3 Theoretical foundations of the method of statistical modeling
2.4 Modeling of random behaviors
First, as a rule, a generalized scheme of the modeling algorithm is created, which sets
the general order (course) of actions in the simulation modeling of the studied
process. After that, a detailed scheme is developed, each element of which is
transformed into an operator (group of operators) of the program.
Checking the validity of the algorithm should answer the question of how adequately
and accurately it reflects the essence of the modeled process (in a particular situation)
and the constructed conceptual model.
2) modeling of random phenomena (random events, random variables, random
functions) that are inherent in the system under study;
3) modeling of the process of system operation (based on the use of data obtained at
the previous stage) - reproduction of the process in accordance with the developed
structural scheme and formalized description (simulation runs);
4) software implementation of the simulation model: creation or adequate use
of existing software products that provide the possibility of direct practical
implementation of the model on personal computers;
At this stage, serial calculations are performed using the program. The stage consists
of the following steps:
planning a machine experiment;
carrying out working calculations;
appropriate presentation of modeling results (in tabular and graphical forms);
providing recommendations for optimizing the functioning of the real system.
One of the important aspects in the process of work (research) with the simulation
model is the analysis of its sensitivity. It is understood as determining the degree of
variability of the values of the target indicators of the model due to the variability
(uncertainty, variability) of the initial parameters. Thus, if there is a significant
change in the simulation results with relatively small changes in the initial data, this
is a sufficient basis for additional, more detailed research, in particular, on the
relationships between the respective variables.
The method of statistical modeling (or the Monte Carlo method) is a method of
studying indeterminate (stochastic) economic objects and processes, when the
internal interactions in these systems are not fully (to some extent) known.
Reproduction of a possible (accidental) state of functioning of the modeled system is
called realization (or imitation run; further - run).
After each run register a set of parameters that characterize the random event
(its implementation). The method is based on multiple runs (random
implementations) on the basis of the constructed model with the subsequent statistical
processing of the received data for the purpose of definition of numerical
characteristics of investigated object (process) in the form of statistical estimations of
its parameters.
The process of modeling the economic system is reduced to a machine
simulation of the studied process, which is modeled on a computer with all the
significant uncertainties, coincidences and the risk generated by them. Simulation is
often called simulation.
The theoretical basis of the method of statistical modeling is the law of large
numbers. In probability theory, the law of large numbers is based on proving a
number of theorems for different conditions of convergence in the probability of the
average values of the results (based on a large number of observations) to some
values.
Under the law of large numbers understand several theorems. For example, one
of the theorems of P.L. Chebyshev is formulated as follows: "With an unlimited
increase in the number of independent tests (n) the arithmetic mean free from
systematic errors and equivalent results of observations ξi- random variable ξ, which
has a finite variance D(ξ), coincides in probability to the mathematical expectation
mξ=М(ξ) of this random variable. "
m
lim P i p 1
n (2.2)
According to this theorem to obtain the probability of a certain event, such as the
probability of states of a system pi, i=1,…,k, calculate the relative frequencies
for the number of implementations equal to n.
The results are averaged and, with some approximation, the required probabilities of
system states are obtained. The larger n, the more accurate the result of calculating
these probabilities.
Note that any statements regarding the characteristics of the simulated system
should be based on the results of appropriate tests using the methods of mathematical
statistics.
Since random events and random functions can be represented using random
variables, the simulation of random events and random functions is performed using
random variables.
The random variable is given using the distribution function, which is the probability
that the random variable X as a result of the test will take a value less than x, ie
F ( x) P ( X x) . (2.3)
If the function F (x) is continuous and differentiable (at least piecewise), then the
continuous random variable can be given by the probability density density f (x) ,
P ( A) P ( A)
The probability of a random variable falling into the interval (0; P (A)) is
equal to the value of P (A). Therefore, if during the draw the number fell into this
interval, it should be assumed that event A occurred. The opposite event ( A ) will
occur with probability (1-P (A)) in the case when P (A).
The procedure for modeling a simple event in a simulation model is described
by an algorithm, the scheme of which is given in Fig. 3.1 (GVC () - generator of
random numbers corresponding to the uniform distribution law on the interval (0;
1)).
Figure 2.1 - Simulation of a simple event
Operator 1 refers to a random number generator, which generates a random
number .
Operator 2 checks the condition P (A). If it is executed, it is considered that
event A has occurred. Otherwise, it is considered that the opposite event has occurred
( A ).
EXAMPLE
The probability of occurrence of event A in each test is equal to P (A) = 0.75.
It is necessary to simulate three tests and determine the sequence of implementation
of event A.
SOLUTION.
We set aside a point E = 0.75 on a unit segment of the numerical axis and
assume that when the random number ξi <E, then in the test came the event A.
Otherwise (at ξi ≥ Е) event occurred not A ( A ), ie event A did not take place.
Assume, for example, that random numbers ξ1 = 0.925, ξ2 = 0.135, ξ3 = 0.088 are
selected from the corresponding table. Then for three tests we get the following
sequence of events: A , A, A.
p
i 1
i 1.
Divide the interval (0; 1) into k segments whose lengths are respectively equal
to p1, p2,…, pk.
p1 p2 p k–1 pk
0 L1 L2 Lk–1 Lk =1 ξ
Example. Suppose that dependent and compatible events A and B take place
during the test, and it is known that P (A) = 0.7; P (B) = 0.5; P (AB) = 0.3.
Let two random numbers 1 = 0.68 and 2 = 0.95 be generated. The random number
1 belongs to the interval 2, so in the first test, event C2 took place: event A
occurred, and event B did not occur. In the second test, the random number 2
belongs to the interval 4: both events A and B did not occur.
2 way. Simulation of compatible events is to act out the fact of occurrence of
each of the compatible events separately, and if the events are dependent, it is
necessary to pre-determine the conditional probabilities.
Example. Using the conditions of the previous example, it is necessary to
simulate the occurrence of events A and B in one test.
Solution. Events A and B are dependent, so we first find the conditional
probabilities Р(В/А) та Р( B / A ):
P( AB) 0,3 3
P ( B / A) ;
P( A) 0,7 7
P( A B) 0,2 2
P( B / A ) .
P ( A ) 1 0,7 3
A random number 1 was chosen to simulate event A. Let 1 = 0.96. Since 1>
P (A), event A did not occur in the test.
Now let's play event B, provided that event A did not take place in the test. Let
p j 1
j 1
.
Divide the interval (0; 1) into n segments whose lengths are equal to the given
probabilities pj, j = 1,…, n. If a random number formed by a generator of random
numbers that correspond to a uniform distribution law in the interval (0; 1) falls into
the interval pk, then the random variable X becomes xk. Thus, when modeling a
discrete random variable, the same procedure is actually used as when modeling a
complete group of pairwise incompatible events.
Example. Model two implementations of a discrete random variable X with
distribution:
x -1 0 2 5
i:
p 0, 0 0,2 0,1
i: 2 ,5
Solution. Set aside sequentially on a single segment of the numerical axis
intervals (Fig. 1): і = pi, і = 1,…, 4.
Δ1 = p 1 Δ2 = p 2 Δ3 = p 3 Δ4 = p 4
m 6
From the normalized and centered random variable, you can go to the random
variable y with the given parameters т(у) and (у) according to the following
expression:
y m( y ) ( y )
f x dx
(2.6)
For a number of distribution laws, an analytical solution of equation (3.6) is
obtained, the result of which is given in Table 3.1.
Table 2.1 - Formulas for modeling random variables
Laws of distribution of Formulas for modeling
Density of distribution
a random variable random
Exponential f x e x xi
1
ln i
Weibula xi bln i
a 1 1/ a
a x x a
f x exp
ba b
Gamma distribution x 1 1
f x
e x xi
ln(1
j 1
ij )
(η - integers)
Normal 1
x m 2 12
f x e 2 2 xi m ij 6
2 j 1
a0 a1 a2 an–1 an х
f ( x)dx p
ak 1
k
, k 1, ..., n .
From the condition f(x)=const=ck on each partial interval it follows that the
implementation of a random variable X can be determined by the formula
x k a k 1 (a k a k 1 ), k 1, ..., n ,
(2.7)
where is the realization of a random variable evenly distributed on the
interval (0; 1); ak–1 - left boundary of the partial interval; ak is the right limit of the
partial interval.
R iprof
• the sum of the squares of the values of the random profit for N
implementations (simulation runs):
R prof .
N
2 i 2
S prof
i 1
fryn
f3 = 20
10 f2 = 10 f4 = 10
f1 = 5 f5 = 5
5