Cit 412 Modelling and Simulation
Cit 412 Modelling and Simulation
FACULTY OF SCIENCE
Introduction
CIT 412: Modelling and Simulation is a 3 credit unit course for students studying
towards acquiring a Bachelor of Science in Computer Science and other related disciplines.
The course is divided into 5 modules and 20 study units. It will first take a brief review of
the concepts of Modelling and Simulation. This course will then go ahead to deal with the
different stages involved developing good and functional Modelling and Simulation
methods. The course went further to deal with different ways of Simulation
implementations. This course also introduce such other knowledge that will enable the
reader have proper understanding of Simulation such as Statistics.
The course guide therefore gives you an overview of what the course; CIT 412 is all about,
the textbooks and other materials to be referenced, what you expect to know in each unit, and
how to work through the course material.
Course Competencies
The overall aim of this course, CIT 412 is to introduce you to basic concepts of Modelling
and Simulation in order to enable you to understand the basic elements of Simulation use in
day to day activities especially, businesses, Sciences and Technology industries. This course
highlights methodology and approaches in the conduct of simulation. In this course of your
studies, you will be put through the definitions of common terms in relation to modelling and
simulation, the methodology, theories, experiments and languages use in conducting
simulations.
Course Objectives
It is important to note that each unit has specific objectives. Students should study them
carefully before proceeding to subsequent units. Therefore, it may be useful to refer to
these objectives in the course of your study of the unit to assess your progress. You should
always look at the unit objectives after completing a unit. In this way, you can be sure that
you have done what is required of you by the end of the unit.
However, below are overall objectives of this course. On completing this course, you
should be able to:
Define a model and modelling.
Explain when to and why we use models
Describe the modelling process
Describe different types of Models.
Describe how to generate pseudorandom numbers,
Use QBasic RND function and describe how to simulate randomness,
Use different Random number generators,
Explain properties of good random number generator.
Explain the use of Congruential method for generating Random numbers;
Choose appropriate parameters for congruential method;
Translate the method to computer programs;
Use other very similar random number generating methods such as:
Describe Monte Carlo method
Trace the origin of Monte Carlo method
Give examples of the application of Monte Carlo method
Define Statistics
Explain Statistical Distributions
Compute measures of Central Tendency and Variations
Explain the Components of Statistical Distributions
Explain the role of probability distribution functions in simulations
Describe Probability theory
Explain the fundamental concepts of Probability theory
Explain Random Variable
Explain Limiting theorems
Describe Probability distributions in simulations
List common Probability distributions.
Explain Simulation
State why we need simulation
Describe how simulations are done
Describe various types of Simulations
Give examples of Simulation
Show areas of applications of Simulation
Define Modelling
Describe some basic modelling concepts
Differentiate between Visual and Conceptual models
Explain the Characteristics of Visual, models
Define Finite Element Method (FEM)
Study Units
This course material contains four modules and sixteen study units as follows:
MODULE 1
UNIT 1 BASICS OF MODELLING AND SIMULATION
UNIT 2 RANDOM NUMBERS
UNIT 3 RANDOM NUMBER GENERATION
UNIT 4 MONTE CARLO METHOD
UNIT 5 STATISTICAL DISTRIBUTION FUNCTIONS
UNIT 6 COMMON PROBABILITY DISTRIBUTIONS
MODULE 2
UNIT 1 SIMULATION AND MODELLING
UNIT 2 MODELLING METHODS
UNIT 3 PHYSICS-BASED FINITE ELEMENT MODEL
UNIT 4 STATISTICS FOR MODELLING AND SIMULATION
MODULE 3
UNIT 1 SIMPLE THEORIES OF QUEUES
UNIT 2 BASIC PROBABILITY THEORIES IN QUEUING
UNIT 3 QUEUING MODELS
UNIT 4: QUEUING EXPERIMENTS
MODULE 4
UNIT 1 SIMULATION LANGUAGES
UNIT 2 THE SIMNET II LANGUAGE
MODULE 5
UNIT 1 STOCHASTIC PROCESSES
UNIT 2 RANDOM WALKS
UNIT 3 DATA COLLECTION
UNIT 4 CODING AND SCREENING
Presentation Schedule
The Presentation Schedule included in your course material gives you important dates for the
completion of Tutor Marked Assignments and tutorial attendance. Remember, you are
required to submit all your assignments by the due date. You should guard against falling
behind in your work.
Assessment
There are two aspects to the assessment of this course. First, there are tutor marked
assignments; and second, the written examination. Therefore, you are expected to take note
of the facts, information and problem solving gathered during the course. The tutor marked
assignments must be submitted to your tutor for formal assessment, in accordance to the
deadline given. The work submitted will count for 40% of your total course mark. At the end
of the course, you will need to sit for a final written examination. This examination will
account for 60% of your total score.
Each of the study units follows a common format. The first item is an introduction to the
subject matter of the unit, and how a particular unit is integrated with the other units and the
course as a whole. Next to this is a set of learning objectives. These objectives let you know
what you should be able to do by the time you have completed the unit. These learning
objectives are meant to guide your study. The moment a unit is finished, you must go back
and check whether you have achieved the objectives. If you make this a habit, then you will
significantly improve your chances of passing the course. The main body of the unit guides
you through the required reading from other sources. This will usually be either from your set
books or from a reading section. The following is a practical strategy for working through
this course. If you run into any trouble, telephone your tutor. Remember that your tutor‘s job
is to help you. When you need assistance, do not hesitate to call and ask your tutor to provide
it.
2. Organise a Study Schedule. Design a ―Course Overview‖ to guide you through the
Course. Note the time you are expected to spend on each unit and how the assignments relate
to the units. Important information, e.g. details of your tutorials, and the date of the first day
of the semester is available from the study centre. You need to gather all the information into
one place, such as your diary or a wall calendar. Decide on a method and write in your own
dates and schedule of work for each unit.
3. Once you have created your own study schedule, do everything to stay faithful to it.
The major reason students fail is that they get behind with their course work. If you get into
difficulty with your schedule, please, let your tutor know before it is tool late for help.
4. Turn to Unit 1, and read the introduction and the objectives for the unit.
5. Assemble the study materials. You will need your set books and the unit you are
studying at any point in time.
6. Work through the unit. As you work through it, you will know what sources to
consult for further information.
7. Keep in touch with your study centre as up-to-date course information will be
continuously available there.
8. Well before the relevant due dates (about 4 weeks before due dates), keep in mind
that you will learn a lot by doing the assignments carefully. They have been designed to help
you meet the objectives of the course and therefore will help you pass the examination.
Submit all assignments not later than the due date.
9. Review the objectives for each study unit to confirm that you have achieved them. If
you fee unsure about any of the objectives, review the study materials or consult your tutor.
10. When you are confident that you have achieved a unit‘s objectives, you can start on
the next unit. Proceed unit by unit through the course and try to pace your study so that you
keep yourself on schedule.
11. When you have submitted an assignment to your tutor for marking, do not wait for its
return before starting on the next unit. Keep to your schedule. When the assignment is
returned, pay particular attention to your tutor‘s comments, both on the tutor-marked
assignment form and on the ordinary assignments.
12. After completing the last unit, review the course and prepare yourself for the final
examination. Check that you have achieved the unit objectives (listed at the beginning of
each unit) and the course objectives (listed in the Course Guide).
13. Finally, ensure that you practice on the personal computer as prescribed to gain the
maximum proficiency required.
Facilitation
The dates, times and locations of these Tutorials will be made available to you, together with
the name, telephone number and address of your Tutor. Each assignment will be marked by
your tutor. Pay close attention to the comments your tutor might make on your assignments
as these will help in your progress. Make sure that assignments reach your tutor on or before
the due date.
Your tutorials are important; therefore try not to skip any. It is an opportunity to meet your
tutor and your fellow students. It is also an opportunity to get the help of your tutor and
discuss any difficulties you might encounter when reading.
Course Information
Course Code: CIT 412
Course Title: MODELLING AND SIMULATION
Credit Unit:
Course Status:
Course Blurb: This course covers principal topics in Modelling and Simulation. It will first
take a brief review of the concepts of Modelling and Simulation. This course will then go
ahead to deal with the different stages involved developing good and functional Modelling
and Simulation methods. The course went further to deal with different ways of Simulation
implementations. This course also introduce such other knowledge that will enable the
reader have proper understanding of Simulation such as Statistics. Theories in queuing,
simulation languages, stochastic process, random walks, etc were also covered.
Semester:
Course Duration: Required
Hours for Study
Course Team
Course Developer: ACETEL
Course Writer: Dr. M.C Okoronkwo
Department of Computer Science
University of Nigeria
Nsukka.
Instructional Designer:
Learning Technologists:
Copy Editor
Year 2022
Ice Breaker
Module 1: MODELLING AND SIMULATION CONCEPTS
Module Introduction
This module is divided into six (6) units
Unit 1: Basics of Modelling and Simulation
Unit 2: Random Numbers
Unit 3: Random Number Generation
Unit 4: Monte Carlo Method
Unit 5: Statistical Distribution Functions
Unit 6: Common Probability Distributions
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Definitions
3.2 What is Modelling and Simulation?
3.3 Type of Models
3.4 Advantages of Using Models
3.5 Applications
3.6 Modelling Procedure
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
The ability of man to define what may happen in the future and to choose among
alternatives lie at the heart of contemporary societies. Our knowledge of the way things
work, in society or nature are trailed with clouds of imprecision, and vast harms have
followed a belief in certainty. To reduce the level of disparity between outcome and reality,
we require a decision analysis and support tool to enable us to evaluate, compare and
optimize alternative. Such a tool should be able to provide explanations to various
stakeholders and defend the decisions. One such tool that has been successfully employed
is simulation which we use to vary the parameter of a model and observe the outcome.
Simulation has been particularly valuable:
a. When there is significant uncertainty regarding the outcome or consequences of a
particular alternative under consideration. It allows you to deal with uncertainty and
imprecision in a quantifiable way.
b. When the system under consideration involves complex interactions and requires
input from multiple disciplines. In this case, it is difficult for any one person to easily
understand the system. A simulation of the model can in such situations act as the
framework to integrate the various components in order to better understand their
interactions. As such, it becomes a management tool that keeps you focused on the
"big picture" without getting lost in unimportant details.
c. when the consequences of a proposed action, plan or design cannot be directly and
immediately observed (i.e., the consequences are delayed in time and/or dispersed in
space) and/or it is simply impractical or prohibitively expensive to test the alternatives
directly.
3.1 Definitions
a. Modelling is the process of generating abstract, conceptual, graphical and/or
mathematical models. Science offers a growing collection of methods, techniques
and theory about all kinds of specialized scientific modelling.
Modelling also means to find relations between systems and models. Stated
otherwise, models are abstractions of real or imaginary worlds we create to
understand their behaviour, play with them by performing "what if" experiments,
make projections, animate or simply have fun.
b. A model in general is a pattern, plan, representation (especially in miniature), or
description designed to show the main object or workings of an object, system, or
concept.
c. A model (physical or hypothetical) is a representation of real-world phenomenon
or elements (objects, concepts or events). Stated otherwise a model is an attempt to
express a possible structure of physical causality.
Models in science are often theoretical constructs that represent any particular thing
with a set of variables and a set of logical and or quantitative relationships between
them. Models in this sense are constructed to enable reasoning within an idealized
logical framework about these processes and are an important component of
scientific theories.
d. Simulation -is the manipulation of a model in such a way that it operates on time
or space to compress it, thus enabling one to perceive the interactions that would
not otherwise be apparent because of their separation in time or space.
e. Modelling and Simulation is a discipline for developing a level of understanding of
the interaction of the parts of a system, and of the system as a whole. The level of
understanding which may be developed via this discipline is seldom achievable via
any other discipline.
f. A computer model is a simulation or model of a situation in the real world or an
imaginary world which has parameters that the user can alter.
For example Newton considers movement (of planets and of masses) and writes equations,
among which f = ma (where f is force, m mass and a acceleration), that make the dynamics
intelligible. Newton by this expression makes a formidable proposition, that force causes
acceleration, with mass as proportionality coefficient. Another example, a model airplane
is a physical representation of the real airplane; model of airplanes are useful in predicting
the behaviour of the real airplane when subjected to different conditions; weather, speed,
load, etc. Models help us frame our thinking about objects in the real world. It should be
noted that more often than not we model dynamic (changing) systems.
A simulation is a technique (not a method) for representing a dynamic real world system
by a model and experimenting with the model in order to gain information about the
system and therefore take appropriate decision. Simulation can be done by hand or by a
computer. Simulations are generally iterative in their development. One develops a model,
simulates it, learns from the result, revises the model, and continues the iterations until an
adequate level of understanding is attained.
Modelling and Simulation is a discipline, it is also very much an art form. One can learn
about riding a bicycle from reading a book. To really learn to ride a bicycle one must
become actively engaged with a bicycle. Modelling and Simulation follows much the same
reality. You can learn much about modelling and simulation from reading books and
talking with other people. Skill and talent in developing models and performing
simulations is only developed through the building of models and simulating them. It is
very much ―learn as you go‖ process. From the interaction of the developer and the models
emerges an understanding of what makes sense and what doesn't.
b. Mathematical Models
These are models used for predictive (projecting) purposes. They are abstract and take the
form of mathematical expressions of relationships. For examples:
c. Analogue Models
These are similar to iconic models. But here some other entities are used to represent
directly the entities of the real world. An example is the analogue computer where the
magnitudes of the electrical currents flowing in a circuit can be used to represent quantities
of materials or people moving around in a system. Other examples are; the gauge used to
check the pressure in a tyre. The movement of the dial represent the air pressure in the tyre.
In medical examination, the marks of electrical current on paper, is the analogue
representation of the working of muscles or organs.
d. Simulation Models
Here, instead of entities being represented physically, they are represented by sequences of
random numbers subject to the assumptions of the model. These models represent
(emulate) the behaviour of a real system. They are used where there are no suitable
mathematical models or where the mathematical model is too complex or where it is not
possible to experiment upon a working system without causing serious disruption.
e. Heuristic Models
These models use intuitive (or futuristic) rules with the hope that it will produce workable
solutions, which can be improved upon. For example, the Arthur C Clerk‘s heuristic model
was the forerunner of the communications satellite and today‘s international television
broadcast.
f. Deterministic Models
These are models that contain certain known and fixed constants throughout their
formulation e.g., Economic Order Quantity (EOQ) for inventory control under uncertainty.
g. Stochastic models
These are models that involve one or more uncertain variables and as such are subject to
probabilities.
3.5 Applications
One application of scientific modelling is the field of "Modelling and Simulation",
generally referred to as "M&S". M&S has a spectrum of applications which range from
concept development and analysis, through experimentation, measurement and
verification, to disposal analysis. Projects and programs may use hundreds of different
simulations, simulators and model analysis tools
The first important step is to extract from the real world situation the essential features to be
included in the model. Include only factors that make the model a meaningful representation
of reality, while not creating a model, which is difficult by including many variables that do
not have much effect. Factors to be considered include ones over which management has
control and external factors beyond management control. For the factors included,
assumptions have to be made about their behaviour.
Run (simulate) the model and measure what happens. For example, if we have simulation of
a queuing situation where two servers are employed, we can run this for hundreds of
customers passing through the system and obtain results such as the average length of the
queue and the average waiting time per customer. We can then run it with three servers, say,
and see what new values are obtained for these parameters. Many such runs can be carried
out making different changes to the structure and assumptions of the model.
In the case of a mathematical model we have to solve a set of equations of some sort, e.g.
linear programming problem where we have to solve a set of constraints as simultaneous
equations, or in stock control – where we have to use previously accumulated data to predict
the future value of a particular variable.
When we have solved our mathematical model or evaluated some simulation runs, we can
now draw some conclusions about the model. For example, if we have the average queue
length and the average waiting time for a queuing situation varied in some ways, we can use
this in conjunction with information on such matters as the wage-rates for servers and value
of time lost in the queue to arrive at decisions on the best way to service the queue.
Finally, we use our conclusions about the model to draw some conclusions about the original
real world situation. The validity of the conclusions will depend on how well our model
actually represented the real world situation.
Usually the first attempt at modelling the situation will almost certainly lead to results at
variance with reality. We have to look back at the assumptions in the model and adjust them.
The model must be rebuilt and new results obtained. Usually, a large number of iterations of
this form will be required before acceptable model is obtained. When an acceptable model
has been obtained, it is necessary to test the sensitivity of that model to possible changes in
condition.
The modelling process can then be considered for implementation when it is decided that the
model is presenting the real world (object or system) sufficiently well for conclusions drawn
from it to be a useful guide to action.
The model can be solved by hand, especially if it is simple. It could take time to arrive at an
acceptable model. For complex models or models which involve tremendous amount of data,
the computer is very useful.
5.0 Conclusion
In this unit we took a look at an overview of major concepts that underlie models to prepare
us for the work in this course simulation and modelling.
6.0 Summary
In introducing this unit, it was stated that simulation is a decision support tool which enable
us to evaluate, compare and optimize alternative ways of solving a problem and the
following were discussed:
Modelling was defined
The concepts of modelling were outlined
Why we use models
The application of models especially for simulations
The types of modelswhich include: Physical, Mathematical, Analogue,
Simulation, Heuristic, Stochastic and Deterministic models were highlighted.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Pseudorandom Number Generation
3.2 Random Numbers in Computer
3.3 Using the RND Function in BASIC
3.4 Simulating Randomness
3.5 Properties of a Good Random Number Generator
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
The use of Random numbers lies at the foundation of modelling and simulations.
Computer applications such as simulations, games, graphics, etc., often need the ability to
generate random numbers for such application.
The quality of a random number generator is proportional to its period, or the number of
random numbers it can produce before a repeating pattern sets in. In large-scale
simulations, different algorithms (called shift-register and lagged-Fibonacci) can be used,
although these also have some drawbacks, combining two different types of generators
may produce the best results.
Generating a random number series from a single seed works fine with most simulations that
rely upon generating random events under the control of probabilities (Monte Carlo
simulations). However, although the sequence of numbers generated from a given seed is
randomly distributed, it is always the same series of numbers for the same seed. Thus, a
computer poker game that simply used a given seed would always generate the same hands
for each player.
What is needed is a large collection of potential seeds from which one can be more or less
randomly chosen. If there are enough possible seeds, the odds of ever getting the same series
of numbers become diminishingly small.
One way to do this is to read the time (and perhaps date) from the computer‘s system clock
and generate a seed based on that value. Since the clock value is in milliseconds, there are
millions of possible values to choose from. Another common technique is to use the interval
between the user‘s keystrokes (in milliseconds). Although they are not perfect, these
techniques are quite adequate for games.
The so-called true random number generators extract random numbers from physical
phenomena such as a radioactive source or even atmospheric noise as detected by a radio
receiver.
What we usually do is to take for instance ten pieces of papers and number them
0,1,2,3,4,5,6,7,8, and 9 , fold and place them in a box. Shake the box and thoroughly mix the
slips of paper. Select a slip; then record the number that is on it. Replace the slip and repeat
this procedure over and over. The resultant record of digits is a realized sequence of random
numbers. Assuming you thoroughly mix the slips before every draw, the nth digit of the
sequence has an equal or uniform chance of being any of the digits 0, 1, 2,3,4,5,6,7,8, 9
irrespective of all the preceding digits in the recorded sequence.
In some simulations, we use random numbers that are between 0 and 1. For example, if you
need such numbers with four decimal digits, then you can take four at a time from the
18
recorded sequence of random digits, and place a decimal point in front of each group of four.
To illustrate, if the sequence of digits is 358083429261… then the four decimal placed
random numbers are .3580, .8342, and .9261.
Experts in computer science have devised mathematical processes for generating digits that
yield sequences satisfying many of the statistical properties of a truly random process. To
illustrate, if you examine a long sequence of digits produced by deterministic formulas, each
digit will occur with nearly the same frequency, odd numbers will be followed by even
numbers about as often as by odd numbers, different pairs of numbers occur with nearly the
same frequency, etc. Since such a process is not really random, it is called pseudo-random
number generator.
Exercise
Suggest one or two experimental set-ups (analogous to the slip-in-a-box approach) for
generating uniform random digits.
19
same sequence of pseudo random numbers unless we vary the random number seed using the
BASIC statement:
RANDOMIZE
This way, we can control the sequence of random numbers generated. RANDOMIZE will
result to the following prompt on the VDU:
Suppose your response to the above prompt is 100. Then the computer would use this
number, 100, to generate the first random number. This number generated is used to generate
the next random number. Thus by specifying the seed for the first random number, we are in
a way controlling all random numbers that will be generated until the seed is reset. A control
such as this can be very useful in validating a simulation program or other computer
programs that use random numbers.
Consider the following BASIC program:
FOR K% = 1 TO 5
PRINT RND NEXT K%
END
If the above program is run, some seven-digit decimal numbers like the following will be
displayed: .6291626, .1948297, .6305799, .8625749, .736353. The particular
digits displayed depend on the system time.
Every time you run the above program, different sequence of numbers will be displayed.
Now add a RANDOMIZE statement to the program:
If you run this program with 300 as a response to the prompt for the random number seed,
the following may be displayed: .1851404, .9877729, .806621, .8573399,
.6208935
Exercise
Find out whether the same set of random numbers will be displayed each time the above
program is run with seed 300.
20
3.4 Simulating Randomness
Suppose we want to simulate the throwing of a fair die. A random number between 0 and 1
will not always satisfy our needs. If the die is fair, throwing it several times will yield a series
of uniformly distributed integers 1,2,3,4,5 and 6. Consequently we need to be able to
generate a random integer with values in the range 1 and 6 inclusive.
Now the function RND generates a random number between 0 and 1. Specifically, the
random variable X is in the range: 0 < X < 1
The expression X = RND *6
Will generate a number in the range: 0 < X < 6
We must convert these numbers to integers as follows: X% = INT (RND*6)
The expression produces an integer in the range: 0<X<5
Therefore if we need to add 1 to the above expression in simulating the tossing of a die.
Thus,
X% = INT (RND*6) + 1
In general, to generate a random integer between P and N we use the expression:
INT(RND*N+1-P) + P;
where N>P
While for integer number between 0 and N – 1 we use the expression INT (RND *N).
Example 1
A simple QBASIC program that will stimulate the tossing of two dice and display the value
obtained after each toss, and the total value of the dice is shown below.
CLS
REM DI and D2 represent the individual dice. RANDOMIZE
DO
D1% = INT(RND*6) + 1
D2% = INT(RND*6) + 1
TOTAL% = D1% + D2%
PRINT ―Die 1:‖; D1%; ―Die 2:‖; D2%
PRINT: PRINT
INPUT ―Toss Again (Y/N)?‖, Y$
LOOP UNTIL UCASE$(Y$) = ―N‖
END
Exercise
Run the program of example 1several times using different random number seeds to
21
determine if the integers generated for the individual die are uniformly distributed between 1
and 6 inclusive.
If we want the computer to be generating the random number seed automatically, we use
RANDOMIZE TIMER
In place of RANDOMIZE.
Example 2
Another QBASIC program to simulate the tossing of a fair coin 10 times. The program
displays a H when a head appears and a T when a tail appears.
CLS
REM Program to simulate the tossing of a coin 10 times
REM and print the outcome
RANDOMIZE TIMER
FOR K% = 1 TO 10
RANDNO = RND
IF RANDNO <= 0.5 PRINT ―H‖
IF RANDNO > 0.5
PRINT ―T‖
NEXT K%
END
Example 3
Suppose the output of the program of example 3 is: HHTHHTTTHH
and that there are two players X and Y involved in the tossing of the coin. Given that player
X wins N50.00 from player Y if a head appears and loses it to player Y if a tail appears.
Determine who won the game and by how much.
Solution
From the output there are 6 heads and 4 tails.
Player X wins N50.00 x 6 = N300.00 from player Y. He loses N50.00 x 4 = N200.00 to
player Y.
Thus, player X won the game with N300.00 – N200.00 = N100.00.
22
4.0 4.0 Self-Assessment Exercise(s)
Write a QBASIC program to generate thirty random integer numbers distributed between 20
and 50. Your program should ensure that no number is repeated.
Write a QBASIC program to accept a set of characters from the keyboard and then move the
characters randomly across the screen. The movement of the characters should stop once a
key is pressed on the keyboard. The set of characters should also change colors randomly at
the point of the movement.
What is a seed and explain how you can generate random numbers using a seed.
Define a period and state how to improve a period.
5.0 Conclusion
In this unit, you have been introduced to Random Numbers generation. You have also learnt
the how to manipulate the RND function of QBASIC.
6.0 Summary
What you have learnt in this unit concern:
The different ways of generating pseudorandom numbers,
The properties of good random number generator.
The use of QBasic RND function to simulate randomness,
The other Random number generating methods,
23
Unit 3: Congruential Random Number Generator
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 The Congreuential Method
3.2 Choice of a, c and m
3.3 RANECU Random Number Generator
3.4 Other Methods of Generating Random Numbers
3.4.1 Quadratic Congruential Method,
3.4.2 Mid-square method,
3.4.3 Mid-product Method
3.4.4 Fibonnachi Method
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
As has been stated earlier, if you want to write a simulation program and you neither have
a simulation language at your disposal nor a programming language with a random number
generating function, you must design and write a random number generating function and
call it whenever you need it.
Classical uniform random number generators have some major defects, such as, short
period length and lack of higher dimension uniformity. However, nowadays there are a
class of rather complex random number generators which are as efficient as the classical
generators which enjoy the property of a much longer period and of higher dimension
uniformity.
24
3.0 Main Content
3.1 The Congruential Method
The Congruential Method is widely used. The method is based on modulus arithmetic,
which we now discuss briefly.
We say that two numbers x and y are congruent modulo m if (x-y) is an integral multiple
of m. Thus we can write: x = y(modulo m)
For example, let m = 10, then we can write:
13 ≡ 3 (modulo 10)
84 ≡ 4 (modulo 10)
The congruential method generates random numbers by computing the next random
number from the last random number obtained, given an initial random number say, X0,
called the seed.
From the above formula, it follows that the random number generated must be between 0
and (m-1) since MOD (modulo) produces remainder after division. Hence the above
formula will produce the remainder after dividing (aXn + C ) by m. So to generate a
random number between p and m we use:
The multiplicative congruential method is very handy. It is obtained using the general
formula:
rn = arn-1 (modulo m)
where the parameters a, m and the seed r0 are specified to give desirable statistical
properties of the resultant sequence. By virtue of modulo arithmetic, each rn must be one of
the numbers 0,1,2,3… m-1. Clearly, you must be careful about the choice of a and r0. The
25
values of ‗a‘ and r0 should be chosen to yield the largest cycle or period, that is to give the
largest value for n at which rn = r0 for the first time.
Example 4
To illustrate the technique, suppose you want to generate ten decimal place numbers u1,
u2, u3,…. It can be shown that if you use
un = rn x 10-1
where rn = 100003rn-1 (modulo 1010), and r0 = any odd number not divisible by 5,
then the period of the sequence will be 5 x 108, that is rn = r0 for the first time at n = 5 x
108 and the cycle subsequently repeats itself.
n Xn+1 = (5Xn+7)mod 8
0 X1 = (5*X0+7)mod 8 = (5*X4+7)mod 8 = 27 mod 8 = 3
1 X2 = (5*X1+7)mod 8 = (5*X3+7)mod 8 = 22 mod 8 = 6
2 X3 = (5*X2+7)mod 8 = (5*X6+7)mod 8 = 37 mod 8 = 5
3 X4 = (5*X3+7)mod 8 = (5*X5+7)mod 8 = 32 mod 8 = 0
4 X5 = (5*X4+7)mod 8 = (5*X0+7)mod 8 = 7 mod 8 = 7
5 X6 = (5*X5+7)mod 8 = (5*X7+7)mod 8 = 42 mod 8 = 2
6 X7 = (5*X6+7)mod 8 = (5*X2+7)mod 8 = 17 mod 8 = 1
7 X8 = (5*X7+7)mod 8 = (5*X1+7)mod 8 = 12 mod 8 = 4
Note that the value of X8 is 4, which is the value of the seed X0. So if we compute X9, X10,
etc the same random numbers 3,6,5,0,7,2,1,4 will be generated once more.
Note also that if we divide the random integer values by 8, we obtain random numbers in
the range 0 < Xn+1 < 1 which is similar to using the RND function of BASIC.
In his book, The Art of Computer Programming, Donald Knuth presents several rules for
maximizing the length of time before the random number generator comes up with the
same value as the seed. This is desirable because once the random number generator comes
up with the initial seed, it will start to repeat the same sequence of random numbers (which
26
will not be so random since the second time around we can predict what they will be).
According to Knuth's rules, if M is prime, we can let C be 0.
The LCM defined above has full period if and only if the following conditions are
satisfied:
a) m and c are relatively prime
b) If q is a prime number that divides m , then q divides a-1
c) If 4 divides m, then 4 divides a-1
Therefore, the values for a, c and m are not generated randomly, rather they are carefully
chosen based on certain considerations. For a binary computer with a word length of r bits,
the normal choice for m is m = 2r-1. With this choice of m, a can assume any of the values
1, 5,9,13, and c can assume any of the values 1, 3, 5, 7… However, experience shows that
the congruential method works out very well if the value of a is an odd integer not divisible
by either 3 or 5 and c chosen such that c mod 8 = 5 (for a binary computer) or c mod 200 =
21 (for a decimal computer).
Example 5
Develop a function procedure called RAND in QBASIC which generates a random number
between 0 and 1 using the mixed congruential method. Assume a 16-bit computer.
Solution
FUNCTION RAND (SEED)
CONST M = 32767, A = 2743, C = 5923
IF SEED < 0 THEN SEED = SEED + M
SEED = (A* SEED + C) MOD M
RAND = SEED/M
END FUNCTION
Note that in the main program that references the above function in (a), the TIMER function
can be used to generate the SEED to be passed to the function RAND as illustrated in
example 2.
Example 5
Write a program that can generate that can generate 20 random integer number distributed
between 1 and 64 inclusive using mixed congruential method.
Solution
QBASIC
27
SEED = RAND (SEED) ‗Call of function RAND PRINT SEED: SPC(2)
NEXT K%
END ‗End of main program
PROGRAM RANDNUM
COMMON SEED
CLS ‗Clear screen
DO 50 K = 1, 25
WRITE (*, 5)
FORMAT(/)
50 CONTINUE
WRITE(*,*) ‗Enter the seed‘
READ(*,*) SEED
DO 30 J = 1, 20
SEED = RAND
WRITE (*, 6) SEED
6 FORMAT (I4)
30 CONTINUE
END
FUNCTION RAND
COMMON SEED
PARAMETER (M = 64, A = 27, C =13)
IF (SEED.LT.0) SEED = SEED + M
HOLD = (A*SEED + C)
SEED = AMOD (HOLD,M) + 1
RAND = SEED
RETURN END
28
failing which a default set is employed. If supplied, these three seeds, in order, should lie in
the ranges [1,32362], [1,31726] and [1,31656] respectively. The program is given below.
29
3.4.1 The Quadratic congruential method
This method uses the formula:
Xn=1 = (dX 2 + cX + a) modulo mn n
Where d is chosen in the same way as c and m should be a power of 2 for the method to yield
satisfactory results.
30
a. A sequence of 10 one-digit random numbers given that
Xn+1 ≡ (Xn + 3)(modulo 10) and X0 = 2
b. A sequence of eight random numbers between 0 and 7 given that
Xn+1 ≡ (5Xn + 1)(modulo 8) and X0 = 4
c. A sequence of two-digit random numbers such that
Xn+1 ≡ (61Xn + 27)(modulo 100) and X0 = 40
d. A sequence of five-digit random numbers such that
Xn+1 ≡ (21Xn + 53)(modulo 100) and X0 = 33
5. Define a methods period and state how to improve a period. Show two examples of
such improvement.
6. Consider the multiplicative congruential method for generating random digits. In
each part below, assume modulo 10 arithmetic and determine the length of the
cycle:
a. Let a = 2 and r0 = 1, 3 and 5
b. Let a = 3 and r0 = 1,2 and 5
5.0 Conclusion
In this unit, you have been introduced to Random Numbers generation. You have also
learnt how to design random number generator.
6.0 Summary
What you have learnt in this unit concern:
The Congruential methods of generating random numbers,
The use of QBasic RND function to simulate randomness,
The other Random number generating methods,
The properties of good random number generator.
31
Pishro-Nik, H. (2014). Introduction to probability, statistics, and random processes. Blue
Bell, PA: Kappa Research, LLC.
Spiegel, M. R., Schiller, J. J., & Srinivasan, R. A. (2013). Schaums outline of probability
and statistics. New York: McGraw-Hill.
32
Unit 4: Monte Carlo Methods
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Overview of Monte Carlo Method
3.2 History of Monte Carlo Method
3.3 Applications of Monte Carlo Methods
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
Monte Carlo methods (or Monte Carlo experiments) are a class of computational algorithms
that rely on repeated random sampling to compute their results. Monte Carlo methods are
often used in simulating physical and mathematical systems. The methods are especially
useful in studying systems with a large number of coupled (interacting) degrees of freedom,
such as fluids, disordered materials, strongly coupled solids, and cellular structures. More
broadly, Monte Carlo methods are useful for modelling phenomena with significant
uncertainty in inputs, such as the calculation of risk in business. These methods are also
widely used in mathematics: a classic use is for the evaluation of definite integrals,
particularly multidimensional integrals with complicated boundary conditions. It is a widely
successful method in risk analysis when compared with alternative methods or human
intuition. When Monte Carlo simulations have been applied in space exploration and oil
exploration, actual observations of failures, cost overruns and schedule overruns are routinely
better predicted by the simulations than by human intuition or alternative "soft" methods.
Notice how the π approximation follows the general pattern of Monte Carlo algorithms. First,
we define an input domain: in this case, it's the square which circumscribes our circle. Next,
we generate inputs randomly (scatter individual grains within the square), then perform a
computation on each input (test whether it falls within the circle). At the end, we aggregate
the results into our final result, the approximation of π.
Note, also, two other common properties of Monte Carlo methods: the computation's reliance
on good random numbers, and its slow convergence to a better approximation as more data
points are sampled. If grains are purposefully dropped into only, for example, the center of
the circle, they will not be uniformly distributed, and so our approximation will be poor. An
approximation will also be poor if only a few grains are randomly dropped into the whole
square. Thus, the approximation of π will become more accurate both as the grains are
dropped more uniformly and as more are dropped.
……..6
Most integrals can be converted to this form with a suitable change of variables, so we can
consider this to be a general application suitable for the Monte Carlo method.
The integral represents a non-random problem, but the Monte Carlo method approximates a
solution by introducing a random vector U that is uniformly distributed on the region of
integration. Applying the function f to U, we obtain a random variable f(U). This has
expectation:
………..(7)
………..(8)
Comparing [6] and [8], we obtain a probabilistic expression for the integral Ψ:
……………..(9)
so random variable f(U) has mean Ψ and some standard deviation ζ. We define
………….(10)
as an unbiased estimator for Ψ with standard error ζ. This is a little unconventional, since
[10] is an estimator that depends upon a sample {U[1]}of size one, but it is a valid estimator
nonetheless.
To estimate Ψ with a standard error lower than ζ, let‘s generalize our estimator to
accommodate a larger sample {U[1], U [2], … , U [m]}. Applying the function f to each of these
yields m independent and identically distributed (IID) random variables f(U [1]), f(U [2]), … ,
f(U [m]), each with expectation Ψ and standard deviation ζ. The generalization of [10]
………….(11)
…………..(12)
If we have a realization {u , u[2], … , u[m]} for our sample, we may estimate Ψ as:
[1]
…………….(13)
We call [11] the crude Monte Carlo estimator. Formula [12] for its standard error is
important for two reasons. First, it tells us that the standard error of a Monte Carlo analysis
decreases with the square root of the sample size. If we quadruple the number of
realizations used, we will half the standard error. Second, standard error does not depend
upon the dimensionality of the integral [6]. Most techniques of numerical integration such
as the trapezoidal rule or Simpson's method suffer from the curse of dimensionality.
When generalized to multiple dimensions, the number of computations required to apply
them, increases exponentially with the dimensionality of the integral. For this reason, such
methods cannot be applied to integrals of more than a few dimensions. The Monte Carlo
method does not suffer from the curse of dimensionality. It is as applicable to a 1000-
dimensional integral as it is to a one-dimensional integral.
While increasing the sample size is one technique for reducing the standard error of a
Monte Carlo analysis, doing so can be computationally expensive. A better solution is to
employ some technique of variance reduction. These techniques incorporate additional
information about the analysis directly into the estimator. This allows them to make the
Monte Carlo estimator more deterministic, and hence have a lower standard error.
Due to high mathematics required and burden of understanding at this level, we have to
stop this discussion here.
It was only after electronic computers were first built (from 1945 on) that Monte Carlo
methods began to be studied in depth. In the 1950s they were used at Los Alamos for early
work relating to the development of the hydrogen bomb, and became popularized in the
fields of physics, physical chemistry, and operations research. The Rand Corporation and
the U.S. Air Force were two of the major organizations responsible for funding and
disseminating information on Monte Carlo methods during this time, and they began to
find a wide application in many different fields.
Uses of Monte Carlo methods require large amounts of random numbers, and it was their
use that spurred the development of pseudorandom number generators, which were far
quicker to use than the tables of random numbers which had been previously used for
statistical sampling.
a. Physical sciences:
Monte Carlo methods are very important in computational physics, physical chemistry, and
related applied fields, and have diverse applications from complicated quantum
calculations to designing heat shields and aerodynamic forms. The Monte Carlo method is
widely used in statistical physics, particularly Monte Carlo molecular modelling as an
alternative for computational molecular dynamics as well as to compute statistical field
theories of simple particle and polymer models. In experimental particle physics, these
methods are used for designing detectors, understanding their behaviour and comparing
experimental data to theory, or on vastly large scale of the galaxy modelling.
Monte Carlo methods are also used in the models that form the basis of modern weather
forecasting operations.
b. Engineering
Monte Carlo methods are widely used in engineering for sensitivity analysis and
quantitative probabilistic analysis in process design. The need arises from the interactive,
co-linear and non-linear behaviour of typical process simulations. For example,
in microelectronics engineering, Monte Carlo methods are applied to analyze
correlated and uncorrelated variations in analog and digital integrated circuits. This
enables designers to estimate realistic 3 sigma corners and effectively optimise
circuit yields.
in geostatistics and geometallurgy, Monte Carlo methods strengthen the design of
mineral processing flow sheets and contribute to quantitative risk analysis.
c. Visual Designs
Monte Carlo methods have also proven efficient in solving coupled integral differential
equations of radiation fields and energy transport, and thus these methods have been used
in global illumination computations which produce photorealistic images of virtual 3D
models, with applications in video games, architecture, design and computer generated
films.
d. Finance and business
Monte Carlo methods in finance are often used to calculate the value of companies, to
evaluate investments in projects at a business unit or corporate level, or to evaluate
financial derivatives. Monte Carlo methods used in these cases allow the construction of
stochastic or probabilistic financial models as opposed to the traditional static and
deterministic models, thereby enhancing the treatment of uncertainty in the calculation.
e. Telecommunications
When planning a wireless network, design must be proved to work for a wide variety of
scenarios that depend mainly on the number of users, their locations and the services they
want to use. Monte Carlo methods are typically used to generate these users and their
states. The network performance is then evaluated and, if results are not satisfactory, the
network design goes through an optimization process.
f. Games
Monte Carlo methods have recently been applied in game playing related artificial
intelligence theory. Most notably the game of Battleship have seen remarkably successful
Monte Carlo algorithm based computer players. One of the main problems that this
approach has in game playing is that it sometimes misses an isolated, very good move.
These approaches are often strong strategically but weak tactically, as tactical decisions
tend to rely on a small number of crucial moves which are easily missed by the randomly
searching Monte Carlo algorithm.
g. Uses in mathematics
In general, Monte Carlo methods are used in mathematics to solve various problems by
generating suitable random numbers and observing that fraction of the numbers which
obeys some property or properties. The method is useful for obtaining numerical solutions
to problems which are too complicated to solve analytically. The most common application
of the Monte Carlo method in mathematics are:
i. Integration
Deterministic methods of numerical integration usually operate by taking a number of
evenly spaced samples from a function. In general, this works very well for functions of
one variable. However, for functions of vectors, deterministic quadrature methods can be
very inefficient. To numerically integrate a function of a two-dimensional vector, equally
spaced grid points over a two-dimensional surface are required. For instance a 10x10 grid
requires 100 points. If the vector has 100 dimensions, the same spacing on the grid would
require 10100 points which is far too many to be computed. But 100 dimensions is by no
means unusual, since in many physical problems, a "dimension" is equivalent to a degree
of freedom.
Monte Carlo methods provide a way out of this exponential time-increase. As long as the
function in question is reasonably well-behaved, it can be estimated by randomly selecting
points in 100-dimensional space, and taking some kind of average of the function values at
these points. By the law of large numbers, this method will display convergence (i.e.
quadrupling the number of sampled points will halve the error, regardless of the number of
dimensions).
ii. Optimization
Most Monte Carlo optimization methods are based on random walks. The program will
move around a marker in multi-dimensional space, tending to move in directions which
lead to a lower function, but sometimes moving against the gradient.
When analyzing an inverse problem, obtaining a maximum likelihood model is usually not
sufficient, as we normally also wish to have information on the resolution power of the
data. In the general case we may have a large number of model parameters, and an
inspection of the marginal probability densities of interest may be impractical, or even
useless. But it is possible to pseudorandomly generate a large collection of models
according to the posterior probability distribution and to analyze and display the models in
such a way that information on the relative likelihoods of model properties is conveyed to
the spectator. This can be accomplished by means of an efficient Monte Carlo method,
even in cases where no explicit formula for the a priori distribution is available.
h. Computational mathematics
Monte Carlo methods are useful in many areas of computational mathematics, where a
lucky choice can find the correct result. A classic example is Rabin's algorithm for
primality testing (algorithm which determines whether a given number is prime). It states
that for any n which is not prime, a random x has at least a 75% chance of proving that n is
not prime. Hence, if n is not prime, but x says that it might be, we have observed at most a
1-in-4 event. If 10 different random x say that "n is probably prime" when it is not, we
have observed a one-in-a-million event. In general a Monte Carlo algorithm of this kind
produces one correct answer with a guarantee that n is composite, and x proves it so, but
another one without, but with a guarantee of not getting this answer when it is wrong too
often; in this case at most 25% of the time.
Remark:
In physics, two systems are coupled if they are interacting with each other. Of special
interest is the coupling of two (or more) vibratory systems (e.g. pendula or resonant
circuits) by means of springs or magnetic fields, etc. Characteristic for a coupled
oscillation is the effect of beat.
6.0 Summary
In this unit we discussed the following:
The algorithm of Monte Carlo method
The history of Monte Carlo method which spurred the development of pseudorandom
number generator
The application of Monte Carlo methods in areas such as physical sciences,
Engineering, Finance and Business, telecommunications, Games, Mathematics, etc.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 What is Statistics
3.2 What is a Statistical Distribution?
3.3 Measures of Central Tendency
3.4 Measures of Variation
3.5 Showing Data Distribution in Graphs
3.6 The Difference between a Continuous and a Discrete Distribution
3.7 Normal Distribution
3.7.1 Standard Normal Distribution
3.7.2 The Normal Distribution as a Model for Measurements
3.7.3 Conversion to a Standard Normal Distribution
3.7.4 Skewed Distributions µ
3.8 What is a Percentile?
3.9 Probabilities in Discrete Distributions
3.10 Probability and the Normal Curve
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
Although simulation can be a valuable tool for better understanding the underlying
mechanisms that control the behaviour of a system, using simulation to make predictions
of the future behaviour of a system can be difficult. This is because, for most real-world
systems, at least some of the controlling parameters, processes and events are often
stochastic, uncertain and/or poorly understood. The objective of many simulations is to
identify and quantify the risks associated with a particular option, plan or design.
Simulating a system in the face of such uncertainty and computing such risks requires that
the uncertainties be quantitatively included in the calculations. To do this we collect data
about the system parameters and subject them to statistical analysis.
The mean, median and mode are called measures of central tendency.
Mean, Median, Mode, Range, and Standard Deviations are measurements in a sample
(statistics) and can also be used to make inferences on a population.
Discrete distributions describe a finite number of possible values. (shown by the bars)
In a normal distribution, data are most likely to be at the mean. Data are less likely to be
farther away from the mean.
The normal distribution is defined by the following equation:
The graph of the normal distribution depends on two factors - the mean and the standard
deviation. The mean of the distribution determines the location of the center of the graph,
and the standard deviation determines the height and width of the graph. When the
standard deviation is large, the curve is short and wide; when the standard deviation is
small, the curve is tall and narrow. All normal distributions look like a symmetric, bell-
shaped curve, as shown in figure 3a and 3b.
(a) (b)
Fig. 3: Graph of Normal Distribution Based on Size of Mean and Standard Deviation
The curve on the left is shorter and wider than the curve on the right, because the curve on
the left has a bigger standard deviation.
z = (X - µ) / ζ
where X is a normal random variable, µ is the mean of X, and ζ is the standard deviation of
X.
Transform raw data. Usually, the raw data are not in the form of z-scores. They
need to be transformed into z-scores, using the transformation equation presented
earlier: z = (X - µ) / ζ.
Find the probability. Once the data have been transformed into z-scores, you can
use standard normal distribution tables, online calculators (e.g., Stat Trek's free
normal distribution calculator) to find probabilities associated with the z-scores.
The problem in the next section demonstrates the use of the normal distribution as a model
for measurement.
Example 1 - Ada earned a score of 940 on a national achievement test. The mean test
score was 850 with a standard deviation of 100. What proportion of students had a higher
score than Ada? (Assume that test scores are normally distributed.)
Solution - As part of the solution to this problem, we assume that test scores are normally
distributed. In this way, we use the normal distribution as a model for measurement.
Given an assumption of normality, the solution involves three steps.
First, we transform Ada's test score into a z-score, using the z-scoretransformation
equation.
z = (X - µ) / ζ = (940 - 850) / 100 = 0.90
Then, using a standard normal distribution table, we find the cumulative
probability associated with the z-score. In this case, we find P(Z < 0.90) = 0.8159.
Therefore, the P(Z > 0.90) = 1 - P(Z < 0.90) = 1 - 0.8159 = 0.1841.
Thus, we estimate that 18.41 percent of the students tested had a higher score than Ada.
Example 2 - An average light bulb manufactured by the Acme Corporation lasts 300 days
with a standard deviation of 50 days. Assuming that bulb life is normally distributed, what
is the probability that an Acme light bulb will last at most 365 days?
Solution: Given a mean score of 300 days and a standard deviation of 50 days, we want to
find the cumulative probability that bulb life is less than or equal to 365 days. Thus, we
know the following:
We enter these values into the formula and compute the cumulative probability. The
answer is: P( X < 365) = 0.90. Hence, there is a 90% chance that a light bulb will burn out
within 365 days.
Equations (1) and (2) are called; Pearson‘s first and second coefficients of skewness.
3.8 What is a Percentile?
A percentile (or cumulative probability) is the proportion of data in a distribution less
than or equal to a data point. If you scored a 90 on a math test and 80% of the class had
scores of 90 or lower; your percentile is 80. In the figure 4, b=90 and P(Z<b)=80.
6.0 Summary
In this unit:
We defined Statistics as field of study that is concerned with the collection,
description, and interpretation of data.
We saw that Statistical Distributions describe the numbers of times each possible
outcome occurs in a sample.
We computed various measures of Central Tendency and Variations which can be
used to make inferences.
And explained the following components of Statistical Distributions:
o Normal Distributions,
o z-score
o percentile,
o Skewed Distributions
o Ways to transform data to Graphs
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Distribution Functions and Simulation
3.2 Probability Definitions
3.3 Random Variables
3.4 Probability Function
3.5 Mathematical Treatment of Probability
3.6 Probability theory
3.7 The Limit theorems
3.8 Probability Distribution Functions
3.9 Summary of Common Probability Distributions
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
In this section we look at the branch of statistics that deals with analysis of random events.
Probability is the numerical assessment of likelihood on a scale from 0 (impossibility) to 1
(absolute certainty). Probability is usually expressed as the ratio between the number of ways
an event can happen and the total number of things that can happen (e.g., there are 13 ways
of picking a diamond from a deck of 52 cards, so the probability of picking a diamond is
13/52, or ¼). Probability theory grew out of attempts to understand card games and
gambling. As science became more rigorous, analogies between certain biological, physical,
and social phenomena and games of chance became more evident (e.g., the sexes of newborn
infants follow sequences similar to those of coin tosses). As a result, probability became a
fundamental tool of modern genetics and many other disciplines.
1. Frequentists talk about probabilities only when dealing with experiments that are
random and well-defined. The probability of a random event denotes the relative
frequency of occurrence of an experiment's outcome, when repeating the experiment.
Frequentists consider probability to be the relative frequency "in the long run" of
outcomes.
2. Bayesians, however, assign probabilities to any statement whatsoever, even when no
random process is involved. Probability, for a Bayesian, is a way to represent an
individual's degree of belief in a statement, or an objective degree of rational belief,
given the evidence
The scientific study of probability is a modern development. Gambling shows that
there has been an interest in quantifying the ideas of probability for millennia, but
exact mathematical descriptions of use in those problems only arose much later.
Probability Distribution
A probability distribution gathers together all possible outcomes of a random variable (i.e.
any quantity for which more than one value is possible), and summarizes these outcomes by
indicating the probability of each of them. While a probability distribution is often associated
with the bell-shaped curve, recognize that such a curve is only indicative of one specific type
of probability, the so-called normal probability distribution. However, in real life, a
probability distribution can take any shape, size and form.
In this case, we would have a uniform probability distribution: the chances that our random
day would fall on any particular day are the same, and the graph of our probability
distribution would be a straight line.
Examples:
Rates of return can theoretically range from –100% to positive infinity.
Time is bound on the lower side by 0.
Market price of a security will also have a lower limit of $0, while its upper limit will
depend on the security – stocks have no upper limit (thus a stock price‘s outcome >
$0),
Bond prices are more complicated, bound by factors such as time-to-maturity and
embedded call options. If a face value of a bond is $1,000, there‘s an upper limit
(somewhere above $1,000) above which the price of the bond will not go, but
pinpointing the upper value of that set is imprecise.
The two key properties of a probability function, p(x) (or f(x) for continuous), are the
following:
1. 0 < p(x) < 1, since probability must always be between 0 and 1.
2. Add up all probabilities of all distinct possible outcomes of a random variable, and the
sum must equal 1.
Determining whether a function satisfies the first property should be easy to spot since we
know that probabilities always lie between 0 and 1. In other words, p(x) could never be
1.4 or –0.2. To illustrate the second property, say we are given a set of three possibilities
for X: (1, 2, 3) and a set of three for Y: (6, 7, 8), and given the probability functions f(x)
and g(y).
x f(x) y g(y)
1 0.31 6 0.32
2 0.43 7 0.40
3 0.26 8 0.23
x f(x)
<0 0.2
>0 0.8
Joint Probabilty
If both the events A and B occur on a single performance of an experiment this is called
the intersection or joint probability of A and B, denoted as and .
If two events, A and B are independent then the joint probability is:
for example, if two coins are flipped the chance of both being heads is: .
this is called the union of the events A and B denoted as . If two events are
mutually exclusive then the probability of either occurring is:
.
For example, the chance of rolling a 1 or 2 on a six-sided die is
For example, when drawing a single card at random from a regular deck of cards, the chance
of getting a heart or a face card (J,Q,K) (or one that is both) is , because
of the 52 cards of a deck 13 are hearts, 12 are face cards, and 3 are both: here the possibilities
included in the "3 that are both" are included in each of the "13 hearts" and the "12 face
cards" but should only be counted once.
Conditional Probability
This is the probability of some event A, given the occurrence of some other event B.
Conditional probability is written P(A|B), and is read "the probability of A, given B". It is
defined by:
Summary of probabilities
Event Probability
A
Not A P(A) = 1-P(A)
A or B P(A U B) = P(A) + P(B)-P(A∩B)
= P(A)+P(B) If A and B are mutually exclusive
A and B P(A∩B) = P(A|B)P(B)
= P(A)P(B) If A and B are independent
A given B P(A|B) = P(A∩B)/P(B)
Two or more events are mutually exclusive if the occurrence of any one of them excludes
the occurrence of the others.
3.6 Probability theory
There have been at least two successful attempts to formalize probability, namely the
Kolmogorov formulation and the Cox formulation. In Kolmogorov's formulation sets are
interpreted as events and probability itself as a measure on a class of sets. In Cox's
theorem, probability is taken as a primitive (that is, not further analyzed) and the emphasis
is on constructing a consistent assignment of probability values to propositions. In both
cases, the laws of probability are the same, except for technical details.
Probability theory is a mathematical science that permits one to find, using the
probabilities of some random events, the probabilities of other random events connected in
some way with the first.
The assertion that a certain event occurs with a probability equal, for example, to 1/2, is
still not, in itself, of ultimate value, because we are striving for definite knowledge. Of
definitive, cognitive value are those results of probability theory that allow us to state that
the probability of occurrence of some event A is very close to 1 or (which is the same
thing) that the probability of the non-occurrence of event A is very small. According to the
principle of ―disregarding sufficiently small probabilities,‖ such an event is considered
practically reliable. Such conclusions, which are of scientific and practical interest, are
usually based on the assumption that the occurrence or non-occurrence of event A depends
on a large number of factors that are slightly connected with each other.
Consequently, it can also be said that probability theory is a mathematical science that
clarifies the regularities that arise in the interaction of a large number of random factors.
To describe the regular connection between certain conditions S and event A, whose
occurrence or non-occurrence under given conditions can be accurately established, natural
science usually uses one of the following schemes:
(a) For each realization of conditions S, event A occurs. All the laws of classical
mechanics have such a form, stating that for specified initial conditions and
forces acting on an object or system of objects, the motion will proceed in an
unambiguously definite manner.
(b) Under conditions S, event A has a definite probability P(A/S) equal to p.
Thus, for example, the laws of radioactive emission assert that for each
radioactive substance there exists the specific probability that, for a given
amount of a substance, a certain number of atoms N will decompose within a
given time interval.
Let us call the frequency of event A in a given set of n trials (that is, of n repeated
realizations of conditions S) the ratio h = m/n of the number m of those trials in which A
occurs to the total number of trials n. The existence of a specific probability equal to p for
an event A under conditions S is manifested in the fact that in almost every sufficiently
long series of trials, the frequency of event A is approximately equal to p.
Statistical laws, that is, laws described by a scheme of type (b), were first discovered in
games of chance similar to dice. The statistical rules of birth and death (for example, the
probability of the birth of a boy is 0.515) have also been known for a long time. A great
number of statistical laws in physics, chemistry, biology, and other sciences were
discovered at the end of the 19th and in the first half of the 20th century.
(1) P(A) = pi + pj + … + pk
Formula (2) expresses the so-called classical definition of probability according to which
the probability of some event A is equal to the ratio of the number r of outcomes favorable
to A to the number s of all ―equally likely‖ outcomes. The classical definition of
probability only reduces the concept of probability to the concept of equal possibility,
which remains without a clear definition.
EXAMPLE. In the tossing of two dice, each of the 36 possible outcomes can be designated
by (i, j), where i is the number of pips that comes up on the first dice and j, the number on
the second. The outcomes are assumed to be equally likely. To the event A, ―the sum of the
pips is 4,‖ three outcomes are favorable: (1,3); (2,2); (3,1). Consequently, P(A) = 3/36 =
1/12.
Starting from certain given events, it is possible to define two new events: their union
(sum) and intersection (product). Event B is called the union of events A1, A2, …, Ar if it
has the form ―A1 or A2, …, or Ar occurs.‖
Event C is called the intersection of events A1, A2 …, Ar if it has the form ―A1, and A2, …
, and Ar occurs.‖
The union of events is designated by the symbol 𝖴, and the intersection, by ∩. Thus, we
write:
B = A1 𝖴 A2 𝖴 ... 𝖴 Ar C =
A1 ∩ A2 ∩ ... ∩ Ar
Events A and B are called disjoint if their simultaneous occurrence is impossible—that is,
if among the outcomes of a trial not one is favourable to A and B simultaneously.
Two of the basic theorems of probability theory are connected with the operations of union
and intersection of events; these are the theorems of addition and multiplication of
probabilities.
Thus, in the example presented above of tossing two dice, event B, ―the sum of the pips
does not exceed 4,‖ is the union of three disjoint events A2, A3, A4, consisting of the fact the
sum of the pips is equal to 2, 3, and 4, respectively. The probabilities of these events are
1/36, 2/36, and 3/36, respectively. According to the theorem of addition of probabilities,
probability P(B) is:
that is, the probability of the intersection of independent events is equal to the product of
the probabilities of these events. Formula (3) remains correct, if on both sides some of the
events are replaced by their inverses.
EXAMPLE:
Four shots are fired at a target, and the hit probability is 0.2 for each shot. The target hits
by different shots are assumed to be independent events. What is the probability of hitting
the target three times?
Each outcome of the trial can be designated by a sequence of four letters [for example, (s,
f, f, s) denotes that the first and fourth shots hit the target (success), and the second and
third miss (failure)]. There are 2 · 2 · 2 · 2 = 16 outcomes in all. In accordance with the
assumption of independence of the results of individual shots, one should use formula (3)
and the remarks about it to determine the probabilities of these outcomes. Thus, the
probability of the outcome (s, f, f, f) is set equal to 0.2 x 0.8 x 0.8 x 0.8 = 0.1024; here,
0.8 = 1 - 0.2 is the probability of a miss for a single shot. For the event ―three shots hit the
target,‖ the possible outcomes are: (s, s, s, f), (s, s, f, s), (s, f, s, s), and (f, s, s, s) are
favorable and the probability of each is the same:
0.2 · 0.2 · 0.2 · 0.8 = · · · = 0.8 · 0.2 · 0.2 ·.02 = 0.0064
Consequently, the desired probability is 4 x 0.0064 = 0.0256.
Generalizing the discussion of the given example, it is possible to derive one of the
fundamental formulas of probability theory: if events A1, A2, …, An are independent and
each has a probability p, then the probability of exactly m such events occurring is:
m
Pn(m) = Cn (1- p)n- m ....................................................................................................(4)
Here, Cm n denotes the number of combinations of n elements taken m at a time. For large n,
the calculation using formula (4) becomes difficult. In the preceding example, let the number
of shots equal 100; the problem then becomes one of finding the probability x that the
number of hits lies in the range from 8 to 32. The use of formula (4) and the addition theorem
gives an accurate, but not a practically useful, expression for the desired probability
The approximate value of the probability x can be found by the Laplace theorem
with the error not exceeding 0.0009. The obtained result demonstrates that the event 8 ≤ m
≤ 32 is practically certain. This is the simplest, but a typical, example of the use of the limit
theorems of probability theory.
According to the probabilities of (5), probabilities P(E) for all the outcomes of E of the
compound trial and, in addition, the probabilities of all events connected with this trial can
be determined using the multiplication theorem (just as was done in the example above).
Two types of compound trials are the most significant from a practical point of view:
(a) the component trials are independent, that is, the probabilities (5) are equal to the
unconditional probabilities P(Ai), P(Bj), …, P(Yl); and
(b) the results of only the directly preceding trial have any effect on the probabilities of
the outcomes of any trial—that is, the probabilities (5) are equal, respectively, to
P(Ai), P(Bj/Ai), … , P(Yl/Xk).
In this case, it is said that the trials are connected in a Markov chain. The probabilities of
all the events connected with the compound trial are completely determined here by the
initial probabilities P(Ai) and the transition probabilities P(Bj/Ai), … , P(Yl/Xk).
Often, instead of the complete specification of a probability distribution of a random
variable, it is preferable to use a small number of numerical characteristics. The most
frequently used are the mathematical expectation and the dispersion.
Let X1, X2, …, Xn, be independent random variables that have one and the same probability
distribution with EXK = a, DXK = ζ2 and Yn be the arithmetic mean of the first n variables
of sequence such that:
Yn = (X1 + X2 + X 2 + · · · +Xn)/n
In accordance with the law of large numbers, for any ε > 0, the probability of the inequality
| Yn - a | ≤ ε has the limit 1 as n → ∞, and thus Yn, as a rule, differs little from a.
The central limit theorem makes this result specific by demonstrating that the deviations
of Yn from a are approximately subordinate to a normal distribution with mean zero and
dispersion 82/n. Thus, to determine the probabilities of one or another deviation of Yn from
a for large n, there is no need to know all the details about the distribution of the variables
Xn; it is sufficient to know only their dispersion.
In the 1920‘s it was discovered that even in the scheme of a sequence of identically
distributed and independent random variables, limiting distributions that differ from the
normal can arise in a completely natural manner. Thus, for example, if X1 is the time until
the first reversion of some randomly varying system to the original state, and X2 is the time
between the first and second reversions, and so on, then under very general conditions the
distribution of the sum X1 + · · · + Xn (that is, of the time until the Aith reversion), after
multiplication by n-1/α(α is a constant less than 1), converges to some limiting distribution.
Thus, the time until the nth reversion increases, roughly speaking, as n1/α, that is, more
rapidly than n (in the case of applicability of the law of large numbers, it is of the order of
n).
The mechanism of the emergence of the majority of limiting regularities can be understood
ultimately only in connection with the theory of random processes.
Random processes.
In a number of physical and chemical investigations of recent decades, the need has arisen
to consider, in addition to one-dimensional and multidimensional random variables,
random processes—that is, processes for which the probability of one or another of their
courses is defined. In probability theory, a random process is usually considered as a one-
parameter family of random variables X(t). In an overwhelming number of applications,
the parameter t represents time, but this parameter can be, for example, a point in space,
and then we usually speak of a random function. In the case when the parameter t runs
through the integer-valued numbers, the random function is called a random sequence.
Just as a random variable is characterized by a distribution law, a random process can be
characterized by a set of joint distribution laws for X(t1), X(t2), …, X(tn) for all possible
moments of t1, t2, …, tn for any n > 0.
When the random variable takes values in the set of real numbers, the probability
distribution is completely described by the cumulative distribution function, whose value at
each real x is the probability that the random variable is smaller than or equal to x.
The concept of the probability distribution and the random variables which they describe
underlies the mathematical discipline of probability theory, and the science of statistics.
There is spread or variability in almost any value that can be measured in a population (e.g.
height of people, durability of a metal, sales growth, traffic flow, etc.); almost all
measurements are made with some intrinsic error; also in physics many processes are
described probabilistically, from the kinetic properties of gases to the quantum mechanical
description of fundamental particles. For these and many other reasons, simple numbers
are often inadequate for describing a quantity, while probability distributions are often
more appropriate.
measure of singletons .
Another convention reserves the term continuous probability distribution for absolutely
continuous distributions. These distributions can be characterized by a probability density
function: a non-negative Lebesgue integrable function ƒ defined on the real numbers such
that
Discrete distributions and some continuous distributions do not admit such a density.
Terminologies
The support of a distribution is the smallest closed interval/set whose complement has
probability zero. It may be understood as the points or elements that are actual members of
the distribution.
Some properties
The probability density function of the sum of two independent random variables is
the convolution of each of their density functions.
The probability density function of the difference of two independent random
variables is the cross-correlation of their density functions.
Probability distributions are not a vector space – they are not closed under linear
combinations, as these do not preserve non-negativity or total integral 1 – but they
are closed under convex combination, thus forming a convex subset of the space of
functions (or measures).
In mathematics and, in particular, functional analysis, convolution is a mathematical
operation on two functions f and g, producing a third function that is typically viewed as a
modified version of one of the original functions. Convolution is similar to cross-
correlation. It has applications that include statistics, computer vision, image and signal
processing, electrical engineering, and differential equations
3.9.1 Related to real-valued quantities that grow linearly (e.g. errors, offsets)
Normal distribution (aka Gaussian distribution), for a single such quantity; the most
common continuous distribution;
Multivariate normal distribution (aka multivariate Gaussian distribution), for
vectors of correlated outcomes that are individually Gaussian-distributed;
3.9.6 Related to categorical outcomes (events with K possible outcomes, with a given
probability for each outcome)
Categorical distribution, for a single categorical outcome (e.g. yes/no/maybe in a
survey); a generalization of the Bernoulli distribution;
Multinomial distribution, for the number of each type of categorical outcome, given a
fixed number of total outcomes; a generalization of the binomial distribution;
Multivariate hyper geometric distribution, similar to the multinomial distribution, but
using sampling without replacement; a generalization of the hyper geometric
distribution;
3.9.7 Related to events in a Poisson process (events that occur independently with a
given rate)
Poisson distribution, for the number of occurrences of a Poisson-type event in a given
period of time
Exponential distribution, for the time before the next Poisson-type event occurs
5.0 Conclusion
The basis of simulation is randomness. Here we have discussed this fundamental basis
which offers us the possibility to quantitatively represent uncertainties in simulations.
With Probabilities in simulation we can explicitly represent uncertainties by specifying
inputs as probability distributions.
6.0 Summary
In this unit we discussed the following:
Defined Probability as
Discussed the fundamental concepts of probability theory
The limit theorem
Random variables and Random processes
Probability distributions
Provided a listing of common probability distributions grouped by their related
processes
Module Introduction
This module is divided into four (4) units
Unit 1: Simulation and Modelling
Unit 2: Modelling Methods
Unit 3: Physics-Based Finite Element Model
Unit 4: Statistics for Modelling and Simulation
1.0 Introduction
Real world phenomenon are very dynamic thus difficult to exactly predict. To make
decisions in such circumstances, we need a tool or verifiable procedures that guide
decision makers to an informed and provable decision and action. In this unit we will look
at one such tool; simulation which has become cornerstone to many probabilistic projects.
The underlying purpose of simulation is to shed light on the underlying mechanisms that
control the behaviour of a system. More practically, simulation can be used to predict
(forecast) the future behaviour of a system, and determine what you can do to influence
that future behaviour. That is, simulation can be used to predict the way in which the
system will evolve and respond to its surroundings, so that you can identify any necessary
changes that will help make the system perform the way that you want it to.
For example, a fisheries biologist could dynamically simulate the salmon population in a
river in order to predict changes to the population, and quantitatively understand the
impacts on the salmon of possible actions (e.g., fishing, loss of habitat) to ensure that they
do not go extinct at some point in the future.
Also flight simulator on PC is also a computer model of some aspect of the flight; it shows
on the screen the controls and what the pilot is supposed to see from the ―cockpit‖ (his
armchair).
Simulation therefore, is a technique (not a method) for representing a dynamic real world
system by a model and experimenting with the model in order to gain information about
the system and hence take appropriate decision. Simulation can be done by hand or by a
computer.
Simulation is a powerful and important tool because it provides a way in which alternative
designs, plans and/or policies can be evaluated without having to experiment on a real
system, which may be prohibitively costly, time-consuming, or simply impractical to do.
That is, it allows you to ask "What if?" questions about a system without having to
experiment on the actual system itself (and hence incur the costs of field tests, prototypes,
etc.).
What happens when a system is not amenable to treatment using the above model?
Constructing a real physical system could be very expensive and what more testing it with
live human beings and observing what happens could be fatal. Training a new pilot using
an airplane is suicidal. This is why simulation is designed and utilized.
Thus simulation is the answer to our question. Many operations Research analysts consider
simulation to be a method of last resort. This is because it may be useful when other
approaches cannot be used, for example when a real world situation is complex. Note that
nothing prevents you from using simulation approach to analytic problem. Results can at
least be compared!
Thus, before designing and implementing a real life system, it is necessary to find out via
simulation studies whether the system will work otherwise the whole exercise will be a wild
goose chase. Inevitably huge sums of money might have been wasted.
Unlike the situation in mathematical programming, so far there are no clear cut underlying
principle guiding the formulation of simulation models. Each application is ad-hoc to a large
extent. In general there are three basic objectives of simulation studies:
1. To Describe a Current System – Suppose that a manufacturing company has suddenly
observed a marked deterioration in meeting due-dates of customers order. It may be
necessary to build a simulation model to see how the current procedures for
estimating due dates, scheduling production and ordering raw materials are giving
rise to observed delays.
2. To explore a Hypothetical System – such as installing a new system, which will cost a
lot of money, it might be better to build a hypothetical model of the system and learn
from its behaviour.
3. To Design an Improved System – for example consider a supermarket that has one
payment counter. Due to increase in patronage, it is considering to increase the
number of pay points. A simulation experiment may identify if one, two or more
additional points are needed or not needed.
There are two basic types of simulation for which models are built, and the process of
choosing the subset of characteristics or features is different for each. The distinction
between the two types is based on how time is represented; either as a continuous variable or
as a discrete variable.
Suppose we are interested in a gas station. We may describe the behaviour of this system
graphically by plotting the number of cars in the station; the state of the system. Every time a
car arrives the graph increases by one unit while a departing car causes the graph to drop by
one unit. This graph (called sample path), could be obtained from observation of real station,
but could also be artificially constructed. Such artificial construction and analysis of the
resulting sample path (or more sample paths in more complex cases) consists of the
simulation.
The path consists of only horizontal and vertical lines, as cars arrivals and departures
occurred, at distinct points in time, what we refer to as events. Between two consecutive
events, nothing happens – the graph is horizontal. When the number of events are finite, we
call the simulation discrete event.
Discrete event systems (DES) are dynamic systems, which evolve in time by the occurrence
of events at possible irregular time intervals. DES abound in real-world applications.
Examples include traffic systems, flexible manufacturing systems, computer communication
systems, production lines, flow networks etc. Most of these systems can be modelled in terms
of discrete events whose occurrence causes the system to change from one state to another.
Simulations may be performed manually. Most often, however, the system model is written
either as a computer program or as some kind of input into simulator software.
A discrete event simulation (DE) manages events in time. Most computer, logic-test and
fault-tree simulations are of this type. In this type of simulation, the simulator maintains a
queue of events sorted by the simulated time they should occur. The simulator reads the
queue and triggers new events as each event is processed. It is not important to execute the
simulation in real time. It's often more important to be able to access the data produced by
the simulation, to discover logic defects in the design, or the sequence of events.
A special type of discrete simulation which does not rely on a model with an underlying
equation, but can nonetheless be represented formally, is agent-based simulation. In agent-
based simulation, the individual entities (such as molecules, cells, trees or consumers) in the
model are represented directly (rather than by their density or concentration) and possess an
internal state and set of behaviours or rules which determine how the agent's state is updated
from one time-step to the next.
Next, specify what to do at each event. The above example would look like this:
At event of entity arrival: Create next arrival. If the server is free, send entity for start of
service. Otherwise it joins the queue. At event of service start: Server becomes occupied.
Schedule end of service for this entity. At event of service end: Server becomes free. If any
entity is waiting in the queue: remove the first entity from the queue; send it for start of
service.
Some initiation is still required, for example, the creation of the first arrival. Lastly, the
above is translated into code. This is easy with appropriate library function, which has
subroutine for creation, scheduling, proper timing of events, queue manipulations, random
variate generation and statistics collection.
Computer graphics can be used to display the results of a computer simulation. Animations
can be used to experience a simulation in real-time e.g. in training simulations. In some cases
animations may also be useful in faster than real-time or even slower than real-time modes.
For example, faster than real-time animations can be useful in visualizing the build up of
queues in the simulation of humans evacuating a building.
There are many different types of computer simulation; the common feature they all share is
the attempt to generate a sample of representative scenarios for a model in which a complete
enumeration of all possible states of the model would be prohibitive or impossible. Several
software packages also exist for running computer-based simulation modelling that makes
the modelling almost effortless and simple.
In computer programming, a simulator is often used to execute a program that has to run on
some inconvenient type of computer, or in a tightly controlled testing environment For
example, simulators are usually used to debug a micro program or sometimes commercial
application programs. Since the operation of the computer is simulated, all of the information
about the computer's operation is directly available to the programmer, and the speed and
execution of the simulation can be varied at will.
Simulators may also be used to interpret fault trees, or test very large scale integration
(VLSI) logic designs before they are constructed. In theoretical computer science the term
simulation represents a relation between state transition systems.
b. Simulation in training
Simulation is often used in the training of civilian and military personnel. This usually occurs
when it is prohibitively expensive or simply too dangerous to allow trainees to use the real
equipment in the real world. In such situations they will spend time learning valuable lessons
in a "safe" virtual environment. Often the convenience is to permit mistakes during training
for a safety-critical system.
Training simulations typically come in one of three categories:
live simulation (where real people use simulated (or "dummy") equipment in the real
world);
virtual simulation (where real people use simulated equipment in a simulated world
(or "virtual environment")), or
constructive simulation (where simulated people use simulated equipment in a
simulated environment). Constructive simulation is often referred to as "wargaming"
since it bears some resemblance to table-top war games in which players command
armies of soldiers and equipment which move around a board.
c. Simulation in Education
Simulations in education are somewhat like training simulations. They focus on specific
tasks. In the past, video has been used for teachers and students to observe, problem solve
and role play; however, a more recent use of simulation in education include animated
narrative vignettes (ANV). ANVs are cartoon-like video narratives of hypothetical and
reality-based stories involving classroom teaching and learning. ANVs have been used to
assess knowledge, problem solving skills and dispositions of children, and pre-service and in-
service teachers.
Another form of simulation has been finding favour in business education in recent years.
Business simulations that incorporate a dynamic model enable experimentation with business
strategies in a risk free environment and provide a useful extension to case study discussions.
d. Medical Simulators
Medical simulators are increasingly being developed and deployed to teach therapeutic and
diagnostic procedures as well as medical concepts and decision making to personnel in the
health professions. Simulators have been developed for training procedures ranging from the
basics such as blood draw, to laparoscopic surgery and trauma care.
Many medical simulators involve a computer connected to a plastic simulation of the
relevant anatomy. Sophisticated simulators of this type employ a life size mannequin which
responds to injected drugs and can be programmed to create simulations of life- threatening
emergencies. In others simulations, visual components of the procedure are reproduced by
computer graphics techniques, while touch-based components are reproduced by haptic
feedback devices combined with physical simulation routines computed in response to the
user's actions. Medical simulations of this sort will often use 3D CT or MRI scans of patient
data to enhance realism.
Another important medical application of a simulator -- although, perhaps, denoting a
slightly different meaning of simulator -- is the use of a placebo drug, a formulation which
simulates the active drug in trials of drug efficacy.
g. Marine simulators
This bears resemblance to flight simulators. The marine simulators are used to train ship
personnel. Simulators like these are mostly used to simulate large or complex vessels, such as
cruise ships and dredging ships. They often consist of a replication of a ships' bridge, with
operating desk(s), and a number of screens on which the virtual surroundings are projected.
In classrooms of the future, the simulator will be more than a "living" textbook; it will
become an integral a part of the practice of Education and training. The simulator
environment will also provide a standard platform for curriculum development in educational
institutions.
A common approach is to split the measured data into two parts; training data and
verification data. The training data are used to train the model, that is, to estimate the model
parameters (see above). The verification data are used to evaluate model performance.
Assuming that the training data and verification data are not the same, we can assume that if
the model describes the verification data well, then the model describes the real system well.
However, this still leaves the extrapolation question open. How well does this model
describe events outside the measured data? Consider again Newtonian classical mechanics-
model. Newton made his measurements without advanced equipment, so he could not
measure properties of particles travelling at speeds close to the speed of light. Likewise, he
did not measure the movements of molecules and other small particles, but macro particles
only. It is then not surprising that his model does not extrapolate well into these domains,
even though his model is quite sufficient for ordinary life physics.
The reliability and the trust people put in computer simulations depends on the validity of the
simulation model, therefore verification and validation are of crucial importance in the
development of computer simulations. Another important aspect of computer simulations is
that of reproducibility of the results, meaning that a simulation model should not provide a
different answer for each execution. Although this might seem obvious, this is a special point
of attention in stochastic simulations, where random numbers should actually be semi-
random numbers. An exception to reproducibility are human in the loop simulations such as
flight simulations and computer games. Here a human is part of the simulation and thus
influences the outcome in a way that is hard if not impossible to reproduce exactly.
Case Studies
Operations study to add a new plane arrival at La Guardia southwest terminal
LaGuardia airport planned to add a new flight to the schedule of the southwest terminal. The
airport administration wanted to understand how the introduction of a new flight would
influence terminal capacity.
Problem
In order to understand the scale of the problem, the developers conducted a preliminary static
pedestrian flow analysis based on data of how long before the flight passengers arrived at the
airport. In the picture, the solid line represented the number of seats in the waiting area, the
red stacks represented the number of passengers in the terminal before introducing the new
flight, and additional passengers from the new flight were represented by purple areas. The
graph showed that if the new plane took off in the afternoon at 5:00 pm, the already crowded
waiting area would have to bear an additional burden that could lead to a significant problem.
The developers used the AnyLogic Pedestrian Library to create a crowd simulation model of
the terminal in order to examine the use of seats under different scenarios. The basic model
displayed the operation of all terminal areas before the introduction of the new flight, and
then various assumptions could be checked against this model. The best situation was when
people were waiting for departure at their gates, but the consultants wanted to check how far
they would have to move away from their gates to wait for their departure.
To set up the crowd simulation model, the developers used tables of passenger preference for
waiting areas.
The model showed how far from their gate people would have to wait. The results of
modeling the base scenario, without the new flight, showed that some of the peaks were
reduced compared with the static analysis. This was due to passengers lining up 30 minutes
before their flights. The model also showed where the people would actually wait. From this,
it could be verified that there was no overflow and that the situation was stable.
In the afternoon, the waiting area was a lot more heavily utilized. There were a lot of
passengers mixing in different areas and waiting for different gates. With the new flight at
this peak time, some of these areas would get extremely overloaded. This pedestrian
simulation was very useful in showing the operations of this terminal and how adding the
new flight would affect the passengers in this area, including how far they would have to
move to wait for their flights.
Solution
Designing large transport facilities requires careful consideration and agreement on every
detail. That means that such projects must go through a great deal of decision making. The
initial task of engineers usually produces alternatives and functional designs. These consider
physical requirements and standards, but whether business or operating objectives will be met
can be hard to determine accurately. It is here that AnyLogic based modeling helps by
enabling faster decision-making and significantly improving insight into the various tasks
that engineers face when planning large transport facilities.
5.0 Conclusion
Simulation is used to shed light on the underlying mechanisms that control the behaviour of a
system. It can be used to predict (forecast) the future behaviour of a system, and determine
what you can do to influence that future behaviour. We simulation when we require
information to solve bottlenecks, service time, flows, and queues of clients and provide
important information on how to improve your business.
We simulate when a system is not amenable to treatment using any of the physical model,
mathematical or analogue models. Other reasons to resort to simulation include when it is
very expensive to construct a real physical system and what more testing it with live human
beings and observing what happens could be fatal. Training a new pilot using an airplane is
suicidal. These are where and when simulations are designed and utilized.
6.0 Summary
In this unit we:
defined simulation as the process of creating a model (i.e., an abstract representation
or exact copy) of an existing or proposed system (e.g., a project, a business, a mine, a
forest, the organs in your body, etc.) in order to identify and understand those factors
which control the system and/or to predict (forecast) the future behaviour of the
system.
Stated that simulation is required when a system is not amenable to treatment using
any existing model or when it is very expensive to construct a real physical system or
when testing it with live human beings could be fatal.
classified simulation into:
o Stochastic or deterministic (and as a special case of deterministic, chaotic)
o Steady-state or dynamic
o Continuous or discrete (and as an important special case of discrete, discrete
event or DE models)
o Local or distributed
Stated that simulations are done by: Formulating the model, Design the Experiment
and Developing the Computer Programs.
Listed areas of applications of Simulation to include: Computer science, Medicine,
Education, City/Urban planning, Training etc.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Basic Modelling Concepts
3.2 Visual and Conceptual models
3.3 Features of Visual and Conceptual Model
3.4 Cognitive Affordances of Visual Models
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
Modelling is an essential and inseparable part of all scientific activity, and many scientific
disciplines have their own ideas about specific types of modelling. There is little general
theory about scientific modelling, offered by the philosophy of science, systems theory,
and new fields like knowledge visualization.
We create models for representation of the objects within a system together with the rules
that govern the interactions of the objects. The representation may be concrete as in the
case of the spaceship or flight simulators or abstract as in the case of the computer program
that examines the number of checkout stations in service queue.
For the scientist, a model is also a way in which the human thought processes can be
amplified. For instance, models that are rendered in software allow scientists to leverage
computational power to simulate, visualize, manipulate and gain intuition about the entity,
phenomenon or process being represented.
We can however define visual models by what they strive to do, and list some of the
important characteristics that distinguish 'visual models' from other kinds of graphic art.
Visual representation of data depends fundamentally on an appropriate visual scheme for
mapping numbers into graphic patterns (Berlin 1983). One reason for the widespread use
of graphical methods for quantitative data is the availability of a natural visual mapping:
magnitude can be represented by length, as in a bar chart, or by position along a scale, as in
dot charts and scatter plots. One reason for the relative paucity of graphical methods for
categorical data may be that a natural visual mapping for frequency data is not so apparent.
Conceptual model helps you interpret what is shown in a drawing or graph. A good
conceptual model for a graphical display will have deeper connections with underlying
statistical ideas as well.
For quantitative data, position along a scale can be related to mechanical models in which
fitting data by least squares or least absolute deviations correspond directly to balancing
forces or minimizing potential energy (Farebrother 1987).
The mechanical model for least squares regression, for example, likens each observation to
a unit mass connected vertically to a rod by springs of unit modulus. Sall (1991a) shows
how this mechanical model neatly describes the effects of sample size on power of a test,
the leverage of outlying observations in regression, principal components, and collinearity
among others.
Conceptual Modelling
• Is used for abstract (visual) representation of the problem domain
• It serves to enhance understanding of complex problem domains.
• It provides a basis for communication among project team members
3.3 Features of Visual and Conceptual Model
A visual model should:
Render conceptual knowledge as opposed to quantitative data (information
visualization) or physical things (technical illustration). We usually express
conceptual knowledge with words alone, and yet the meaning behind those words
is often inherently visual. Visual models seek to render directly the image-
schematic (meaning that lies behind our words).
Be good models - the images should accurately reflect the situation in the world
and embody the characteristics of a useful model.
Integrate the most salient aspects of the problem into a clear and coherent picture.
Fit the visual structure to the problem – and not force the problem into a
predefined visual structure.
Use a consistent visual grammar.
Should be visually and cognitively tractable. Visual models exist to support robust
qualitative thinking: they're software for 'human-simulation' (as opposed to
computer-simulation) of the issue at hand. To serve as effective 'simulation
software', visual models must be 'readable' and 'run able' by our visio-cognitive
'hardware' and should positively engage our prodigious visual intelligence.
Tap into the power of elegant design. In other words, they shouldn't be ugly
Conceptual Modelling
A good conceptual model should NOT reflect a solution bias.
Should model the problem domain, not the solution domain.
Initial conceptual model may be rough and general.
May be refined during incremental development.
3.4 Cognitive Affordances of Visual Models
Due to the limited capacity of our working memory, 7 ± 2 ‗chunks‘ of information, we
cannot hold in our minds concepts, arguments, or problems that consist of more than 5 to 9
objects or relationships. While this cognitive limitation severely restricts our ability to
think about complex things, we can do what we often do: extend our intellectual abilities
with external representations or 'models' of the problem.
The particular affordances diagrams – their ability to simultaneously show many objects
and relationships – make them an ideal tool for thinking about conceptually-complex
problems. Diagrams provide an external mnemonic aid that enables us to see complicated
relationships and easily move between various mind-sized groupings of things.
5.0 Conclusion
The essence of constructing a model is to identify a small subset of characteristics or
features that are sufficient to describe the behaviour of the system under investigation.
Since a model is an abstraction of a real system and not the system itself, there is therefore,
a fine line between having too few characteristics to accurately describe the behaviour of
the system and more than you need to accurately describe the system. The goal should be
to build the simplest model that effectively describes the relevant behaviour of the system.
6.0 Summary
We defined modelling as the process of generating abstract, conceptual, graphical
and/or mathematical models. Science offers a growing collection of methods, techniques and
theory about all kinds of specialized scientific modelling.
We Listed and briefly explained some basic modelling concepts
Differentiating between Visual and Conceptual models
we discussed the important factors in evaluating a model to include:
o Ability to explain past observations
o Ability to predict future observations
o Cost of use, especially in combination with other models
o Refutability, enabling estimation of the degree of confidence in the model
o Simplicity, or even aesthetic appeal
We discussed the features of a good visual model which include:
o Ability to render conceptual knowledge as opposed to quantitative data
(information visualization) or physical things (technical illustration),
o the images should accurately reflect the situation in the world,
o the model should Integrate the most salient aspects of the problem into a clear
and coherent picture,
o Fit the visual structure to the problem,
o It should Use a consistent visual grammar,
o Should be visually and cognitively tractable.
We also stated the Characteristics of Conceptual models
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Finite Element Model
3.2 Overview of Basic FEM
3.3 Discretization
3.4 Interpretation of FEM
3.5 Assembly Procedure
3.6 Boundary Conditions
3.7 Data-based models
3.8 The three perspectives of Data model
3.9 Database Model
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
The finite element method is one of the most powerful approaches for approximate
solutions to a wide range of problems in mathematical physics. The method has achieved
acceptance in nearly every branch of engineering and is the preferred approach in
structural mechanics and heat transfer. Its application has extended to soil mechanics, heat
transfer, fluid flow, magnetic field calculations, and other areas.
The finite element method (FEM) (its practical application often known as finite element
analysis (FEA)) is a numerical technique for finding approximate solutions of partial
differential equations (PDE) as well as of integral equations. The solution approach is
based either on eliminating the differential equation completely (steady state problems), or
rendering the PDE into an approximating system of ordinary differential equations, which
are then numerically integrated using standard techniques such as Euler's method, Runge-
Kutta, etc.
In solving partial differential equations, the primary challenge is to create an equation that
approximates the equation to be studied, but is numerically stable, meaning that errors in
the input and intermediate calculations do not accumulate and cause the resulting output to
be meaningless. There are many ways of doing this, all with advantages and disadvantages.
The steps may be broken down as follows:
1. Definition of the physical problem:- development of the model.
2. Formulation of the governing equations - Systems of PDE, ODE, algebraic equations,
define initial conditions and/or boundary conditions to get a well-posed problem,
3. Discretization of the equations.
4. Solution of the discrete system of equations.
5. Interpretation of the obtained results.
6. Errors analysis.
The Finite Element Method is a good choice for solving partial differential equations over
complicated domains (like cars and oil pipelines), when the domain changes (as during a
solid state reaction with a moving boundary), when the desired precision varies over the
entire domain, or when the solution lacks smoothness. For instance, in a frontal crash
simulation it is possible to increase prediction accuracy in "important" areas like the front
of the car and reduce it in its rear (thus reducing cost of the simulation); another example
would be the simulation of the weather pattern on Earth, where it is more important to have
accurate predictions over land than over the wide-open sea.
3.1.1 The Finite Element Analysis
Finite Element Analysis is a method to computationally model reality in a mathematical
form to better understand a highly complex problem. In the real world everything that
occurs is as a results of interactions between atoms (and sub-particles of those atoms),
billions and billions of them. If we were to simulate the world in a computer, we would
have to simulate this interaction based on the simple laws of physics. However, no
computer can process the near infinite number of atoms in objects, so instead we model
'finite' groups of them.
For example, we might model a gallon of water by dividing it up into 1000 parts and
measuring the interaction of these linked parts. If you divide into too few parts, your
simulation will be too inaccurate. If you divide into too many, your computer will sit there
for years calculating the result!
Sometimes you can hand calculate certain designs. But sometimes a design can be too
complex, making FEA great for non-symmetric problems with ultra-complicated
geometries.
Hrennikoff's work discretizes the domain by using a lattice analogy while Courant's
approach divides the domain into finite triangular subregions for solution of second order
elliptic partial differential equations (PDEs) that arise from the problem of torsion of a
cylinder. Courant's contribution was evolutionary, drawing on a large body of earlier
results for PDEs developed by Rayleigh, Ritz, and Galerkin.
Development of the finite element method began in earnest in the middle to late 1950s for
airframe and structural analysis and gathered momentum at the University of Stuttgart
through the work of John Argyris and at Berkeley through the work of Ray W. Clough in
the 1960s for use in civil engineering. By late 1950s, the key concepts of stiffness matrix
and element assembly existed essentially in the form used today. NASA issued a request
for proposals for the development of the finite element software NASTRAN in 1965. The
method was again provided with a rigorous mathematical foundation in 1973 with the
publication of Strang and Fix's An Analysis of The Finite Element Method has since been
generalized into a branch of applied mathematics for numerical modelling of physical
systems in a wide variety of engineering disciplines, e.g., electromagnetism, thanks to
Peter P. Silvester and fluid dynamics.
Figure1: Steps of the physical simulation process: idealization, discretization and solution.
3.2.1 Idealization
a. Models
The word ―model‖ has the traditional meaning of a scaled copy or representation of an
object. And that is precisely how most dictionaries define it. We use here the term in a
more modern sense, increasingly common since the advent of computers:
A model is a symbolic device built to simulate and predict aspects of behaviour of a
system.
Note the careful distinction made between ―behaviour‖ and ―aspects of behaviour.‖ To
predict everything, in all physical scales, you must deal with the actual system. A model
abstracts aspects of interest to the modeler. The term ―symbolic‖ means that a model
represents a system in terms of the symbols and language of another science. For example,
engineering systems may be (and are) modeled with the symbols of mathematics and/or
computer sciences.
b. Mathematical Models
Mathematical modelling, or idealization, is a process by which the engineer passes from
the actual physical system under study, to a mathematical model of the system, where the
term model is understood in the wider sense defined above.
Unfortunately many users of commercial programs are unaware of the ―implied consent‖
aspect of implicit modelling.
Figure 2: Implicit modelling: picking elements from an existing FEM code implicitly
accepts an idealization. Read the fine print.
The other extreme occur when you select a mathematical model of the physical problem
with your eyes wide open and then either shop around for finite element programs that
implements that model, or write the program yourself. This is explicit modelling. It
requires far more technical expertise, resources, experience and maturity than implicit
modelling. But for problems that fall out of the ordinary it may be the right thing to do.
In practice a combination of implicit and explicit modelling is quite common. The physical
problem to be solved is broken down into subproblems. Those subproblems that are
conventional and fit existing programs may be treated with implicit modelling. Those
subproblems that require special handling may yield only to explicit modelling treatment.
3.3 Discretization
3.3.1 Purpose
Mathematical modelling is a simplifying step. But models of physical systems are not
necessarily easy to solve. They usually involve coupled partial differential equations in
space and time subject to boundary and/or interface conditions. Such analytical models
have an infinite number of degrees of freedom.
At this point one faces the choice of trying for analytical or numerical solutions. Analytical
solutions, also called ―closed form solutions,‖ are more intellectually satisfying,
particularly if they apply to a wide class of problems. Unfortunately they tend to be
restricted to regular geometries and simple boundary conditions. Moreover a closed- form
solution, expressed for example as the inverse of an integral transform, often has to be
numerically evaluated to be useful.
Most problems faced by the engineer either do not yield to analytical treatment or doing so
would require a disproportionate amount of effort. The practical way out is numerical
simulation. Here is where finite element methods and the digital computer enter thescene.
Next in order of importance is the discretization error. Even if solution errors are ignored
and usually they can, the computed solution of the discrete model is in general only an
approximation in some sense to the exact solution of the mathematical model. A
quantitative measurement of this discrepancy is called the discretization error.
The characterization and study of this error is addressed by a branch of numerical
mathematics called approximation theory.
Intuitively one might suspect that the accuracy of the discrete model solution would
improve as the number of degrees of freedom is increased, and that the discretization error
goes to zero as that number goes to infinity. This loosely worded statement describes the
convergence requirement of discrete approximations. One of the key goals of
approximation theory is to make the statement as precise as it can be expected from a
branch of mathematics.
The basic concept in the physical interpretation of the FEM is the subdivision of the
mathematical model into disjoint (non-overlapping) components of simple geometry called
finite elements or elements for short. The response of each element is expressed in terms of
a finite number of degrees of freedom characterized as the value of an unknown function,
or functions, at a set of nodal points.
The disconnection-assembly concept occurs naturally when examining many artificial and
natural systems. For example, it is easy to visualize an engine, bridge, building, airplane, or
skeleton as fabricated from simpler components.
Unlike finite difference models, finite elements do not overlap in space. In the
mathematical interpretation of the FEM, this property goes by the name disjoint support.
In the Direct Stiffness Method, elements are isolated by disconnection and localization.
This procedure involves the separation of elements from their neighbors by disconnecting
the nodes, followed by the referral of the element to a convenient local coordinate system.
After these two steps we can consider generaic elements: a bar element, a beam element,
and so on. From the standpoint of computer implementation, it means that you can write
one subroutine or module that constructs all elements of one type, instead of writing one
for each element instance.
The following is a summary of the data associated with an individual finite element. This
data is used in finite element programs to carry out element level calculations.
Dimensionality. Elements can have one, two or three space dimensions. (There are also
special elements with zero dimensionality, such as lumped springs.)
Nodal points. Each element possesses a set of distinguishing points called nodal points or
nodes for short. Nodes serve two purposes: definition of element geometry, and home for
degrees of freedom. They are located at the corners or end points of elements (see Figure
3); in the so-called refined or higher-order elements nodes are also placed on sides or faces.
Geometry. The geometry of the element is defined by the placement of the nodal points.
Most elements used in practice have fairly simple geometries. In one-dimension, elements
are usually straight lines or curved segments. In two dimensions they are of triangular or
quadrilateral shape.
In three dimensions the three common shapes are tetrahedra, pentahedra (also called
wedges or prisms), and hexahedra (also called cuboids or ―bricks‖). See Figure 3.
Degrees of freedom. The degrees of freedom (DOF) specify the state of the element. They
also function as ―handles‖ through which adjacent elements are connected. DOFs are
defined as the values (and possibly derivatives) of a primary field variable at nodal points.
The actual selection depends on criteria studied at length in Part II. Here we simply note
that the key factor is the way in which the primary variable appears in the mathematical
model. For mechanical elements, the primary variable is the displacement field and the
DOF for many (but not all) elements are the displacement components at the nodes.
Nodal forces. There is always a set of nodal forces in a one-to-one correspondence with
degrees of freedom. In mechanical elements the correspondence is established through
energy arguments.
Constitutive properties. For a mechanical element these is the relation that specifies the
material properties. For example, in a linear elastic bar element it is sufficient to specify
the elastic modulus E and the thermal coefficient of expansion.
Fabrication properties. For a mechanical element these are fabrication properties which
have been integrated out from the element dimensionality. Examples are cross sectional
properties of MoM elements such as bars, beams and shafts, as well as the thickness of a
plate or shell element.
This data is used by the element generation subroutines to compute element stiffness
relations in the local system.
Figure 4. Examples of primitive structural elements
The computer implementation of this process is not necessarily as simple as the hand
calculations of the truss example suggest. The master stiffness relations in practical cases
may involve thousands (or even millions) of degrees of freedom. To conserve storage and
processing time the use of sparse matrix techniques as well as peripheral storage is
required. But this inevitably increases the programming complexity.
In the present Section we summarize some basic rules for treating boundary conditions.
3.6.1 Essential and Natural B.C.
The important thing to remember is that boundary conditions (BCs) come in two basic
flavors:
Essential BCs are those that directly affect the degrees of freedom, and are imposed on the
left-hand side vector u.
Natural BCs are those that do not directly affect the degrees of freedom, and are imposed
on the right-hand side vector f.
The mathematical justification for this distinction requires use of the variation calculus,
and is consequently relegated to Part II of the course. For the moment, the basic recipe is:
1. If a boundary condition involves one or more degrees of freedom in a direct way, it
is essential. An example is a prescribed node displacement.
2. Otherwise it is natural.
The term ―direct‖ is meant to exclude derivatives of the primary function, unless those
derivatives also appear as degrees of freedom, such as rotations in beams and plates.
A structural engineer must be familiar with displacement B.C. of the following types.
Ground or support constraints. Directly restraint the structure against rigid body motions.
FEM allows detailed visualization of where structures bend or twist, and indicates the
distribution of stresses and displacements. FEM software provides a wide range of
simulation options for controlling the complexity of both modelling and analysis of a
system. Similarly, the desired level of accuracy required and associated computational time
requirements can be managed simultaneously to address most engineering applications.
FEM allows entire designs to be constructed, refined, and optimized before the design is
manufactured.
This powerful design tool has significantly improved both the standard of engineering
designs and the methodology of the design process in many industrial applications. The
introduction of FEM has substantially decreased the time to take products from concept to
the production line. It is primarily through improved initial prototype designs using FEM
that testing and development have been accelerated. In summary, benefits of FEM include
increased accuracy, enhanced design and better insight into critical design parameters,
virtual prototyping, fewer hardware prototypes, a faster and less expensive design cycle,
increased productivity, and increased revenue.
Data modelling defines not just data elements, but their structures and relationships
between them. Data modelling techniques and methodologies are used to model data in a
standard, consistent, predictable manner in order to manage it as a resource. The use of
data modelling standards is strongly recommended for all projects requiring a standard
means of defining and analyzing data within an organization, e.g., using data modelling:
to manage data as a resource;
for the integration of information systems;
for designing databases/data warehouses (aka data repositories)
Data modelling may be performed during various types of projects and in multiple phases
of projects. Data models are progressive; there is no such thing as the final data model for a
business or application. Instead a data model should be considered a living document that
will change in response to a changing business. The data models should ideally be stored in
a repository so that they can be retrieved, expanded, and edited over time.
The main aim of data models is to support the development of data-base by providing the
definition and format of data. According to West and Fowler (1999) "if this is done
consistently across systems then compatibility of data can be achieved. If the same data
structures are used to store and access data then different applications can share data.
However, systems and interfaces often cost more than they should, to build, operate, and
maintain. They may also constrain the business rather than support it. A major cause is that
the quality of the data models implemented in systems and interfaces is poor. As a
consequence:
Business rules, specific to how things are done in a particular place, are often fixed
in the structure of a data model. This means that small changes in the way business
is conducted lead to large changes in computer systems and interfaces
Entity types are often not identified, or incorrectly identified. This can lead to
replication of data, data structure, and functionality, together with the attendant
costs of that duplication in development and maintenance
Data models for different systems are arbitrarily different. The result of this is that
complex interfaces are required between systems that share data. These interfaces
can account for between 25-70% of the cost of current systems
"Data cannot be shared electronically with customers and suppliers, because the
structure and meaning of data has not been standardised. For example, engineering
design data and drawings for process plant are still sometimes exchanged on paper
The reason for these problems is a lack of standards that will ensure that data models will
both meet business needs and be consistent.
A data model instance may be one of three kinds according to ANSI in 1975:
Conceptual schema - A conceptual schema specifies the kinds of facts or propositions that
can be expressed using the model. In that sense, it defines the allowed expressions in an
artificial 'language' with a scope that is limited by the scope of the model. It describes the
semantics of a domain. For example, it may be a model of the interest area of an
organization or industry. This consists of entity classes, representing kinds of things of
significance in the domain, and relationships assertions about associations between pairs of
entity classes The use of conceptual schema has evolved to become a powerful
communication tool with business users. Often called a subject area model (SAM) or high-
level data model (HDM), this model is used to communicate core data concepts, rules, and
definitions to a business user as part of an overall application development or enterprise
initiative. The number of objects should be very small and focused on key concepts. Try to
limit this model to one page, although for extremely large organizations or complex
projects, the model might span two or more pages
Physical schema - describes the physical means by which data are stored. This is
concerned with partitions, CPUs, tablespaces, and the like.
The significance of this approach, according to ANSI, is that it allows the three
perspectives to be relatively independent of each other.
Storage technology can change without affecting either the logical or the conceptual
model. The table/column structure can change without (necessarily) affecting the
conceptual model. In each case, of course, the structures must remain consistent with the
other model. The table/column structure may be different from a direct translation of the
entity classes and attributes, but it must ultimately carry out the objectives of the
conceptual entity class structure. Early phases of many software development projects
emphasize the design of a conceptual data model . Such a design can be detailed into a
logical data model . In later stages, this model may be translated into physical data
model. However, it is also possible to implement a conceptual model directly
Flat model: This may not strictly qualify as a data model. The flat (or table) model consists
of a single, two-dimensional array of data elements, where all members of a given column
are assumed to be similar values, and all members of a row are assumed to be related to
one another.
Hierarchical model: In this model data is organized into a tree-like structure, implying a
single upward link in each record to describe the nesting, and a sort field to keep the
records in a particular order in each same-level list.
Network model: This model organizes data using two fundamental constructs, called
records and sets. Records contain fields, and sets define one-to-many relationships between
records: one owner, many members.
Relational model: is a database model based on first-order predicate logic. Its core idea is
to describe a database as a collection of predicates over a finite set of predicate variables,
describing constraints on the possible values and combinations of values.
Object-relational model: Similar to a relational database model, but objects, classes and
inheritance are directly supported in database schemas and in the query language.
6.0 Summary
In this unit, we have discussed elaborately,
the Physics-based Finite Element Method (FEM) which is defined as a numerical
technique for finding approximate solutions of partial differential equations (PDE) as
well as of integral equations.
o Here we stated the uses, traced its origin and discussed its aplications
o Carried out the overview of the FEM basics including:
Idealization
Discretization; purpose and error sources
Finite and Boundary element methods
Interpretations of FEM and
Elementary attributes used in FEM
Stated the three perspectives of data models; Conceptual, logical and Physical
schemas.
The different types of database models; Flat, hierarchical, network, Relational and
Object oriented models.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Descriptive and Inference statistics
3.2 Descriptive Statistics
3.3 Inference Statistics
3.4 Other Essential Statistics for Simulations
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
In this unit we will discuss two ways statistics are computed and applied in modelling and
simulations these include: inference and descriptive processes. Statistical inference is
generally distinguished from descriptive statistics. In simple terms, descriptive statistics
can be thought of as being just a straightforward presentation of facts, in which modelling
decisions made by a data analyst have had minimal influence. Statistical inference is the
process of drawing conclusions from data that are subject to random variation, for
example, observational errors or sampling variation. A complete statistical analysis will
nearly always include both descriptive statistics and statistical inference, and will often
progress in a series of steps where the emphasis moves gradually from description to
inference.
Inferential statistics tries to make inferences about a population from the sample data. We
also use inferential statistics to make judgments of the probability that an observed difference
between groups is a dependable one, or that it might have happened by chance in this study.
Thus, we use inferential statistics to make inferences from our data to more general
conditions; we use descriptive statistics simply to describe what's going on in our data.
One that describes a large set of observations with a single indicator risks distorting the
original data or losing important detail. For example, the shooting percentage doesn't tell you
whether the shots are three-pointers or lay-ups, and GPA doesn't tell you whether the student
was in difficult or easy courses. Despite these limitations, descriptive statistics provide a
powerful summary that may enable comparisons across people or other units.
a. Distribution
The distribution is a summary of the frequency of individual or ranges of values for a
variable. The simplest distribution would list every value of a variable and the number of
cases that had that value. For instance, computing the distribution of gender in the study
population means computing the percentages that are male and female. The gender variable
has only two, making it possible and meaningful to list each one. However, this does not
work for a variable such as income that has many possible values. Typically, specific values
are not particularly meaningful (income of 50,000 is typically not meaningfully different
from 51,000). Grouping the raw scores using ranges of values reduces the number of
categories to something more meaningful. For instance, we might group incomes into ranges
of 0-10,000, 10,001-30,000, etc.
b. Central tendency
The central tendency of a distribution locates the "center" of a distribution of values. The
three major types of estimates of central tendency are the mean, the median, and the mode.
The mean is the most commonly used method of describing central tendency. To compute
the mean, take the sum of the values and divide by the count. For example, the mean quiz
score is determined by summing all the scores and dividing by the number of students taking
the exam. For example, consider the test score values:
The mean is computed using the formular: □ Xi / n, where the sum is over i = 1 to n.
The median is the score found at the middle of the set of values, i.e., that has as many cases
with a larger value as have a smaller value. One way to compute the median is to sort the
values in numerical order, and then locate the value in the middle of the list. For example, if
there are 500 values, the value in 250th position is the median. Sorting the 8 scores above
produces:
There are 7 scores and score #4 represents the halfway point. The median is 20. If there is an
even number of observations, then the median is the mean of the two middle scores. In the
example, if there were an 8th observation, with a value of 25, the median becomes the
average of the 4th and 5th scores, in this case 20.5:
The mode is the most frequently occurring value in the set. To determine the mode, compute
the distribution as above. The mode is the value with the greatest frequency. In the example,
the modal value 15, occurs three times. In some distributions there is a "tie" for the highest
frequency, i.e., there are multiple modal values. These are called multi- modal distributions.
Notice that the three measures typically produce different results. The term "average"
obscures the difference between them and is better avoided. The three values are equal if the
distribution is perfectly "normal" (i.e., bell-shaped).
c. Dispersion
Dispersion is the spread of values around the central tendency. There are two common
measures of dispersion, the range and the standard deviation. The range is simply the highest
value minus the lowest value. In our example distribution, the high value is 36 and the low is
15, so the range is 36 − 15 = 21.
The standard deviation is a more accurate and detailed estimate of dispersion because an
outlier can greatly exaggerate the range (as was true in this example where the single outlier
value of 36 stands apart from the rest of the values). The standard deviation shows the
relation that set of scores has to the mean of the sample. Again let's take the set of scores:
15, 20, 21, 36, 15, 25, 15
to compute the standard deviation, we first find the distance between each value and the
mean. We know from above that the mean is 21. So, the differences from the mean are:
15 − 21 = −6
20 − 21 = −1
21 − 21 = 0
36 − 21 = 15
15 − 21 = −6
25 − 21 = +4
15 − 21 = −6
Notice that values that are below the mean have negative differences and values above it
have positive ones. Next, we square each difference:
(6)2 = 36
(−1)2 = 1
(+0)2 = 0
(15)2 = 225
(−6)2 = 36
(+4)2 = 16
(−6)2 = 36
Now, we take these "squares" and sum them to get the sum of squares (SS) value. Here, the
sum is 350. Next, we divide this sum by the number of scores minus 1. Here, the result is 350
/ 6 = 58.3. This value is known as the variance. To get the standard deviation, we take the
square root of the variance (remember that we squared the deviations earlier). This would be
√58.3 = 7.63.
Although this computation may seem intricate, it's actually quite simple. In English, we can
describe the standard deviation as:
the square root of the sum of the squared deviations from the mean divided by the number of
scores minus one given as: √(□ (xi – u)2)/ n; where x = observed value and u = the mean
The standard deviation allows us to reach some conclusions about specific scores in our
distribution. Assuming that the distribution of scores is close to "normal", the following
conclusions can be reached:
a. approximately 68% of the scores in the sample fall within one standard deviation of
the mean (u - SD) and (u + SD)
b. approximately 95% of the scores in the sample fall within two standard deviations of
the mean (u-2SD) and (u+2SD)
c. approximately 99% of the scores in the sample fall within three standard deviations of
the mean (u - 3SD) and (u + 3SD)
For example, since the mean in our example is 21 and the standard deviation is 7.63, we can
from the above statement estimate that approximately 95% of the scores will fall in the range
of 21 − (2×7.63) to 21 + (2×7.63) or between 5.74 and 36.26. Values beyond two standard
deviations from the mean can be considered "outliers". 36 is the only such value in our
distribution.
Outliers help identify observations for further analysis or possible problems in the
observations. Standard deviations also convert measures on very different scales, such as
height and weight, into values that can be compared.
d. Other Statistics
In research involving comparisons between groups, emphasis is often placed on the
significance level for the hypothesis that the groups being compared differ to a degree
greater than would be expected by chance. This significance level is often represented as a p-
value, or sometimes as the standard score of a test statistic. In contrast, an effect size
conveys the estimated magnitude and direction of the difference between groups, without
regard to whether the difference is statistically significant. Reporting significance levels
without effect sizes is problematic, since for large sample sizes even small effects of little
practical importance can be statistically significant.
The outcome of statistical inference may be an answer to the question "what should be done
next?", where this might be a decision about making further experiments or surveys, or about
drawing a conclusion before implementing some organizational or governmental policy.
For the most part, statistical inference makes propositions about populations, using data
drawn from the population of interest via some form of random sampling. More generally,
data about a random process is obtained from its observed behaviour during a finite period
of time. Given a parameter or hypothesis about which one wishes to make inference,
statistical inference most often uses:
a statistical model of the random process that is supposed to generate the data, and
a particular realization of the random process; i.e., a set of data.
The conclusion of a statistical inference is a statistical proposition.
With finite samples, approximation results measure how close a limiting distribution
approaches the statistic's sample distribution: For example, with 10,000 independent samples
the normal distribution approximates (to two digits of accuracy) the distribution of the
sample mean for many population distributions. Yet for many practical purposes, the normal
approximation provides a good approximation to the sample-mean's distribution when there
are 10 (or more) independent samples, according to simulation studies, and statisticians'
experience. Following Kolmogorov's work in the 1950s, advanced statistics uses
approximation theory and functional analysis to quantify the error of approximation: In this
approach, the metric geometry of probability distributions is studied; this approach quantifies
approximation error.
With infinite samples, limiting results like the central limit theorem describe the sample
statistic's limiting distribution, if one exists. Limiting results are not statements about finite
samples, and indeed are logically irrelevant to finite samples. However, the asymptotic
theory of limiting distributions is often invoked for work in estimation and testing. For
example, limiting results are often invoked to justify the generalized method of moments and
the use of generalized estimating equations, which are popular in econometrics and
biostatistics. The magnitude of the difference between the limiting distribution and the true
distribution (formally, the 'error' of the approximation) can be assessed using simulation. The
use of limiting results in this way works well in many applications, especially with low-
dimensional models with log-concave likelihoods (such as with one-parameter exponential
families).
a. Frequentist inference
This paradigm regulates the production of propositions by considering (notional) repeated
sampling of datasets similar to the one at hand. By considering its characteristics under
repeated sample, the frequentist properties of any statistical inference procedure can be
described - although in practice this quantification may be challenging. Examples of
frequentist inference are: P-value and Confidence interval
The frequentist calibration of procedures can be done without regard to utility functions.
However, some elements of frequentist statistics, such as statistical decision theory, do
incorporate utility functions. Loss functions must be explicitly stated for statistical theorists
to prove that a statistical procedure has an optimality property. For example, median-
unbiased estimators are optimal under absolute value loss functions, and least squares
estimators are optimal under squared error loss functions.
While statisticians using frequentist inference must choose for themselves the parameters of
interest, and the estimators/test statistic to be used, the absence of obviously-explicit utilities
and prior distributions has helped frequentist procedures to become widely- viewed as
'objective'.
b. Bayesian inference
The Bayesian calculus describes degrees of belief using the 'language' of probability; beliefs
are positive, integrate to one, and obey probability axioms. Bayesian inference uses the
available posterior beliefs as the basis for making statistical propositions. There are several
different justifications for using the Bayesian approach. Examples of Bayesian inference are:
Credible intervals for interval estimation and Bayes factors for model comparison
Many informal Bayesian inferences are based on "intuitively reasonable" summaries of the
posterior. For example, the posterior mean, median and mode, highest posterior density
intervals, and Bayes Factors can all be motivated in this way. While a user's utility function
need not be stated for this sort of inference, these summaries do all depend (to some extent)
on stated earlier beliefs, and are generally viewed as subjective conclusions.
Error Estimation
Cochran‘s (1977) formula uses two key factors:
(1) the risk the researcher is willing to accept in the study, commonly called the
margin of error, or the error the researcher is willing to accept, and
(2) the alpha level, the level of acceptable risk the researcher is willing to accept that
the true margin Alpha Level.
The alpha level used in determining sample size in most educational research studies is either
.05 or .01 (Ary, Jacobs, & Razavieh, 1996). In Cochran‘s formula, the alpha level is
incorporated into the formula by utilizing the t-value for the alpha level selected (e.g., t-
value for alpha level of .05 is 1.96 for sample sizes above 120). Researchers should ensure
they use the correct t- value when their research involves smaller populations, e.g., t-value
for alpha of .05 and a population of 60 is 2.00.
In general, an alpha level of .05 is acceptable for most research. An alpha level of .10 or
lower may be used if the researcher is more interested in identifying marginal relationships,
differences or other statistical phenomena as a precursor to further studies.
An alpha level of .01 may be used in those cases where decisions based on the research are
critical and errors may cause substantial financial or personal harm, e.g., major programmatic
changes.
Variance Estimation
A critical component of sample size formulas is the estimation of variance in the primary
variables of interest in the study. The researcher does not have direct control over variance
and must incorporate variance estimates into research design. Cochran (1977) listed four
ways of estimating population variances for sample size determinations:
(1) take the sample in two steps, and use the results of the first step to determine how
many additional responses are needed to attain an appropriate sample size based
on the variance observed in the first step data;
(2) use pilot study results;
(3) use data from previous studies of the same or a similar population; or
(4) estimate or guess the structure of the population assisted by some logical
mathematical results.
The first three ways are logical and produce valid estimates of variance; therefore, they do
not need to be discussed further. However, in many educational and social research studies, it
is not feasible to use any of the first three ways and the researcher must estimate variance
using the fourth method.
A researcher typically needs to estimate the variance of scaled and categorical variables. To
estimate the variance of a scaled variable, one must determine the inclusive range of the
scale, and then divide by the number of standard deviations that would include all possible
values in the range, and then square this number. For example, if a researcher used a seven-
point scale and given that six standard deviations (three to each side of the mean) would
capture 98% of all responses, the calculations would be as follows:
7 (number of points on the scale)
S=
6 (number of standard deviations)
When estimating the variance of a dichotomous (proportional) variable such as gender,
Krejcie and Morgan (1970) recommended that researchers should use .50 as an estimate of
the population proportion. This proportion will result in the maximization of variance, which
will also produce the maximum sample size. This proportion can be used to estimate variance
in the population. For example, squaring .50 will result in a population variance estimate of
.25 for a dichotomous variable.
Where t = value for selected alpha level of .025 in each tail = 1.96 (the alpha level of .05
indicates the level of risk the researcher is willing to take that true margin of error may
exceed the acceptable margin of error.)
s = estimate of standard deviation in the population = 1.167 (estimate of variance deviation
for 7 point scale calculated by using 7 [inclusive range of scale] divided by 6 [number of
standard deviations that include almost all (approximately 98%) of the possible values in the
range]).
d = acceptable margin of error for mean being estimated = .21 (number of points on primary
scale * acceptable margin of error; points on primary scale = 7; acceptable margin of error =
.03 [error researcher is willing to except]).
Therefore, for a population of 1,679, the required sample size is 118. However, since this
sample size exceeds 5% of the population (1,679*.05=84), Cochran‘s (1977) correction
formula should be used to calculate the final sample size. These calculations are as follows:
no (118)
n= = = 111
(1 + no / Population) (1 + 118/1679)
b. Categorical Data
The sample size formulas and procedures used for categorical data are very similar, but some
variations do exist. Assume a researcher has set the alpha level a priori at .05, plans to use a
proportional variable, has set the level of acceptable error at 5%, and has estimated the
standard deviation of the scale as .5. Cochran‘s sample size formula for categorical data and
an example of its use is presented here along with explanations as to how these decisions
were made.
(t)2 * (p)(q)
no= ----------------
(d)2
(1.96)2(.5)(.5)
no= ---------------- = 384
(.05)2
Where t = value for selected alpha level of .025 in each tail = 1.96 (the alpha level of .05
indicates the level of risk the researcher is willing to take that true margin of error may
exceed the acceptable margin of error).
Where (p)(q) = estimate of variance = .25 (maximum possible proportion (.5) * 1- maximum
possible proportion (.5) produces maximum possible sample size).
Where d = acceptable margin of error for proportion being estimated = .05 (error researcher
is willing to except).
Therefore, for a population of 1,679, the required sample size is 384. However, since this
sample size exceeds 5% of the population (1,679*.05=84), Cochran‘s (1977) correction
formula should be used to calculate the final sample size. These calculations are as follows:
n0
n1=
(1 + no / Population)
(384)
n1= = 313
(1 + 384/1679)
Where population size = 1,679,
n0 = required return sample size according to Cochran‘s formula= 384,
n1 = required return sample size because sample > 5% of population
These procedures result in a minimum returned sample size of 313. Using the same
oversampling procedures as cited in the continuous data example, and again assuming a
response rate of 65%, a minimum drawn sample size of 482 should be used. These
calculations were based on the following:
One of the simplest versions of the theorem says that if is a random sample of size n (say, n
larger than 30) from an infinite population, finite standard deviation, then the standardized
sample mean converges to a standard normal distribution or, equivalently, the sample mean
approaches a normal distribution with mean equal to the population mean and standard
deviation equal to standard deviation of the population divided by the square root of sample
size n. In applications of the central limit theorem to practical problems in statistical
inference, however, statisticians are more interested in how closely the approximate
distribution of the sample mean follows a normal distribution for finite sample sizes, than the
limiting distribution itself. Sufficiently close agreement with a normal distribution allows
statisticians to use normal theory for making inferences about population parameters (such as
the mean ) using the sample mean, irrespective of the actual form of the parent population.
It is well known that whatever the parent population is, the standardized variable will have a
distribution with a mean 0 and standard deviation 1 under random sampling. Moreover, if the
parent population is normal, then it is distributed exactly as a standard normal variable for
any positive integer n. The central limit theorem states the remarkable result that, even when
the parent population is non-normal, the standardized variable is approximately normal if the
sample size is large enough (say > 30). It is generally not possible to state conditions
under which the approximation given by the central limit theorem works and what sample
sizes are needed before the approximation becomes good enough. As a general guideline,
statisticians have used the prescription that if the parent distribution is symmetric and
relatively short-tailed, then the sample mean reaches approximate normality for smaller
samples than if the parent population is skewed or long-tailed.
Under certain conditions, in large samples, the sampling distribution of the sample mean can
be approximated by a normal distribution. The sample size needed for the approximation to
be adequate depends strongly on the shape of the parent distribution. Symmetry (or lack
thereof) is particularly important. For a symmetric parent distribution, even if very different
from the shape of a normal distribution, an adequate approximation can be obtained with
small samples (e.g., 10 or 12 for the uniform distribution). For symmetric short-tailed parent
distributions, the sample mean reaches approximate normality for smaller samples than if the
parent population is skewed and long-tailed. In some extreme cases (e.g. binomial) samples
sizes far exceeding the typical guidelines (e.g., 30) are needed for an adequate approximation.
For some distributions without first and second moments (e.g., Cauchy), the central limit
theorem does not hold.
Realize that fitting the "best'' line by eye is difficult, especially when there is a lot of
residual variability in the data.
Know that there is a simple connection between the numerical coefficients in the
regression equation and the slope and intercept of regression line.
Know that a single summary statistic like a correlation coefficient does not tell the
whole story. A scatter plot is an essential complement to examining the relationship
between the two variables.
Poisson processes are often used, for example in quality control, reliability, insurance
claim, incoming number of telephone calls, and queuing theory.
An Application: One of the most useful applications of the Poisson Process is in the field
of queuing theory. In many situations where queues occur it has been shown that the
number of people joining the queue in a given time period follows the Poisson model. For
example, if the rate of arrivals to an emergency room is □ per unit of time period (say 1
hr), then:
P ( n arrivals) = □n e- / n!
and variance
of a random variable having equal numerical values, then it is not necessary that its
distribution is a Poisson.
Applications:
P (0 arrival) = e-□
P (1 arrival) = □ e- / 1!P (2 arrival) = □2
e- / 2!
and so on. In general:
3.4.7 Uniform Density Function (UDF)
This function gives the probability that observation will occur within a particular interval
when probability of occurrence within that interval is directly proportional to interval
length.
For example, it is used to generate random numbers in sampling and Monte Carlo
simulation.
C. Correlation tests:
Do the random numbers exhibit discernible correlation? Compute the sample Autcorrelation
Function.
5.0 Conclusion
Statistics is the basis of simulation. In this unit we have simply introduced some basic
statistics in modelling and simulations. We hope that the reader will broaden his/her
understanding by consulting the referenced texts or othe statistics books.
6.0 Summary
In this unit we were able to
Differentiate between the two broad components of statistics: descriptive and
inference statistics
Have concise discussions of descriptive statistics on; Univarite statistics
measures: the distribution, central tendency, dispersion, etc. and gave some
examples.
Discuss Inference statistics under the following subheads: definition,
Model/assumptions, approximate distributions, random-based models and
modes of inference.
Introduce some essential statistical measures in simulation such as;
o sample size determination
o central limit theorem
o least square model
o Analysis of variance
o Exponential distribution function
o Poisson distribution
o Uniform distribution
o Test for randomness
o Some commands of Special package for statistical analysis (SPSS)
Module Introduction
This module is divided into four (4) units
Unit 1: Simple Theories of Queues
Unit 2: Basic Probability Theories in Queuing
Unit 3: Queuing Models
Unit 4: Queuing Experiments
1.0 Introduction
In this section we will look at a very useful type of simulations called queuing system. We
deal with queuing systems all the time in our daily lives. For examples, when you stand in
line to cash a cheque at the bank, you are dealing with a queuing system. When you submit
a ―batch job‖ (such as a compilation) on a mainframe computer, your job must wait in line
until the CPU finishes the jobs scheduled ahead of it. When you make a phone call to
reserve an airline ticket and get a recording that says, Thank you for calling. Your call will
be answered by the next available operator. ―Please wait‖… you are dealing with a
queuing system.
Please Wait Waiting is the critical element of queues.
2.0 Intended Learning Outcomes (ILOs)
By the end of this unit, you should be able to:
Define queuing theory
Describe queuing systems; parameters, question and examples of queuing systems
Describe how Probability theories applied in queuing systems
Describe some essential Queuing theories
Describe queuing systems using Kendall Lee notations and Little‘s formula
Explain the Queue discipline
The use of queuing allows the systems to queue their customers' requests until free
resources become available. This means that if traffic intensity levels exceed available
12
capacity, customer's calls are not lost; customers instead wait until they can be served. This
method is used in queuing customers for the next available operator.
The output from the simulation is the average wait time. We calculate this value using the
following formula:
Average wait time = total wait time for all customers / number of customers
Given this output, the bank can see whether their customers have an unreasonable wait in
a one-teller system. If so, the bank can repeat the simulation with two tellers.
How do we know whether or not a job has arrived in this particular clock unit?
The answer is a function of two factors: the number of minutes between arrivals (five in
this case) and chance. Chance? Queuing models are based on chance? Well, not exactly.
Let‘s express the number of minutes between arrivals another way- as the probability that a
job arrives in any given clock unit. Probabilities range from 0.0 (no chance) to 1.0 (a sure
thing). If on the average a new job arrives every five minutes, then the chance of a
customer arriving in any given minute is 0.2 (1 chance in 5). Therefore, the probability of a
new customer arriving in a particular minute is 1.0 divided by the number of minutes
12
between arrivals.
It is important at this point to note that simulation doesn‘t give us the answer or even an
answer. Simulation is a technique for trying out ―what if‖ questions. We build the model
and run the simulation many times, trying various combinations of the parameters and
observing the average wait time. What happens if the cars arrive more quickly? What
happens if the service time is reduced by 10%? What happens if we add a second teller?
12
size of the population for this system
Queuing theory is a mathematical discipline that studies systems intended for servicing a
random flow of requests (the moments at which the requests appear as well as the time for
servicing them is usually random).
Queuing theory is the study of the behaviour of queues (waiting lines) and their elements.
Queuing theory is a tool for studying several performance parameters of computer systems
and is particularly useful in locating the reasons for ―bottlenecks,‖ compromised computer
performance caused by too much data waiting to be acted on at a particular phase.
Examples include the distribution of cars on highways (including traffic jams), data
through computer networks and phone calls through voice networks. In these examples,
Queue size and waiting time can be looked at, or items within queues can be studied and
manipulated according to factors such as priority, size, or time of arrival.
13
– LIFO (last in first out = stack)
– SIRO (service in random order)
– SPT (shortest processing time first)
– PR (priority)
While the particular discipline chosen will likely greatly affect waiting times for particular
customers (nobody wants to arrive early at an LCFS discipline), the discipline generally
doesn‘t affect important outcomes of the queue itself, since arrivals are constantly
receiving service regardless.
Queuing is handled by control processes within exchanges, which can be modelled using
state equations. Queuing systems use a particular form of state equations known as a
Markov chain that models the system in each state. Incoming traffic to these systems is
modelled via a Poisson distribution and is subject to Erlang‘s queuing theory assumptions
viz.
Pure-chance traffic – Call arrivals and departures are random and independent
events.
Statistical equilibrium – Probabilities within the system do not change.
Full availability – All incoming traffic can be routed to any other customer
withinthe network.
Congestion is cleared as soon as servers are free.
Classic queuing theory involves complex calculations to determine waiting time, service
time, server utilization and other metrics that are used to measure queuing performance.
A Poisson process models random events (such as a customer arrival, a request for action
from a web server, or the completion of the actions requested of a web server) as
emanating from a memory less process. That is, the length of the time interval from the
current time to the occurrence of the next event does not depend upon the time of
occurrence of the last event. In the Poisson probability distribution, the observer records
the number of events that occur in a time interval of fixed length. In the (negative)
exponential probability distribution, the observer records the length of the time interval
13
between consecutive events. In both, the underlying physical process is memory less.
Models based on the Poisson process often respond to inputs from the environment in a
manner that mimics the response of the system being modelled to those same inputs. The
analytically tractable models that result yield both information about the system being
modeled and the form of their solution. Even a queuing model based on the Poisson
process that does a relatively poor job of mimicking detailed system performance can be
useful. The fact that such models often give "worst-case" scenario evaluations appeals to
system designers who prefer to include a safety factor in their designs. Also, the form of
the solution of models based on the Poisson process often provides insight into the form of
the solution to a queuing problem whose detailed behaviour is poorly mimicked. As a
result, queuing models are frequently modeled as Poisson processes through the use of the
exponential distribution.
For example; the mathematical models often assume infinite numbers of customers,
infinite queue capacity, or no bounds on inter-arrival or service times, when it is quite
apparent that these bounds must exist in reality. Often, although the bounds do exist, they
can be safely ignored because the differences between the real-world and theory is not
statistically significant, as the probability that such boundary situations might occur is
remote compared to the expected normal situation. Furthermore, several studies show the
robustness of queuing models outside their assumptions. In other cases the theoretical
solution may either prove intractable or insufficiently informative to be useful.
Alternative means of analysis have thus been devised in order to provide some insight into
problems that do not fall under the scope of queuing theory, although they are often
scenario-specific because they generally consist of computer simulations or analysis of
experimental data.
The A/B/C notation designates a queuing system having A as interarrival time distribution,
B as service time distribution and C as number of servers.
For example, "G/D/1" would indicate a General (may be anything) arrival process, a
Deterministic (constant time) service process and a single server. More details on this
13
notation are given later below in the queuing models.
Since describing all of the characteristics of a queue inevitably becomes very wordy, a
much simpler notation (known as Kendall-Lee notation) can be used to describe a system.
Kendall-Lee notation gives us six abbreviations for characteristics listed in order separated
by slashes. The first and second characteristics describe the arrival and service processes
based on their respective probability distributions.
For the first and second characteristics,
M represents an exponential distribution, E
represents an Erlang distribution, and G
represents a general distribution.
The third characteristic gives the number of servers working together at the same time,
also known as the number of parallel servers.
The fourth describes the queue discipline by its given acronym.
The fifth gives the maximum number of number of customers allowed in the system.
The sixth gives the size of the pool of customers that the system can draw from.
For example, M/M/5/FCFS/20/inf could represent a bank with 5 tellers, exponential arrival
times, exponential service times, an FCFS queue discipline, a total capacity of 20
customers, and an infinite population pool to draw from.
Kendall‘s notation:
A/B/c/N/K where:
A the interarrival distribution B
the service time distribution
C the number of parallel servers N
the system capacity
K the size of the target group.
Abbreviations for distribution
functions: M - Exponential
D - Constant or deterministic E
or Ek - Erlang
G - General Kendall‘s
notation Example:
M/M/1/∞/∞ is a single-server system with unlimited queuing capacity and an infinite
target group. The arrival intervals and the service times are distributed exponentially If N
and K are infinite, they can be left out of the notation. M/M/1/∞/∞ is abbreviated to M/M/1
13
Likewise, we can define W as the average time a customer spends in the queuing system.
Wq is the average amount of time spent in the queue itself and Ws is the average amount
of time spent in service. As was the similar case before, W = Wq + Ws. It should be noted
that all of the averages in the above definitions are the steady-state averages.
Defining λ as the arrival rate into the system, that is, the number of customers arriving the
system per unit of time, it can be shown that:
L = λW
Lq = λWq
Ls = λWs
This is known as Little‘s queuing formula.
In the mathematical theory of queues, Little's result, theorem, lemma, law or formula
says:
The long-term average number of customers in a stable system L is equal to the long-term
average arrival rate, λ, multiplied by the long-term average time a customer spends in the
system, W; or expressed algebraically: L = λW.
Although it looks intuitively reasonable, it's a quite remarkable result, as it implies that this
behaviour is entirely independent of any of the detailed probability distributions involved,
and hence requires no assumptions about the schedule according to which customers arrive
or are serviced.
It is also a comparatively recent result; the first proof was published in 1961 by John Little,
then at Case Western Reserve University. Handily his result applies to any system, and
particularly, it applies to systems within systems. So in a bank, the customer line might be
one subsystem, and each of the tellers another subsystem, and Little's result could be
applied to each one, as well as the whole thing. The only requirements are that the system
is stable and non-preemptive; this rules out transition states such as initial startup or
shutdown.
In some cases, it is possible to mathematically relate not only the average number in the
system to the average wait but relate the entire probability distribution (and moments) of
the number in the system to the wait.
For example - Imagine a small shop with a single counter and an area for browsing, where
only one person can be at the counter at a time, and no one leaves without buying
something. So the system is roughly:
Entrance → Browsing → Counter → Exit
This is a stable system, so the rate at which people enter the store is the rate at which they
arrive at the counter and the rate at which they exit as well. We call this the arrival rate. By
contrast, an arrival rate exceeding an exit rate would represent an unstable system, and
cause the store to overflow eventually.
13
Little's Law tells us that the average number of customers in the store, L, is the arrival rate,
λ, times the average time that a customer spends in the store, W, or simply:
Assume customers arrive at the rate of 10 per hour and stay an average of 0.5 hour. This
means we should find the average number of customers in the store at any time to be 5.
Now suppose the store is considering doing more advertising to raise the arrival rate to 20
per hour. The store must either be prepared to host an average of 10 occupants or must
reduce the time each customer spends in the store to 0.25 hour. The store might achieve the
latter by ringing up the bill faster or by walking up to customers who seem to be taking
their time browsing and saying, "Can I help you?".
We can apply Little's Law to systems within the shop, for example the counter and its
queue. Assume we notice that there are on average 2 customers in the queue and at the
counter. We know the arrival rate is 10 per hour, so customers must be spending 0.2 hour
on average checking out.
We can even apply Little's Law to the counter itself. The average number of people at the
counter would be in the range (0, 1), since no more than one person can be at the counter at
a time. In that case, the average number of people at the counter is also known as the
counter's utilization.
Certain notations also are required to describe steady-state result. When a queuing system
has recently begun operation, the state of the system will be greatly affected by the initial
state and by the time that has since elapsed. The system is said to be in a transient
13
condition. However, after sufficient time has elapsed, the state become independent of the
state and the elapsed time (expected under unusual circumstances). The system has now
reached steady state condition, where the probability distribution of the state of the
system remains the same (steady-state or stationary distribution) over time. Queuing theory
has tended to focus largely on the stead-state conditions, partially because the transient
case is more difficult analytically.
W = waiting time in the system (including service time) for each individual customer. W =
E(W)
Wq = waiting time in the queue (including service time) for each individual customer. Wq =
E(Wq)
Relationships between L, W, Lq and Wq
Assume that λn is a constant λ for all n. it has been proved that in a steady-state queuing
process,
5.0 Conclusion
Queuing systems are prevalent throughout society. The goals of queuing systems usually
require a compromise between cost and customer satisfaction. The adequacy of these
systems can have an important effect on the quality of life and productivity. In this section
we looked at ways of utilizing queuing to optimize service delivery in order keep the
waiting time, cost and customer satisfaction within reasonable limits.
13
6.0 Summary
In this section we:
Define a queuing system as a discrete-event model that uses random numbers to
represent the arrival and duration of events and Queuing theory as a mathematical
discipline that studies systems intended for servicing a random flow of requests know
how to construct queue systems; parameters, question and examples of queuing
systems.
We in the overview section look at:
The Parameters, for Construction of queuing system,
The questions and necessary questions in queuing construction
The network queues, the role of Poisson and exponential distributions
The limitations of queuing theory
Described queuing systems using Kendall Lee notations and Little‘s formula
13
Unit 2: Basics Probability Theories in Queuing Systems
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Exponential And Poisson Probability Distributions
3.2 The Input Process
3.3 The Output Process
3.4 Output variables
3.5 Birth-Death Processes
3.6 Steady-state Probabilities
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
To begin understanding queues, we must first have some knowledge of probability theory. In
particular, we will review the exponential and Poisson probability distributions.
This distribution lends itself well to modelling customer interarrival times or service times
for a number of reasons. The first is the fact that the exponential function is a strictly
decreasing function of t. This means that after an arrival has occurred, the amount of waiting
time until the next arrival is more likely to be small than large.
13
An important property of the exponential distribution is what is known as the no-memory
property. The no-memory property suggests that the time until the next arrival will never
depend on how much time has already passed. This makes intuitive sense for a model where
we‘re measuring customer arrivals because the customers‘ actions are clearly independent of
one another.
It‘s also useful to note the exponential distribution‘s relation to the Poisson distribution.
Poisson distribution is a "discrete probability distribution. It expresses the probability of a
number of events occurring in a fixed time if these events occur with a known average rate,
and are independent of the time since the last event". Such events are said to be memoryless.
Most queuing systems' characteristics such as arrival and departure processes are described
by a Poisson distribution. Assuming that arrivals and departures are random and independent
i.e. they exhibit pure-chance property; arrivals are described by a Poisson random variable or
Poisson random distribution as shown by equation below.
The probability that there are exactly k occurrences (k being a non-negative integer, k = 0, 1,
2, ...) is the Poisson distribution with parameter λ is given by:
……………..(1)
Where: e is the base of the natural logarithm (e = 2.71828...), k! is the factorial of k, and λ is
a positive real number, equal to the expected number of occurrences that occur during the
given interval. A number of textbooks e.g. Schaum‘s Outline statistics 3rd edition provides
the e- λ for various values of λ or by using logarithms.
For instance, if the events occur on average every 4 minutes, and you are interested in the
number of events occurring in a 10 minute interval, you would use as model a Poisson
distribution with λ = 2.5.
Variance = ζ2
Example 1
If the average rate of telephone calls received at an exchange of 8 lines is 6 per minute. Find
the probability that a caller is unable to make a connection if this is defined to occur when all
lines are engaged within a minute of the time of the call.
Solution
We first need to make an assumption that the overall rate of calls is constant, then we can use
equation (1) as follows: Since our time unit is 1 minute, then λ = 6
13
Which leads after substitution to:
The probability of not being able to make a call occurs only when there are at least 9 calls in
any interval of a minute.
With these distributions in mind, we can begin defining the input and output processes of a
basic queuing system, from which we can start developing the model further.
It is easy to show that if A has an exponential distribution, then for all nonnegative values of
t and h,
This is an important result because it reflects the no-memory property of the exponential
distribution, which is an important property to take note of if we‘re modelling interarrival
times.
Another distribution the can be used to model interarrival times (if the exponential
distribution does not seem to be appropriate) is the Erlang distribution. An Erlang
distribution is a continuous random variable whose density function relies on a rate
parameter R and a shape parameter k. The Erlang probability density function is:
14
3.3 The Output Process
Much like the input process, we start analysis of the output process by assuming that service
times of different customers are independent random variables represented by the random
variable S with probability density s(t) = µe−µt . We also define µ as the service rate, with
units of customers per hour. Ideally, the output process can also be modeled as an
exponential random variable, as it makes calculation much simpler.
Imagine an example where four customers are at a bank with three tellers with exponentially
distributed service times. Three of them receive service immediately, while the fourth has to
wait for one position to clear.
What is the probability that the fourth customer will be the final one to complete service?
Due to the no-memory property of the exponential distribution, when the fourth customer
finally steps up to a teller, all three remaining customers have an equal chance of finishing
their service last, as the service time in this situation is not governed by how long they have
already been served. Thus, the answer to the question is 1/3.
Unfortunately, the exponential distribution does not always represent service times
accurately. For a service that requires many different phases of service (for example,
scanning groceries, paying for groceries, and bagging the groceries), an Erlang distribution
can be used with the parameter k equal to the number of different phases of service.
Utilisation rate ρ (server utilization, percentage of the time that a server isbusy,
where c=the number of parallel servers)
Probability of n customers in the system Pn
Average number of customers in the system L (service and queue)
Average number of customers in the queue Lq
Average time spent by a customer in the system w(service and queue)
Average time spent by a customer in the queue wq
14
known as the steady-state of state j.
Thus, births and deaths are synonymous with arrivals and service completions respectively.
A birth increases the state by one while a death decreases the state by one. We note that µ0 =
0, since it must not be possible to enter a negative state. Also, in order to officially be
considered a birth-death process, birth and deaths must be independent of each other.
The probability that a birth will occur between t and t + ∆t is λj∆t, and such a birth will
increase the state from j to j + 1. The probability that a death will occur between t and t
+∆t is µj∆t, and such a birth will decrease the state from j to j − 1.
Note that:
To reach state j from state j − 1, we need one birth to occur between t and ∆t. To reach j from
j + 1, we need one death.
To remain at j, we need no births or deaths to occur.
To reach j from any other state we will need multiple births or deaths.
Since we will be eventually letting t approach zero, we find that it is impossible to reach state
j from these other states because births and deaths are independent of each other, and won‘t
occur simultaneously. Hence, we only need to sum the probabilities of these first three
situations occurring.
14
Since we‘re trying to calculate steady-state probabilities, it is appropriate to allow t to
approach infinity, at which point Pij(t) can be thought of as a constant.
These results are known as the flow balance equations. You may notice that they suggest that
the rate at which transitions occur into a particular state equal the rate at which transitions
occur out of the same state. At this point, each steady-state probability can be determined by
substituting in probabilities from lower states.
Starting with:
Where
5.0 Conclusion
This unit reviewed an important function; Poisson distribution and gives an example of its
application.
6.0 Summary
In this unit we discussed Probability theories applied in queuing systems:
Looked at Poisson and Exponential distributions in queuing system
14
Defined the Input, Output parameters of queues
Discuss the Birth-Death process; births and deaths are synonymous with arrivals and
service completions respectively. A birth increases the state byone while a death
decreases the state by one.
Defined the formula for calculating Steady- State probability
14
Unit 3: Queuing Models
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Queuing Model
3.2 Single-Server Queue
3.3 The Multiple and Infinite Server Systems
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
With the foundation laid for the study of important characteristics of queuing systems, we
will in this unit begin to analyze particular systems themselves.
A general procedure for constructing and analysing such queuing models is:
1. Identify the parameters of the system, such as the arrival rate, service time, queue
capacity, and perhaps draw a diagram of the system.
2. Identify the system states. (A state will generally represent the integer number of
customers, people, jobs, calls, messages, etc. in the system and may or may not be
limited.)
3. Draw a state transition diagram that represents the possible system states and identify
the rates to enter and leave each state. This diagram is a representation of a Markov
chain.
4. Because the state transition diagram represents the steady state situation between state
there is a balanced flow between states so the probabilities of being in adjacent states
can be related mathematically in terms of the arrival and service rates and state
probabilities.
5. Express all the state probabilities in terms of the empty state probability, using the
inter-state transition relationships.
6. Determine the empty state probability by using the fact that all state probabilities
always sum to 1.
Whereas specific problems that have small finite state models can often be analysed
numerically, analysis of more general models, using calculus, yields useful formulae that can
be applied to whole classes of problems.
3.1.2 Parameters
Simulation uses these characteristics to predict the average wait time. The number of servers,
the distribution of arrival times, and the duration of service can be changed. The average wait
times are then examined to determine what a reasonable compromise would be.
Example
Consider the case of a drive-in bank with one teller. How long does the average car have to
wait? If business gets better and cars start to arrive more frequently, what would be the effect
on the average wait time? When would the bank need to open a second drive-in window?
This problem has the characteristics of a queuing model. The entities are a server (the teller),
the objects being served (customers in cars), and a queue to hold the objects waiting to be
served (customers in cars). The average wait time is what we are interested in observing. The
events in this system are the arrivals and the departures of customers.
We first categorize queues into single and multiple servers and their service delineations.
Single-server queues are, perhaps, the most commonly encountered queuing situation in real
life. One encounters a queue with a single server in many situations, including business (e.g.
sales clerk), industry (e.g. a production line) and transport (e.g. queues that the customer can
select from.). Consequently, being able to model and analyse a single server queue's
behaviour is a particularly useful thing to do.
M/M/1/ꝏ/ꝏ represents a single server that has unlimited queue capacity and infinite
calling population, both arrivals and service are Poisson (or random) processes, meaning the
statistical distribution of both the inter-arrival times and the service times follow the
exponential distribution. Because of the mathematical nature of the exponential distribution,
a number of quite simple relationships are able to be derived for several performance
measures based on knowing the arrival rate and service rate.
A number of special cases of M/G/1 provide specific solutions that give broad insights into
the best model to choose for specific queuing situations because they permit the comparison
of those solutions to the performance of an M/M/1 model.
3.2.3 The M/M/1/GD/∞/∞ Queuing System
An M/M/1/GD/∞/∞ system has exponential interarrival times, exponential service times, and
one server. This system can be modelled as a birth-death process where
λj = λ for (j = 0, 1, 2...)
µ0 = 0
µj = µ for (j = 1, 2, 3...)
Substituting this in to the equation for the steady-state probability, we get
We will define p = λ/µ as the traffic intensity of the system, which is a ratio of the arrival and
service rates. Knowing that the sum of all of the steady state probabilities is equal to one, we
get:
With the steady-state probability for this system calculated, we can now solve for L. If L is
the average number of customers present in this system, we can represent it by the formula:
To solve for Ls, we have to determine how many customers are in service at any given
moment. In this particular system, there will always be one customer in service except for
when there are no customers in the system. Thus, this can be calculated as
Using Little‘s queuing formula, we can also solve for W, Ws, and Wq by dividing each of the
corresponding L values by λ.
An M/M/1/GD/c/∞ queuing system has exponential interarrival and service times, with rates
λ and µ respectively.
This system is very similar to the previous system, except that whenever c customers are
present in the system, all additional arrivals are excluded from entering, and are thereafter no
longer considered. For example, if a customer were to walk up to a fast food restaurant and
see that the lines were too long for him to wait there, he would go to another restaurant
instead.
A system like this can be modelled as a birth-death process with these parameters:
λj = λ for j = 0, 1, ..., c − 1
λc = 0
µ0 = 0
µj = µ for j = 1, 2, ..., c
The restriction λc = 0 is what sets this apart from the previous system. It makes it so that no
state greater than c can ever be reached. Because of this restriction, a steady state will always
exist. This is because even if λ>=µ, there will never be more than c customers in the system.
Looking at formulas derived from the study of birth-death processes and once again letting p
=λ/µ, we can derive the following steady-state probabilities:
A formula for L can be found in a similar fashion, but is omitted because of the messy
calculations. The technique is similar to the one used in the previous section.
Calculating W is another issue. This is because in Little‘s queuing formula, λ represents the
arrival rate, but in this system, not all of the customers who arrive will join the queue. In fact,
λΠc arrivals will arrive, but leave the system. Thus, only λ− λΠc = λ(1 − Πc) arrivals will
ever enter the system. Substituting this into Little‘s queuing formula gives us:
3.3 The Multiple and Infinite Server Systems
Multiple-servers queue - Multiple (identical)-servers queue situations are frequently
encountered in telecommunications or a customer service environment. When modelling
these situations care is needed to ensure that it is a multiple servers queue, not a network of
single server queues, because results may differ depending on how the queuing model
behaves.
One observational insight provided by comparing queuing models is that a single queue with
multiple servers performs better than each server having their own queue and that a single
large pool of servers performs better than two or more smaller pools, even though there are
the same total number of servers in the system.
Example 1
Consider a system having 8 input lines, single queue and 8 servers. The output line has a
capacity of 64 kbit/s. Considering the arrival rate at each input as 2-packets/s. So, the total
arrival rate is 16-packets/s. With an average of 2000 bits per packet, the service rate is 64
kbit/s/2000b = 32 packets/s. Hence, the average response time of the system is 1/(µ − λ) =
1/(32 − 16) = 0.0625 sec.
Example 2
Consider a second system with 8 queues, one for each server. Each of the 8 output lines has a
capacity of 8 kbit/s. The calculation yields the response time as 1/(µ − λ) = 1/(4 − 2)
= 0.5 sec. And the average waiting time in the queue in the first case is ρ/(1 − ρ)µ = 0.03125,
while in the second case is 0.25.
5.0 Conclusion
The goals of queuing systems and queuing models, usually require a compromise between
cost and customer satisfaction. In this section we looked at ways of utilizing queuing to
optimize service delivery in order keep the waiting time, cost and customer satisfaction
within reasonable limits.
The applications of queuing theory extend well beyond waiting in line. It may take some
creative thinking, but if there is any sort of scenario where time passes before a particular
event occurs, there is probably some way to develop it into a queuing model. Queues are so
commonplace in society that it is highly worthwhile to study them, even if only to shave a
few seconds off one‘s wait in the checkout line
6.0 Summary
We looked at:
The procedure for construction of queue models
some Basic Queuing models for:
Single-server with Poisson arrivals and service and general service
Multiple and Infinite Server Systems
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Car Wash Experiment
3.2 Salesman Calls
3.3 Salesman BASIC Program
3.4 Goods Production
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
This unit simply is about applications of queues in different daily activities and how the
application enable us establish/use observed queuing systems relationships to make informed
decisions to reduce costs.
Suppose the car wash services cars one at a time and each service takes 10 minutes. When a
car arrives, it goes into the car wash if it is idle, otherwise, it must wait in the queue. As long
as cars are waiting, the car wash is in continuous operation serving on the first come first
served principle. If the arrival times of cars have been recorded for one day, then a very
simple model is capable of reproducing the essential aspects of the system on that day,. This
model can generate data which describe the performance of the installation, such as use of
equipments, average no of waiting cars, time spent by each car etc.
Time Events
0 the car wash awaits the first arrival
6 Car 1 arrives and goes into the car wash
10 Car 2 arrives and must wait
13 Car 3 arrives and must wait
16 Car 1 leaves the system.
Car 2 enters the car wash.
26 Car 2 leaves the system.
Car 3 enters the car wash.
28 Car 4 arrives and must wait.
36 Car 3 leaves
Car 4 enters the car wash.
42 Car 5 arrives and must wait.
43 Car 6 arrives and must wait
46 Car 4 leaves the system
Car 5 enters the car wash
48 Car 7 arrives and must wait.
56 Car 5 leaves the system
Car 6 enters
66 Car 6 leaves the system
Car 7 enters the car wash
76 Car 7 leaves the system.
The data recorded from the trace for the cars are:
Car Number1 2 3 4 5 6 7
Arrival time6 10 13 28 42 43 48
Departed at 16 26 36 46 56 66 76
Elapse time 10 16 23 18 14 23 28
Let us demonstrate the trace using two car washes and run this model with two car washes
operating upon the same data. The extra (unfair) decision rule is that car wash one is used if
both car washes are idle.
The data recorded for the 7 cars for the two car washes are:
Car Number 1 2 3 4 5 6 7
Arrival time 6 10 13 28 42 43 48
Departed at 16 20 26 38 52 53 62
Elapse time 10 10 13 10 10 10 14
Serviced by 1 2 1 1 1 2 1
Average time spent = 77/7 = 11mins Car wash 2 was idle for 22mins
Car 3 waited for 3mins while car waited for 4mins.
Thus the average waiting time prior to service is reduced from nearly 9mins to 1min by
increasing the number of washes from 1 to 2.
Clearly no management would base its decisions on such a small sample. To arrive to proper
estimates it is necessary to simulate the behaviour of the system over several days.
Solution
The solution has two parts. The first part specifies the rules and the second applies them. The
rules must link the random numbers so that success has probability of 0.5 and failure has
probability of 0.5. A simple categorization of the digits (0,1,2,3,4,5,6,7,8,9) is to have two
subsets{0,1,2,3,4} and {5,6,7,8,9} where each contains five elements. We associate success
with first group and failure with the second group. Note that this categorization is far from
unique. Any division of the ten digits into two groups of five would be good. So one might as
well have used [0,2,4,6,8] and [1,3,5,7,9] for success and failure respectively.
It is usually very useful to draw a flowchart of the simulation process as shown below:
Fig. 1: Flowchart showing the activities of the salesman
It is convenient to summarise the data in what is referred to as lookup table:
The application of the rule for two 10-day periods are shown below.
First 10-day period
Day 10
Ran No.
R
esult of call
Day 1 2 3 4 5 6 7 8 9 10
Ran No. 3 6 6 7 1 0 0 8 2 3
Result of call s f f f s s s F s s
Having carried out a simulation, it is necessary to calculate appropriate statistics to
summarize the situation being studied.
Solution
REM X is set to a random value between 0 and 1
REM For X between 0 and 0.5 the salesman has a successful call REM For X between 0 and
0.5 the salesman has a unsuccessful call REM A successful call is shown as ―s‖
REM An unsuccessful call is shown as ―f‖ Rem n is used to count the days
FOR N% = 1 TO N
X=RND
IF X<0.5 THEN A$=‖S+ IF X>0.5 THEN A$=‖F‖ PRINT A$
NEXT N% END
A typical outcome of running this program is: sssfffffsss
The program may be run repeatedly, sometimes over large number of N. in this case, the total
number of S‘s and F‘s should be approximately equal.
Salesman Example 4
A salesman arranged to make a call each day for the next 10 working days. Previous
experience showed that each arranged call had a 10% chance of cancellation. When a call
was made the expected chances of success in making sales are as shown below.
Result %
No sale 50
1 unit sold 10
2 unit sold 30
3 units sold 10
At the start of the 10-day period he assumed that 5 units were in stock and that a further 5
would be available for dispatch from day 6. it was the policy of the firm to dispatch orders on
the same day they were placed. However, if no stock were available, orders would be held
until the next delivery of stock.
Use a tabular simulation to cover the 10-days. Show whether each call was made and its
result. Show also the level of stock held at the end of each day. Use the following random
numbers: 5,4,5,6,2,9,3,0,3,9,3, 9, 4, 8, 4, 9, 8, 4.
Solution
Note that tabular simulation is a table constructed to produce a record of what has been
simulated to occur and to facilitate any analysis or monitoring of processes required. The first
column would record an incremental number of events, other columns would record random
numbers and the corresponding results, while others would monitor the implications of earlier
columns. There is no fixed rule for doing this. Flexibility is therefore very necessary.
The allocation of random numbers in these two tables is based on the fact that each random
number digit is assumed to have a 10% chance of occurring. Therefore chances of 10%, 30%,
50% and 90% require one, three, five and one digits respectively.
MACHINE A MACHINE B
Daily output Chance Daily output Chance
0 20 0 10
7 20 6 30
8 30 7 40
9 30 8 20
In addition, quality control tests give each day‘s output a probability 0.95 chance of being
accepted and a probability 0.5 of rejection. Complete a tabular simulation to cover a period of
10 days, monitoring daily and cumulative output.
Solution
The three look-up tables needed are: one for each of the two machines and one for quality
check.
The Quality control check
Decision Chance % Random No.
Accept 95 00, 01, …, 94
Reject 5 95,96,97,98,99
MACHINE A MACHINE B
Daily Chance% Random Daily Chance% Random
Output No output No
0 20 0,1 0 10 0
7 20 2.,3 6 30 1,2,3
8 30 4,5,6 7 40 4,5,6,7
9 30 7,8,9 8 20 8,9
As the chances in the first two tables are all multiples of 10%, only one digit from the set
{0,1,2,3,4,5,6,7,8,9} is needed for each 10% chance.
But in the quality table, we need probabilities of 0.95 and 0.05. In this case we must use the
random digits in pairs and select from the set [00,01,02,…,99]. The set contains 100 pairs and
we can assume that each pair has 1% percent chance of being selected. To simulate a
probability of 0.95 we use 95 of the pairs and for 0.05 we use 5.
To carry out the simulation, random number blocks are used. A block is selected randomly
and then the digits are used sequentially. No cheating is allowed. Random numbers should be
used systematically. In the order in they appear.
The random number blocks used are shown below:
4179048580575 227920519669339
268511869080 4441951263
Considering the first block of random numbers, the first random number is 4, this is looked
up in the table for machine A, the second in table 1 is for machine B, and then the next two
random numbers 7,9 are looked up in table for quality check. For each subsequent day, four
random digits are taken from the block of random numbers in that order.
We conclude that the cumulative output for 10 days was 118 units and that no output was
rejected. Further simulation can be carried out and the result compared with the above to give
clearer indication of reliability of the result.
3. Carry out the simulation requested in example 3 using a six sided die to generate the
sets of random numbers required. Use the subset {1, 2, 3) to mean success and the
subset {4,5,6} to mean failure for the 10-day period. Use the subsets [1,3,5] for
success and [2,4,6] for failure for the next 10-day period.
5.0 Conclusion
In this unit we have manually simulated the application of queuing systems in different areas
of daily activities. This reader is expected to extend his/her knowledge by trying some other
areas of daily endeavours, and completing the exercises.
6.0 Summary
Module Introduction
This module is divided into two (2) units
Unit 1: Examples of Simulation Languages
Unit 2: The SIMNET II Language
1.0 Introduction
Most conventional programming languages are not suitable for writing simulation programs.
The programmer is usually confronted with a number of detailed decisions. He needs flexible
tools for generating dynamic models, model formulation, programming verification,
validation and experimental design and analysis. The basic purpose of most simulation
studies is to compare alternatives. Therefore, the simulation program must be flexible enough
to readily accommodate the alternatives that will be considered. Most of the instructions in a
simulation program are logical operations whereas the relatively little actual arithmetic work
required is usually of a very simple type. This should be reflected in the choice of computer
programming language to be used.
The above considerations partly motivated the development of simulation languages in the
early 1960‘s. These languages were designed especially to expedite the type of programming
unique to simulation. Their specific purposes include the following:
1. To provide a convenient means of describing the elements that commonly appear in
simulation models.
2. To expedite changing the design configuration of the system being simulated so that a
large number of configurations can be considered easily.
3. To provide some form of internal timing and control mechanism with related
commands to assist in the kind of book-keeping that is required when executing a
simulation run.
4. To provide simple operational procedures, such as introducing changes into
simulation models, initializing the state of the model, altering the kind of output data
to be generated and stacking a series of simulation runs.
In simulation, computer models (literally) imitate the behaviour of the real situation as a
function of time. As the simulation advances with time, pertinent statistics are gathered about
the simulated system, in very much the same way it is carried out in real life.
But we pay attention to the system especially when changes in statistics take place. Such
changes are associated with the occurrence of events, for example in a bank operation, arrival
and departures from a facility, points in time at which the length of the queue and/or the
idle/busy status may change.
o Simula - Simula is a name for two programming languages, Simula I and Simula 67,
developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole- Johan
Dahl and Kristen Nygaard. Syntactically, it is a fairly faithful superset of ALGOL 60.
Simula 67 introduced objects, classes, subclasses,[1]:2.2.1 virtual methods, coroutines,
discrete event simulation, and features garbage collection. Simula is considered the
first object-oriented programming language. As its name implies, Simula was
designed for doing simulations, and the needs of that domain provided the framework
for many of the features of object-oriented languages today. Simula has been used in a
wide range of applications such as simulating very large scale integration (VLSI)
designs, process modelling, protocols, algorithms, and other applications such as
typesetting, computer graphics, and education. Since Simula-type objects are
reimplemented in C++, Java and C# the influence of Simula is often understated. The
creator of C++, Bjarne Stroustrup, has acknowledged that Simula 67 was the greatest
influence on him to develop C++, to bring the kind of productivity enhancements
offered by Simula to the raw computational speed offered by lower level languages
like BCPL. Simula is still used for various types of university courses, for instance,
Jarek Sklenar teaches Simula to students at University of Malta.
Continuous simulation languages, the model essentially as a set of differential equations.
o Advanced Continuous Simulation Language (ACSL), (pronounced "axle"), is a
computer language designed for modelling and evaluating the performance of
continuous systems described by time-dependent, nonlinear differential equations. It
is a dialect of the Continuous System Simulation Language (CSSL), originally
designed by the Simulations Council Inc (SCI) in 1967 in an attempt to unify the
continuous simulations field. ACSL is an equation-oriented language consisting of a
set of arithmetic operators, standard functions, a set of special ACSL statements, and
a MACRO capability which allows extension of the special ACSL statements.
An important feature of ACSL is its sorting of the continuous model equations, in contrast to
general purpose programming languages such as Fortran where program execution depends
critically on statement order Applications of ACSL in new areas are being developed
constantly.
Typical areas in which ACSL is currently applied include control system design, aerospace
simulation, chemical process dynamics, power plant dynamics, plant and animal growth,
toxicology models, vehicle handling, microprocessor controllers, and robotics.
o Dynamo - DYNAMO was used for the system dynamics simulations of global
resource-depletion reported in the Club of Rome's Limits to Growth. Originally
designed for batch processing on mainframe computers, it was made available on
minicomputers in the late 1970s, and became available as "micro-Dynamo" on
personal computers in the early 1980s. The language went through several revisions
from DYNAMO II up to DYNAMO IV in 1983, but has since fallen into disuse.
o VisSim, is a visual block diagram language for simulation of dynamical systems and
model based design of embedded systems. It is developed by Visual Solutions of
Westford, Massachusetts is widely used in control system design and digital signal
processing for multidomain simulation and design. It includes blocks for arithmetic,
Boolean, and transcendental functions, as well as digital filters, transfer functions,
numerical integration and interactive plotting. The most commonly modeled systems
are aeronautical, biological/medical, digital power, electric motor, electrical,
hydraulic, mechanical, process, thermal/HVAC and econometric.
We can also on this basis classify simulation languages according to the type of simulation:
Next-event scheduling: SIMSCRIPT, GASP,
Process Operation: SIMULA, GPSS, SIMNET II, SIMAM, SLAM
5.0 Conclusion
For very serious work requiring simulation, you need a simulation software package. Most of
them are not open source, this implies that you be ready to part with some money.
6.0 Summary
In this unit we looked at:
The purpose of simulation languages
Some types and examples of simulation languages, and categorised them according to:
discrete, continuous, and hybrid
The development strategies; the next event scheduling and process operation based
simulations
1.0 Introduction
SIMNET is a network-based discrete simulation language that differs from available process
languages in that it utilizes exactly four nodes: a source for creating transactions, a queue
where waiting may take place, a facility where service is performed, and an auxiliary that is
introduced to enhance the modelling flexibility of the language. Each node is provided with
sufficient information that defines the exact manner in which a transaction enters, resides in,
and leaves the node.
17
3.0 Main Content
3.1 Design of SIMNET II Language
The design of the language provides automatic collection of global statistical summary based
on either the subinterval or the replication method. It is also possible to execute independent
runs with different initial data in a single simulation session. Execution in SIMNET can be
carried out interactively or in batch mode. Although SIMNET does not make use of external
(FORTRAN) subroutines, the language is capable of modelling complex situations rather
conveniently.
Special routing of transactions among the four nodes is effected using seven types of
branches and the so-called special assignments. SIMNET II offers flexible computational
capabilities at a level equal to FORTRAN with access to all internal simulation data and files.
The computational and modelling power of the language eliminates the need for the use of
external FORTRAN or C inserts. The companion system ISES combines input, no-
programming animation, debugging, and execution in a user-friendly interactive
environment. An important feature of the system is that ISES generates the animation model
without any special programming effort on the part of the user
The language is based on network approach that utilizes three main nodes and one auxiliary
node which include:
1. Source node - from which transactions (customers) arrive;
2. Queue node - where waiting takes place if necessary;
3. Facility node - where service is performed;
4. Auxiliary node - which is added to enhance the modelling capabilities of SIMNET II.
Nodes in SIMNET II are connected by branches. As the transactions traverse the branches,
they (nodes) perform important functions such as:
1. Controlling transaction flow anywhere in the network;
2. Collecting pertinent statistics
3. Performing arithmetic calculations
During the simulation execution, SIMNET II keeps track of the transactions by placing them
in files. A file can be thought of as a two dimensional array with each row being used to store
information about a unique transaction. The columns of the array represent the attributes that
allow the modeler to keep track of the characteristics of each transaction. This means that
attributes are local variables that move with their respective transactions wherever they go in
the model network.
SIMNET II uses three types if files – Event Calendar, Queue and Facility.
The event calendar (or E. FILE) is the principal file that drives the simulation. It keeps track
of an updated list of the model‘s events in their proper chronological order. The functions of
the queue and facility files are different from that of E. FILE. These files once defined by the
model are automatically maintained by SIMNET II.
The node identifier consists of user-defined names (12 characters maximum) followed by
one of the codes *S, *Q, *F, or *A, which identify the name as either a source, a queue, a
facility or an auxiliary. The node identifier is then followed by a number of fields separated
by semicolons with the last terminating with a colon. Each field carries information that is
needed for the operation of the node. The order of the fields must be followed for the
processor to recognize their information content. If a field is not used, or defaulted, the
position is indicated with a semicolon.
For example, the statement ARRIVE:
Identifies a source node named ARRIVE. The value 10 for the first field is the time between
successive arrivals. Fields 2, 3 and 4 assume default values (see later) while field
5 indicates that the maximum number of creations from ARRIVE is limited to 500
transactions.
The source node is used to create the arrival of transactions into the network. The definitions
of its fields and its graphic symbol are given in table below.
The general format is SNAME *S; F1; F2; F3; MULT=F4; LIM=F5; F6; F7; *T:
We use examples below to look at the operation of the fields: F1 to F5 and *T. Example 1
Individual customers upon arrival at a car registration facility are assigned serial numbers that
identify the order in which they will receive service. The inter-arrival time is exponential
with mean 12 minutes. The first customer arrives about 10 minutes after the facility opens.
CUSTOMERS *S;EX(12);10;-1:
• EX(12) in field 1 indicates the time between successive arrivals as a random sample
based on exponential distribution with mean 12 (see table of random functions).
Symbol EX(meaning exponential distribution) is reserved and is recognised by
SIMNET II processor.
• 10 in field2 designates the arrival time of first customer as 10 starting from 0 (zero
datum). Note that any mathematical expression may be used on the two field.
• -1 in field3 indicates that attribute 1 will automatically carry the serial numbers
1,2,3,… for the successive arrivals.
Since the third ends with a colon, all the remaining fields are defaulted. Note the following.
(a) Any mathematical expression may be used in the first two fields.
(b) In SIMNET II, attributes are designated by the reserved array A(.), so that – 1 in
field3 signifies that A(1) = 1,2,3,… for successive arrivals.
Example 2:
TV units arrive every 5 minutes for packaging. It is desired to keep track of the arrival time
of each transaction in attribute 2
The following statements are equivalent.
TVS *S;5;; 2;* PACKAGING:
TVS *S;5;; 2; goto- PACKAGING: 5
2
Explanation
The creation time for the first TV unit is 0 because field F2 is defaulted. Because F3 = 2
(2>0), mark attribute A(2) for successive customers will assume the respective values
0,5,10,15,….
The transactions leaving source TVS will be transferred to a queue (buffer) node named
PACKAGING as shown by the *T field.
Note: - *T always occupies the last field of the node, regardless the number of
defaults fields that may proceed it.
- goto in the second statement has replaced the * in the first statement.
Example 3:
A mill is contracted to receive 100 truckloads of logs. Each truckload includes 50 logs. The
mill processes the logs at a time. The arrival of trucks at the mill are spaced 45 minutes apart.
The required SIMNET II statement is:
The LIM field indicates that the source TRUCKS will generate 100 successive transactions
after which it will go dormant. As each transaction leaves TRUCKS, it will be replaced by 50
identical transactions representing the logs as shown in the MULT field (that is F4).
The general format is QNAME *Q; F1(SUBF1), F2(SUBF2); F3; F4;F5; *T:
F1 F2 F3
F4
Graphic Symbol is: (SUB F1) (SUB F2)
Rule Description
Solution
A direct way to represent this situation is to associate the job type with an attribute. Let A(1)
= 0 and A(1) = 1 identify the regular and rush jobs, respectively. These jobs are then ordered
in a queue named JOBQ as follows:
JOBQ *Q;;;HI(1):
The queue discipline HI(1) requires that all transactions be ordered in descending order of the
value of A(1). This means that rush jobs with A(1) = 1 will be placed at the head of the
queue. Notice that field 1 is defaulted, signifying that queue JOBQ has an infinite capacity.
If the values assigned to A(1) are interchanged so that A(1)=0 represents the rush job, the
queue discipline must be changed to LO(1) as follows:
JOBQ *Q;;;LO(1):
Example 2.
Units of a product are packaged four to a carton. The buffer area can hold a maximum of 75
units. Initially, the buffer is holding 30 units.
75(30)
Solution
Let QUNIT represent the buffer, the associated statement is given as:
The first field sets the maximum queue capacity (=75) and the initial number in the system
(=30). The queue discipline is FIFO because field 3 is defaulted. Field 2 indicates that four
product units will be converted to a single carton. By default, the attributes of the carton
transaction will equal those of the LAST of the four unit transactions forming the carton.
Facility Node
A facility node is where service is performed. In SIMNET II, a facility has a finite capacity
representing the number of parallel servers. During the simulation, each server may be busy
or idle. The description of its fields is given below.
The general format is: FNAME *F;F1;F2;F3(SUBF3); F4; F5; *T:
Explanation
Field 1 is not needed in this situation because it normally deals with multiple queue input to
the facility, which will be discussed later. In field 2 the value 15 provides the service time in
the facility. Field 3 shows that the facility has one server that is initially busy. The *T field
shows that the completed transaction will be Terminated by using *TERM (or goto-
TERM). The symbol TERM is a reserved word of SIMNET II. It is not a node but simply a
code that will cause the transaction to vanish from the system.
Example 2.
A facility has three parallel servers, two of which are initially busy. The service is
exponential with mean 3 [EX(3)].
Example 3.
A small shop has one machine and 10 waiting jobs, in addition to the job that is currently
being processed. The processing time is exponential with mean 30 minutes.
The network representing this situation is shown below, where the symbol following the
facility represents TERM.
Graphic Representation
Explanation
In the network above, since FJOB is initially busy, as indicated by the entry (1) in
field 3, the facility will automatically process its resident job using a sample from EX(30) as
its processing time. After the job leaves FJOB to be TERMinated, the facility will
automatically look back and draw a new job from QJOB. This process is repeated until all 10
jobs are processed.
Auxiliary Node
An auxiliary is an infinite capacity node that will always accept all incoming transactions.
The node is designed to enhance the modelling capability of the language. It is mostly suited
for representing delays. Also auxiliary is the only node that can enter itself, a characteristic
that is particularly useful in simulating repetitive actions (or loops). The table below gives a
description of the fields of auxiliary node.
The network segment and statements describing the arrival, completing the form and waiting
are given below.
ARIV *S;EX(25):
FORM *A;15;
WAIT *Q:
Explanation
The model assumes that the forms are immediately accessible to the arriving
applicants. This is the reason for representing the process of filling out the form by the
infinite capacity auxiliary FORM. If the forms were to be completed with the assistance of a
clerk, the auxiliary FORM would have to be replaced with a single-server facility preceded
by a queue.
Names of user-defined variables may be of any length, although only the first 12 characters
are recognizable by the SIMNET II processor. The name may include intervening blanks but
must exclude the following special symbols:
:,;( ) { } + - * / = < > $ & % ? !
These symbols are used to represent specific operations in SIMNET II. The following are
typical example of SIMNET II‘s non-subscripted and array variables:
nbr_ of_ machines TIME BET ARVL
Sample(1*(J+K)**2)
SCORE (Sample(I+J), MAX(K, nbr_of_machines)
The algebraic and trigonometric functions accepted by SIMNET II are listed in table 3. The
arguments of these functions may be any legitimate mathematical expressions. All given
functions have the same properties as in FORTRAN.
SIMNET II simulation variables provide access to all simulation parameters and statistics
during execution. Simulations statistics are provided in the form of current, highest, lowest
and average values. For example, LEN(QQ), HLEN(QQ), LLEN(QQ) and ALEN(QQ)
define the current, highest, lowest and average LENgth of a queue named QQ. Table 4
describes the SIMNET II simulation variables that can be accessed during execution. These
variables may be used directly within any mathematical expression.
Table 5 describes the random functions available in SIMNET II. All arguments can be
represented by a SIMNET II mathematical expression. The default value of the random
number stream, RS, is 1.
The last element of a mathematical expression includes SIMNET II special variables. These
variables includes table look ups TL(argl, arg2) and mathematical functions FUN(arg1) and
FFUN(arg1, arg2). See table 6.
VAL/HVAL/LVAL/AVAL Current/highest/lowest/average
(variable name) VALue of a Statiscal variable (see later)
AQWP (queue name) Average wait in queue for those who must wait
AFBL (facility name) Average blockage in a facility
AFTB (Facility name) Average blockage time in a facility AFIT
(facility name) Average time facility is idle
AFBT (Facility name) Average time facility is busy ARTU (resource
name) Average resource units in transit ARTT
(resource name) Average time a resource is in transit
ARBT (resource name) Average time a resource is busy (in use) ARIT
(resource name) Average time a resource is idle
AFRQ (variable name, cell #) Absolute histogram frequency of cell # of a
variable RFRQ (variable name, cell #) Relative histogram frequency of cell # of a
variable
NTERM (node name) Number of transactions terminated from a
node
NDEST (node name) Number of transactions destroyed from a node.
Table: 5 SIMNET II Random Functions
Function Definition
NE(arg1, arg2, RS) NEgative binomial with parameters c = arg1 and p = arg2
NO(arg1, arg2,RS) NOrmal sample with mean = argl and standard deviation =
arg2
Variable Definition
TL(arg1,arg2) Value of a dependent variable obtained from Table Look-up
number arg1 given the value of the independent variable is arg2. If
arg1 < 0, TL is automatically determined by linear interpolation.
$PROJECT and $DIMENSION are mandatory statements that always occupy the first and
second statements of the model. The $PROJECT provides general information about the model.
The $DIMENSION statement allocates memory dynamically to the model‘s files (queue,
facilities and the E.FILE) and user-defined arrays. The dimension m of ENTITY is an estimate
of the maximum number of transactions that can be in the system at any time. The only
restriction on the use of $DIMENSION is that attributes be defined by the reserved array name
A(.). For example, the statement:
$DIMENSION; ENTITY(50), A(5), sample(50,3):
indicates that the maximum number of transactions during execution is estimated not to exceed
50 and each transaction will have five attributes. The double-subscripted array sample (50,3) is
defined to have 50 rows and three columns.
The optional $ATTRIBUTES statement is used when it is desired to assign descriptive names to
the elements of the A(.) array. For example, suppose that the $DIMENSION statement specifies
the attributes array as A(5), meaning that each transaction will have five attributes. The
statement
$ATTRIBUTES; Type, ser_nbr(2),, Prod_time: signifies the following equivalences:
A(1)=Type A(2)=ser_nbr(1) A(3)=ser_nbr(2) A(5)=Prod_time.
Notice that the name of A(4) has been defaulted, which means that it has no descriptive name.
The definitions segment of the model defines the model‘s statistical variables, logic switches
and resources. All three types of statements are optional.
The logic segment includes the code that describes the simulated system using the nodes and
branches.
The control segment provides information related to how output results are gathered during
execution. Finally, the initial data segment provides all the data needed to initialise the
simulation
Explanation
The $DIMENSION statement estimates that at most 30 transactions(customers) will be in the
model at any one time. If during execution this estimate is exceeded, SIMNET II will give an
error message. The $DIMENSION of ENTITY must be increased.
FACILITITIES
NBR MIN/MAX AV. AV. AV. AV. IDLE BUSY
SEVRS LAST GROSS BLOCKAGE BLKGE TIME TIME
UTILZ UTILZ TIME
3 3/3/1 1.9931 .0000 .00 8.48 16.78
TRANSACTION COUNT AT T=480.00 OF RUN 1:
NODE IN OUT RESIDING SKIPPING UNLINKED/
(BLOCKED) (DESTROYED) LINKED
*S:ARVL 96 (0) 0
*Q: LINE 40 40 0 56 0/ 0
*F:CLRKS 96 95 1 0 0 95
The transaction count given at the end of the report gives a complete history of the flow of
transaction during the run. The summary can be helpful on spotting irregularities in the model.
In our example, during the 480 minutes run, 96 transactions were created by source ATVL, 40
of which experienced some waiting in queue LINE and the remaining 56 skipped the queue.
Facility CLRKs received 96 customers and released 95 with 1 transaction remaining un
processed at the end of the run. The remaining column on the count are all zeros. The
UNLINKED/LINKED column is used only when the model exposes some file manipulations.
The (Blocked) and (DESTROYED) column will show positive values whether a facility is
blocked or when transaction are destroyed. Neither case applied in our case.
Queue LINE has an infinite capacity (*** shows), IN:OUT ration of 1:1 shows that each
existing transaction corresponds to one waiting transaction. The Average length of 1.30
transactions represents the average run of waiting transactions over the entire length of the run(=
0,12,0) that occurred during the run. Average waiting time of all transactions (including those
that do not wait) given by AV. DELAY ALL)=6051minutes. Next column AV. DELAY (+ve
WAIT ) show the average waiting for those that must wait as
15.63 minutes. Finally, last column indicates that 58% of transactions arriving from source
AVRL skip LINE i.e they do not experience any waiting at all.
Facility CLRK has 3 parallel servers. Second column shows that CLRKs
The third column indicates that the average 1.9931 servers (out of 3) were busy throughtout the
run, thus reflecting a gross percentage utilization of (1.9931/3)*100 = 66.4% the average
BLOCKAGE records the average number of productive occupancy of the facility.
2. How many transactions will be generated by each of the following source statement
during the first 20 time units of the simulation?
a. ARIV *S;5;/L/LIM=3:
b. ARIV *S;/m/MULT=2:
3. The first five transactions arriving at queue QQ have the following attributes:
Transaction A(1) A(2)
1 4 9
2 7 -3
3 1 10
4 3 14
5 2 6
Show how these transactions will be ordered in QQ in each of the following cases:
a). QQ *Q: b) QQ *Q;/d/LIFO: c) QQ *Q;/d/HI(1): d) QQ *Q;/d/LO(2):
5.0 Conclusion
The essence of this unit is to look at simulation languages designed to expedite simulation,
through:
Provision convenient means of describing the elements that commonly appear in
simulation models.
Expediting the change in the design configuration of the system being simulated so that a
large number of configurations can be considered easily.
Provision of simple operational procedures, such as introducing changes into simulation
models, initializing the state of the model, altering the kind of output data to be
generated and stacking a series of simulation runs
6.0 Summary
We looked at the following:
Purpose of simulation language which is to describes the operation of a simulation on a
computer
Types and Examples of Simulation Languages which is broadly divided into two discrete
and continuous events simulation languages.
The approaches to model development divided into two: next-event scheduling and
process operation with there various parameters
The SIMNET II language and its development including:
o Its Nodes Statements
o The rules For The Operation of Nodes
o Node Definition
o The Mathematical Expressions
o Layout of SIMNET II MODEL, and
o SIMNET Output Report
7.0 Further Readings
Gordon, S. I., & Guilfoos, B. (2017). Introduction to Modeling and Simulation with
MATLAB® and Python. Milton: CRC Press.
Zeigler, B. P., Muzy, A., & Kofman, E. (2019). Theory of modeling and simulation:
Discrete event and iterative system computational foundations. San Diego (Calif.):
Academic Press.
Kluever, C. A. (2020). Dynamic systems modeling, simulation, and control. Hoboken,
N.J: John Wiley & Sons.
Law, A. M. (2015). Simulation modeling and analysis. New York: McGraw-Hill.
Verschuuren, G. M., & Travise, S. (2016). 100 Excel Simulations: Using Excel to Model
Risk, Investments, Genetics, Growth, Gambling and Monte Carlo Analysis. Holy Macro!
Books.
Grigoryev, I. (2015). AnyLogic 6 in three days: A quick course in simulation modeling.
Hampton, NJ: AnyLogic North America.
Dimotikalis, I., Skiadas, C., & Skiadas, C. H. (2011). Chaos theory: Modeling, simulation
and applications: Selected papers from the 3rd Cghaotic Modeling and Simulation
International Conference (CHAOS2010), Chania, Crete, Greece, 1-4 June, 2010.
Singapore: World Scientific.
Velten, K. (2010). Mathematical modeling and simulation: Introduction for scientists and
engineers. Weinheim: Wiley-VCH
Module 5: STOCHASTIC SIMULATIONS
Module Introduction
This module is divided into four (4) units
Unit 1: Stochastic Processes
Unit 2: Random Walks
Unit 3: Data Collection
Unit 4: Coding and Screening
1.0 Introduction
So far in our work in probability and statistics, we have tended to deal with one (or at most two)
random variables at a time. In many situations, we want to study the interaction of ―chance"
with ―time" e.g. the behaviour of shares in a company on the stock market, the spread of an
epidemic, the movement of a pollen grain in water (Brownian motion). To model this we, need a
family of random variables (all defined on the same probability space), (X(t); t ≥ 0) where X(t)
represents e.g. the value of the share at time t. (X(t); t ≥ 0) is called a (continuous time)
stochastic process or random process.
In this section, we will look at the theory of stochastic processes in an elementary manner. In
probability theory, a stochastic process, or sometimes random process, is the counterpart to a
deterministic process (or deterministic system). Instead of dealing with only one possible reality
of how the process might evolve under time (as is the case, in solutions of an ordinary
differential equation), in a stochastic or random process there is some indeterminacy in its future
evolution described by probability distributions. This means that even if the initial condition (or
starting point) is known, there are many possibilities the process might go to, but some paths
may be more probable and others less so.
Examples are the delay {D(i), i = 1, 2, ...} of the ith customer and number of customers
{Q(t), T > 0} in the queue at time t in an M/M/1 queue. In the first example, we have a discrete-
time, continuous state, while in the second example the state is discrete and time is continuous.
We can also define stochastic process X = {X(t), t T } as a collection of random variables. That
is, for each t in the index set T, X(t) is a random variable. We often interpret t as time and call
X(t) the state of the process at time t. when the index set T is countable set, we have a discrete-
time stochastic process, or it is non-countable continuous set, we have a continuous-time
stochastic process. Any realization of X is named a sample path, which can be discrete or
continuous.
Although in most applications the index set is simply a set of time instants tk, for the case of
technical uncertainty this is not true.
Another definition is that of Dixit & Pindyck's which state that "Stochastic process is a variable
that evolves over time in a way that is at least in part random".
So, a stochastic process means time and randomness. In most cases, a stochastic variable has
both a expected value term (drift term) and a random term (volatility term).
We can see the stochastic process forecasting for a random variable X, as a forecast value
(E[X]) plus a forecasting error, where error follow some probability distribution. So:
X(t) = E[X(t)] + error(t)
The figure below presents the idea, a popular example, and brings the concept of
increment (in this case the Wiener increment).
A stationary stochastic process is a stochastic process {X(t), t ε T} with the property that the
joint distribution of all vectors of h dimension remain the same for any fixed h.
First Order Stationary: A stochastic process is a first order stationary if the expectation of X(t)
remains the same for all t.
For example in economic time series, a process is first order stationary when we remove any
kinds of trend by some mechanisms such as differencing.
Second Order Stationary: A stochastic process is a second order stationary if it is first order
stationary and covariance between X(t) and X(s) is a function of only t-s.
Again, in economic time series, a process is second order stationary when we stabilize also its
variance by some kind of transformations such as taking square root.
Note: a stationary process is a second order stationary, however the reverse may not hold.
In simulation output statistical analysis we are satisfied if the output is covariance stationary.
Since a Gaussian process needs a mean and covariance matrix only, it is stationary (strictly) if it
is covariance stationary.
Lévy processes are stochastic processes with stationary independent increments and continuous
in probability.
Stationary increment property means that the probability distribution for the changes in the
stochastic variable X, depends only on the time interval length.
Independent increments means that for all time instant t, the increments are independents.
The two most basic types of Lévy processes are Wiener processes and Poisson process.
Markov processes have the following property: given that its current state is known, the
probability of any future event of the process is not altered by additional knowledge concerning
its past behaviour.
In a more formal words, the probability distribution for xt + 1 depends only on xt, and not
additionally on what occurred before time t (doesn't depend of xs, where s < t). that is suppose
that: P{Xn+1 = 1|Xn = I, Xn-1 = in-1, …, X1 = i1, X0 = i0} = Pij
For all states i0, i1, i2, …, in-1, i, j and all n>=0, this stochastic process is a Markov chain.
Itô process is a generalized Wiener process. A Wiener process is also a special case of a
strong diffusion process that is a particular class of a continuous time Markov process.
A continuous time Wiener Process (also called Brownian motion) is a stochastic process with
three properties:
It is a Markov process. This means that all the past information is considered in the
current value, so that futures values of the process depends only on its current value not on past
values. The futures values are not affected by the past values history. In finance, this is
consistent with the efficient market hypothesis (that the current prices reflect all relevant
information).
It has independent increments. Change in one time interval is independent of any other
time interval (nonoverlapping).
The changes of value over any finite time interval are normally distributed. So, it
has stationary increments, besides the property of independent increments. Therefore it is a
particular Lévy process (Lévy process with normal distribution for the increments).
Point process is a stochastic process whose realizations are, instead continuous sample paths,
counting measures.
Any counting process which is generated by an independent identically distributed (I.I.D) sum
process (Tn) is called renewal counting process.
The simplest and most fundamental point process is the Poisson process, also referred as
jump process in the financial literature.
The Poisson process is a counting process in which interarrival times of successive jumps are
independently and identically distributed (i.i.d.) exponential random variables. The Poisson
process is an example of renewal counting process.
Homogeneous Poisson Process has the following three properties:
1. It starts at zero. This means that at t = 0, there is no jump. By counting process point of
view, N(0) = 0 (the number of jumps in the process N is zero at t = 0).
2. It has independent stationary increments. A Poisson process is also a special Lévy
process.
3. For t > 0, the probability of n jumps occurrences until time t is:
P[N(t) = n] = (1/n!) (λt)n e -λt ; n = 0, 1, 2, .....
which is a Poisson distribution with parameter t.
The Poisson distribution tends to the Normal distribution as the frequency tends to infinity. So, a
Poisson distribution is asymptotically Normal.
A Non-homogeneous Poisson Process is more general than the homogeneous one: the
stationary increment assumption is not required (remain the independent increment assumption),
and the constant arrival rate of a Poisson process is replaced by a time- varying intensity
function.
Let N(t) be a Poisson process, independent of Xi. The following process is called a Compound
Poisson Process:
The sum of two independent compound Poisson processes is itself a compound Poisson
process.
A jump is degenerate when the variable can only jump to a fixed value, and remains in this
value. Example is the case of "sudden death" process which the variable drops to zero forever.
Interestingly the combination of Poisson processes with Brownian motions is related to Lévy
process. According to Karlin & Taylor, "The general Lévy process can be represented as a sum
of a Brownian motion, a uniform translation, and a limit (an integral) of a one-parameter family
of compound Poisson processes, where all the contributing basic processes are mutually
independent".
In the sample paths of Lévy processes, the large increments or "jumps" are called "Lévy
flights".
3.4.4 Physics
The name "Monte Carlo" for the stochastically Monte Carlo method was popularized by physics
researchers.
Perhaps the most famous early use was by Enrico Fermi in 1930, when he used a random
method to calculate the properties of the newly-discovered neutron. Monte Carlo methods were
central to the simulations required for the Manhattan Project, though were severely limited by
the computational tools at the time. Therefore, it was only after electronic computers were first
built (from 1945 on) that Monte Carlo methods began to be studied in depth. In the 1950s they
were used at Los Alamos for early work relating to the development of the hydrogen bomb, and
became popularized in the fields of physics, physical chemistry, and operations research.
3.4.5 Biology
In biological systems, introducing stochastic 'noise' has been found to help improve the signal
strength of the internal feedback loops for balance and other vestibular communication. It has
been found to help diabetic and stroke patients with balance control.
3.4.6 Medicine
Stochastic effect or "chance effect" is one classification of radiation effects that refers to the
random, statistical nature of the damage. In contrast to the deterministic effect, severity is
independent of dose. Only the probability of an effect increases with dose. Cancer is a stochastic
effect.
3.4.7 Creativity
Simonton (2003, Psych Bulletin) argues that creativity in science (of scientists) is a constrained
stochastic behaviour such that new theories in all sciences are, at least in part, the product of
stochastic processes.
3.4.8 Music
In music, stochastic elements are generated by strict mathematical processes.
Stochastic processes can be used in music to compose a fixed piece or can be produced in
performance. Stochastic music was pioneered by Iannis Xenakis, who used probability, game
theory, group theory, set theory, and Boolean algebra, and frequently used computers to produce
his scores. Earlier, John Cage and others had composed aleatoric or indeterminate music, which
is created by chance processes but does not have the strict mathematical basis.
When color reproductions are made, the image is separated into its component colors by taking
multiple photographs filtered for each color. One resultant film or plate represents each of the
cyan, magenta, yellow, and black data. Color printing is a binary system, where ink is either
present or not present, so all color separations to be printed must be translated into dots at some
stage of the work-flow. Traditional line screens which are amplitude modulated had problems
until stochastic screening became available. A stochastic (or frequency modulated) dot pattern
creates a sharper image.
3.4.12 Business
Manufacturing - Manufacturing processes are assumed to be stochastic processes. This
assumption is largely valid for either continuous or batch manufacturing processes. Testing
and monitoring of the process is recorded using a process control chart which plots a given
process control parameter over time. Typically a dozen or many more parameters will be
tracked simultaneously. Statistical models are used to define limit lines which define when
corrective actions must be taken to bring the process back to its intended operational
window.
Finance - The financial markets use stochastic models to represent the seemingly random
behaviour of assets such as stocks, commodities and interest rates. These models are then
used by quantitative analysts to value options on stock prices, bond prices, and on interest
rates, see Markov models. Moreover, it is at the heart of the insurance industry.
6.0 Summary
In this unit we:
Defined Stochastic Process as a probabilistic model of a system that evolves randomly in
time and space. Or a variable that evolves over time in a way that is at least in part
random,
Classify Stochastic Processes into Continuous or Discrete in; Time or Change in the
State of the system.
Discussed the following Concepts in Stochastic Processes: 1st, 2nd, and Covariance
stationary, Levy, Ito, Point and Poisson processes.
Highlighted the application of stochastic processes in different fields such as:
Mathematics, Artificial intelligence, Natural science, Physics, Medicine, Business, etc.
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Definition of Random Walk
3.2 Types of Random Walks
3.3 Random walk in two dimensions
3.4 Random walk on graphs
3.5 Wiener Process
3.6 Applications of Random Walks
3.7 Probabilistic interpretation
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
Random walk is a special case of stochastic process. This means that in this unit we are simply
extending our knowledge of stochastic processes further.
Random walks also vary with regard to the time parameter. Often, the walk is in discrete time,
and indexed by the natural numbers, as in X0, X1, X2, … However, some walks take their steps
at random times, and in that case the position Xt is defined for the continuum of times t ∈
[0,+∞).
Specific cases or limits of random walks include the drunkard's walk and Lévy flight.
Random walks are related to the diffusion models and are a fundamental topic in discussions of
Markov processes. Several properties of random walks, including dispersal distributions, first-
passage times and encounter rates, have been extensively studied
In simple random walk, the walk can only jump to neighbouring sites of the lattice.
In simple symmetric random walk on a locally finite lattice, the probabilities of walk jumping
to any one of its neighbours are the same. The most well-studied example is of random walk on
the d-dimensional integer lattice (sometimes called the hypercubic lattice) .
The series {Sn} is called the simple random walk on Z. This series (the sum of the
sequence of -1's and 1's) gives you the length you have 'walked', if each part of the walk is of
length one.
This walk can be illustrated as follows. Say you flip a fair coin. If it lands on heads, you move
one to the right on the number line. If it lands on tails, you move one to the left. So after five
flips, you have the possibility of landing on 1, −1, 3, −3, 5, or −5. You can land on 1 by flipping
three heads and two tails in any order. There are 10 possible ways of landing on 1. Similarly,
there are 10 ways of landing on −1 (by flipping three tails and two heads), 5 ways of landing
on 3 (by flipping four heads and one tail), 5 ways of landing on −3 (by flipping four tails
and one head), 1 way of landing on 5 (by flipping five heads), and 1 way of landing on −5 (by
flipping five tails). See the figure below for an illustration of this example.
This is of course random, so we cannot calculate it. But we may say quite a bit about its
distribution. It is not hard to see that the expectation E(Sn) of Sn is zero. That is, the more you
flip the coin, the closer the mean of all your -1's and 1's will be to zero.
A similar calculation, using the independence of the random variables and the fact that
, shows that:
This hints that , the expected translation distance after n steps, should be of the order of
.In fact,
Suppose we draw a line of some distance from the origin of the walk. How many times will the
random walk cross the line if permitted to continue walking forever?
The following, perhaps surprising theorem is the answer: A simple random walk on Z will cross
every point an infinite number of times. This result has many names: the level-crossing
phenomenon, recurrence or the gambler's ruin.
The reason for the last name is as follows: if you are a gambler with a finite amount of money
playing a fair game against a bank with an infinite amount of money, you will surely lose. The
amount of money you have will perform a random walk, and it will almost surely, at some time,
reach 0 and the game will be over.
If a and b are positive integers, then the expected number of steps until a one-dimensional
simple random walk starting at 0 first hits b or −a is ab. The probability that this walk will hit b
before -a steps is (a / (a + b)), which can be derived from the fact that simple random walk is a
martingale.
Some of the results mentioned above can be derived from properties of Pascal's triangle. The
number of different walks of n steps where each step is +1 or −1 is clearly 2n. For the simple
random walk, each of these walks are equally likely. In order for Sn to be equal to a number k it
is necessary and sufficient that the number of +1 in the walk exceeds those of
−1 by k. Thus, the number of walks which satisfy Sn = k is precisely the number of ways of
choosing (n + k)/2 elements from an n element set (for this to be non-zero, it is necessary that n
+ k be an even number), which is an entry in Pascal's triangle denoted by:
By representing entries of Pascal's triangle in terms of factorials and using Stirling's formula,
one can obtain good estimates for these probabilities for large values of n.
This relation with Pascal's triangle is easily demonstrated for small values of n. At zero turns,
the only possibility will be to remain at zero. However, at one turn, you can move either to the
left or the right of zero, meaning there is one chance of landing on −1 or one chance of landing
on 1. At two turns, you examine the turns from before. If you had been at 1, you could move to
2 or back to zero. If you had been at −1, you could move to −2 or back to zero. So there is one
chance of landing on −2, two chances of landing on zero, and one chance of landing on 2.
n -5 -4 -3 -2 -1 0 1 2 3 4 5
P[S0 = k] 1
2P[S1 = k] 1 1
22P[S2 = k] 1 2 1
23P[S3 = k] 1 3 3 1
24P[S4 = k] 1 4 6 4 1
25P[S5 = k] 1 5 10 10 5 1
The central limit theorem and the law of the iterated logarithm describe important aspects of the
behaviour of simple random walk on Z.
Gaussian random walk is a random walk having a step size that varies according to a normal
distribution. It is used as a model for real-world time series data such as financial markets. The
Black-Scholes formula for modelling equity option prices, for example, uses a gaussian random
walk as an underlying assumption.
A Stochastic process {X(t), t>=0} is called a Gaussian, or a normal process if X(tn) has a
multivariate normal distribution for all t1, t2, …, tn.
If {X(t), t>=0} is a Brownian motion process , then because each of X(t1), X(t2), …, X(tn) can
be expressed as a linear combination of independent normal random variables X(t1), X(t2)-
X(t1), X(t3)-X(t2), …, X(tn)-X(tn-1) it follows that Brownian motion is Gaussian process.
Here, the step size is the inverse cumulative normal distribution Φ − 1(z,µ,ζ) where 0 ≤ z ≤
1 is a uniformly distributed random number, and µ and ζ are the mean and standard deviations
of the normal distribution, respectively.
For steps distributed according to any distribution with zero mean and a finite variance (not
necessarily just a normal distribution), the root mean squared translation distance after n steps
is:
X(0) = 0;
{X(t), t>=0} has stationary and independent increments
For every t>0, X(t) is normally distributed with mean 0 and variance ζ2t.
Imagine now a drunkard walking randomly in an idealized city. The city is effectively infinite
and arranged in a square grid, and at every intersection, the drunkard chooses one of the four
possible routes (including the one he came from) with equal probability. Formally, this is a
random walk on the set of all points in the plane with integer coordinates. Will the drunkard
ever get back to his home from the bar? It turns out that he will. This is the high dimensional
equivalent of the level crossing problem discussed above. The probability of returning to the
origin decreases as the number of dimensions increases. In three dimensions, the probability
decreases to roughly 34%. A derivation, along with values of p(d) are discussed in:
The trajectory of a random walk is the collection of sites it visited, considered as a set with
disregard to when the walk arrived at the point. In one dimension, the trajectory is simply all
points between the minimum height the walk achieved and the maximum (both are, on average,
on the order of √n). In higher dimensions the set has interesting geometric properties. In fact,
one gets a discrete fractal, that is a set which exhibits stochastic self- similarity on large scales,
but on small scales one can observe "jaggedness" resulting from the grid on which the walk is
performed.
Will our drunkard reach his home? It turns out that under rather mild conditions, the answer is
still yes. For example, if the lengths of all the blocks are between a and b (where a and b are any
two finite positive numbers), then the drunkard will, almost surely, reach his home. Notice that
we do not assume that the graph is planar, i.e. the city may contain tunnels and bridges. One
way to prove this result is using the connection to electrical networks. Take a map of the city
and place a one ohm resistor on every block. Now measure the "resistance between a point and
infinity". In other words, choose some number R and take all the points in the electrical network
with distance bigger than R from our point and wire them together. This is now a finite electrical
network and we may measure the resistance from our point to the wired points. Take R to
infinity. The limit is called the resistance between a point and infinity. It turns out that the
following is true (an elementary proof can be found in the book by Doyle and Snell):
Theorem: a graph is transient if and only if the resistance between a point and infinity is finite.
It is not important which point is chosen if the graph is connected.
In other words, in a transient system, one only needs to overcome a finite resistance to get to
infinity from any point. In a recurrent system, the resistance from any point to infinity is infinite.
This characterization of recurrence and transience is very useful, and specifically it allows us to
analyze the case of a city drawn in the plane with the distances bounded.
A random walk on a graph is a very special case of a Markov chain. Unlike a general Markov
chain, random walk on a graph enjoys a property called time symmetry or reversibility. Roughly
speaking, this property, also called the principle of detailed balance, means that the
probabilities to traverse a given path in one direction or in the other have a very simple
connection between them (if the graph is regular, they are just equal). This property has
important consequences.
A good reference for random walk on graphs is the online book by Aldous and Fill. For
groups see the book of Woess. If the transition kernel p(x,y) is itself random (based on an
environment ω) then the random walk is called a "random walk in random environment".
When the law of the random walk includes the randomness of ω, the law is called the
annealed law; on the other hand, if ω is seen as fixed, the law is called a quenched law.
A Wiener process is the scaling limit of random walk in dimension 1. This means that if you
take a random walk with very small steps you get an approximation to a Wiener process
(and, less accurately, to Brownian motion).
To be more precise, if the step size is ε, one needs to take a walk of length L/ε2 to
approximate a Wiener process walk of length L. As the step size tends to 0 (and the number
of steps increases proportionally) random walk converges to a Wiener process in an
appropriate sense.
Formally, if B is the space of all paths of length L with the maximum topology, and if M is
the space of measure over B with the norm topology, then the convergence is in the space M.
Similarly, a Wiener process in several dimensions is the scaling limit of random walk in the
same number of dimensions.
A random walk is a discrete fractal (a function with integer dimensions; 1, 2, ...), but a
Wiener process trajectory is a true fractal, and there is a connection between the two. For
example, take a random walk until it hits a circle of radius r times the step length. The
average number of steps it performs is r2. This fact is the discrete version of the fact that a
Wiener process walk is a fractal of Hausdorff dimension. In two dimensions, the average
number of points the same random walk has on the boundary of its trajectory is r4/3. This
corresponds to the fact that the boundary of the trajectory of a Wiener process is a fractal of
dimension 4/3, a fact predicted by Mandelbrot using simulations but proved only in 2000
(Science, 2000).
A Wiener process enjoys many symmetries which random walk does not. For example, a
Wiener process walk is invariant to rotations, but random walk is not, since the underlying
grid is not. This means that in many cases, problems on random walk are easier to solve by
translating them to a Wiener process, solving the problem there, and then translating back.
On the other hand, some problems are easier to solve with random walks due to its discrete
nature.
Random walk and Wiener process can be coupled, namely manifested on the same
probability space in a dependent way that forces them to be quite close. The simplest such
coupling is the Skorokhod embedding, but other, more precise couplings exist as well.
The convergence of a random walk toward the Wiener process is controlled by the central
limit theorem. For a particle in a known fixed position at t = 0, the theorem tells us that after
a large number of independent steps in the random walk, the walker's position is distributed
according to a normal distribution of total variance:
where t is the time elapsed since the start of the random walk , ԑ is the size of a step of the
random walk, and δt is the time elapsed between two successive steps.
This corresponds to the Green function of the diffusion equation that controls the Wiener
process, which demonstrates that, after a large number of steps, the random walk converges
toward a Wiener process.
In 3D, the variance corresponding to the Green's function of the diffusion equation is:
By equalizing this quantity with the variance associated to the position of the random walker,
one obtains the equivalent diffusion coefficient to be considered for the asymptotic Wiener
process toward which the random walk converges after a large number of steps:
Remark: the two expressions of the variance above correspond to the distribution
associated to the vector R that links the two ends of the random walk, in 3D. The variance
associated to each component Rx, Ry or Rz is only one third of this value (still in 3D).
In economics, the "random walk hypothesis" is used to model shares prices and other
factors. Empirical studies found some deviations from this theoretical model, especially in
short term and long term correlations.
In population genetics, random walk describes the statistical properties of genetic
drift
In physics, random walks are used as simplified models of physical Brownian motion
and the random movement of molecules in liquids and gases. See for example diffusion-
limited aggregation. Also in physics, random walks and some of the self interacting walks
play a role in quantum field theory.
In mathematical ecology, random walks are used to describe individual animal
movements, to empirically support processes of biodiffusion, and occasionally to model
population dynamics.
In polymer physics, random walk describes an ideal chain. It is the simplest model to
study polymers.
In other fields of mathematics, random walk is used to calculate solutions to Laplace's
equation, to estimate the harmonic measure, and for various constructions in analysis and
combinatorics.
In computer science, random walks are used to estimate the size of the Web. In the
World Wide Web conference-2006, bar-yossef et al. published their findings and algorithms
for the same. (This was awarded the best paper for the year 2006).
In image segmentation, random walks are used to determine the labels (i.e., "object"
or "background") to associate with each pixel[3]. This algorithm is typically referred to as the
random walker segmentation algorithm.
In brain research, random walks and reinforced random walks are used to model
cascades of neuron firing in the brain.
In vision science, fixational eye movements are well described by a random walk.
In psychology, random walks explain accurately the relation between the time needed
to make a decision and the probability that a certain decision will be made.
Random walk can be used to sample from a state space which is unknown or very
large, for example to pick a random page off the internet or, for research of working
conditions, a random worker in a given country.
When this last approach is used in computer science it is known as Markov Chain
Monte Carlo or MCMC for short. Often, sampling from some complicated state space also
allows one to get a probabilistic estimate of the space's size. The estimate of the permanent of
a large matrix of zeros and ones was the first major problem tackled using this approach.
In wireless networking, random walk is used to model node movement.
Motile bacteria engage in a biased random walk.
Random walk is used to model gambling.
In physics, random walks underlying the method of Fermi estimation.
During World War II a random walk was used to model the distance that an escaped
prisoner of war would travel in a given time.
. We can call it a random walk because we may think of it asbeing a model for
an individual walking on a straight line who at each point of time either takes one step to the
right with probability p or one step to the left with probability 1 − p.
5.0 Conclusion
We presented in this unit, the theory of stochastic processes in an elementary manner. A
reader interested in a more rigorous approach could consult some of the referenced texts and
many other sources. This unit tried to limit the discussion to a more physical description of
stochastic processes.
6.0 Summary
In this unit we:
Defined Random Walk as a mathematical formalisation of a trajectory that consists of
taking successive random steps, which is often assumed to be Markov chains or Markov
processes.
Discussed different types of Random Walks especially, in: the One-Dimensional,
Gaussian, two dimensions and Graphs
Look at the applications of random walk and
Explained the probability interpretations and
Describedthe relationship of RW to Weiner process.
Gamerman, D., & Lopes, H. F. (2006). Markov chain Monte Carlo: Stochastic
simulation for Bayesian inference. Boca Raton: Chapman & Hall/CRC.
Graham, C., & Talay, D. (2015). Stochastic Simulation and Monte Carlo Methods
Mathematical Foundations of Stochastic Simulation. Berlin: Springer Berlin
Heidelberg.
Mai, J., Scherer, M., & Czado, C. (2017). Simulating copulas: Stochastic models,
sampling algorithms, and applications. New Jersey: World Scientific Publishing.
Nelson, B. (2015). Foundations and methods of stochastic simulation: A first course.
Place of publication not identified: Springer.
Kozachenko, Y., Pogorilyak, O., Rozora, I., & Tegza, A. (2016). Simulation of
stochastic processes with given accuracy and reliability. London: ISTE Press.
Cochard, G. (2019). Introduction to stochastic processes and simulation. London,
UK: ISTE.
Rao, C. R., & Shanbhag, D. N. (2007). Stochastic processes: Modelling and
simulation. Amsterdam: Elsevier.
Gallager, R. G. (2017). Stochastic Processes: Theory for Applications. Cambridge,
United Kingdom: Cambridge University Press.
Jones, P. W., & Smith, P. (2018). Stochastic processes: An introduction. Boca Raton
(Fla.): Chapman & Hall/CRC.
Unit 3: Data Collection
Contents
1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content
3.1 Methods of Data Collection
3.2 Pros and Cons of Data Collection Methods
3.3 Sampling Survey Methods
3.4 Categorization of Sampling Methods
3.5 Non-Probability Sampling Methods
3.6 Probability Sampling Methods
3.7 Experiments Method in Data Collection
4.0 Self-Assessment Exercise(s)
5.0 Conclusion
6.0 Summary
7.0 Further Readings
1.0 Introduction
The purpose of most simulation models is to collect data and to analyse the data, in order to
gain insights into the system being simulated. Thus we literally ‗play‘ with data in the
conduct of ‗what if scenarios‘ to enable conclusions and decisions to be made. To derive
good conclusions from data, we do not just use any data, care and efforts are usually made to
collect usable data from select at times ‗restricted‘ source(s). Therefore before decisions are
made base on statistics from data, we need to know how the data were collected; that is, we
need to know the method(s) of data collection, and the necessary screening on the data that
has taken place.
b. Cluster sampling
With cluster sampling, every member of the population is assigned to one, and only one, group.
Each group is called a cluster. A sample of clusters is chosen, using a probability method (often
simple random sampling). Only individuals within sampled clusters are surveyed.
Note the difference between cluster sampling and stratified sampling. With stratified sampling,
the sample includes elements from each stratum. With cluster sampling, in contrast, the sample
includes elements only from sampled clusters.
c. Multistage Sampling
With multistage sampling, we select a sample by using combinations of different sampling
methods.
For example, in Stage 1, we might use cluster sampling to choose clusters from a population.
Then, in Stage 2, we might use simple random sampling to select a subset of elements from each
chosen cluster for the final sample.
Vitamin C
0 mg 250 mg 500 mg
In this hypothetical experiment, the researcher is studying the possible effects of Vitamin C and
Vitamin E on health. There are two factors - dosage of Vitamin C and dosage of Vitamin E. The
Vitamin C factor has 3 levels - 0 mg per day, 250 mg per day, and 500 mg per day. The Vitamin
E factor has 2 levels - 0 mg per day and 400 mg per day. The experiment has six treatments.
Treatment 1 is 0 mg of E and 0 mg of C, Treatment 2 is 0 mg of E and 250 mg of C, and so on.
b. Dependent variable. In the hypothetical experiment above, the researcher is looking at
the effect of vitamins on health. The dependent variable in this experiment would be some
measure of health (annual doctor bills, number of colds caught in a year, number of days
hospitalized, etc.).
1. Control. Control refers to steps taken to reduce the effects of extraneous variables (i.e.,
variables other than the independent variable and the dependent variable). These extraneous
variables are called lurking variables.
Control involves making the experiment as similar as possible for experimental units in each
treatment condition. Three control strategies are control groups, placebos, and blinding.
Control group. A control group is a baseline group that receives no treatment or a neutral
treatment. To assess treatment effects, the experimenter compares results in the treatment group
to results in the control group.
Placebo. Often, participants in an experiment respond differently after they receive a
treatment, even if the treatment is neutral. A neutral treatment that has no "real" effect on the
dependent variable is called a placebo, and a participant's positive response to a placebo is called
the placebo effect.
To control for the placebo effect, researchers often administer a neutral treatment (i.e., a
placebo) to the control group. The classic example is using a sugar pill in drug research. The
drug is effective only if participants who receive the drug have better outcomes than participants
who receive the sugar pill.
Blinding. Of course, if participants in the control group know that they are receiving a
placebo, the placebo effect will be reduced or eliminated; and the placebo will not serve its
intended control purpose.
Blinding is the practice of not telling participants whether they are receiving a placebo. In this
way, participants in the control and treatment groups experience the placebo effect equally.
Often, knowledge of which groups receive placebos is also kept from people who administer or
evaluate the experiment. This practice is called double blinding. It prevents the experimenter
from "spilling the beans" to participants through subtle cues; and it assures that the analyst's
evaluation is not tainted by awareness of actual treatment conditions.
2. Randomization. Randomization refers to the practice of using chance methods (random
number tables, flipping a coin, etc.) to assign experimental units to treatments. In this way, the
potential effects of lurking variables are distributed at chance levels (hopefully roughly evenly)
across treatment conditions.
3. Replication. Replication refers to the practice of assigning each treatment to many
experimental units. In general, the more experimental units in each treatment condition, the
lower the variability of the dependent measures.
3.8 Confounding
Confounding occurs when the experimental controls do not allow the experimenter to
reasonably eliminate plausible alternative explanations for an observed relationship between
independent and dependent variables.
Consider this example. A drug manufacturer tests a new cold medicine with 200 participants -
100 men and 100 women. The men receive the drug, and the women do not. At the end of the
test period, the men report fewer colds.
This experiment implements no controls at all! As a result, many variables are confounded, and
it is impossible to say whether the drug was effective. For example, gender is confounded with
drug use. Perhaps, men are less vulnerable to the particular cold virus circulating during the
experiment, and the new medicine had no effect at all. Or perhaps the men experienced a
placebo effect.
This experiment could be strengthened with a few controls. Women and men could be randomly
assigned to treatments. One treatment could receive a placebo, with blinding. Then, if the
treatment group (i.e., the group getting the medicine) had sufficiently fewer colds than the
control group, it would be reasonable to conclude that the medicine was effective in preventing
colds.
2. An auto analyst is conducting a satisfaction survey, sampling from a list of 10,000 new
car buyers. The list includes 2,500 Ford buyers, 2,500 GM buyers, 2,500 Honda buyers, and
2,500 Toyota buyers. The analyst selects a sample of 400 car buyers, by randomly sampling 100
buyers of each brand.
Is this an example of a simple random sample and state why?
3. Which of the following statements is/are true and why?
I. A sample survey is an example of an experimental study.
II. An observational study requires fewer resources than an experiment.
III. The best method for investigating causal relationships is an observational study.
(A) I only (B) II only (C) III only (D) all of the above (E) none of the above.
5.0 Conclusion
Model Simulations is simply playing with relevant data to learn and make decision. The result or
accuracy of such decision which may be far reaching is subject to the quality of data. This high
quality and thus good decision is achieved through conscious choice, planning and execution of
data collection method.
6.0 Summary
In this unit, we discussed:
The various methods of data collection including:
Census- is a study that obtains data from every member of a population which in most
case is not practical, because of the cost and/or time required.
Sample survey- is a study that obtains data from a subset of a population, in order to
estimate population attributes.
Experiment- is a controlled study in which the researcher attempts to understand cause-
and-effect relationships. Whereby the study is "controlled" in the sense that the
researcher controls: how subjects are assigned to groups and which treatments each
group receives.
In the analysis phase, the researcher compares group scores on some dependent variable.
Based on the analysis, the researcher draws a conclusion about whether the treatment (
independent variable) had a causal effect on the dependent variable.
Observational study – which attempt to understand cause-and-effect relationships. But
however, unlike experiments, the researcher is not able to control: how subjects are
assigned to groups and/or and which treatments each group receives.
Indepth the various methods by futher subdividing them as follows:
o Sampling survey into: Simple, Stratified, Cluster, Systematic random and
multistage
o Experiments into: Independent, Dependent and Experimental variable types and the
characteristics of EM: Controlled, Randomized and Replicated experiments and
Confounding.
1.0 Introduction
We have earlier state that simulation is about play with data to study the behaviour of a system.
To actually benefit from such exercise, true representative data must be collected and screen.
Quality data comes through careful transformation from its raw stages into appropriate system
parameters variables which can be quantitatively analyzed before it can yield true results.
As noted above, some examples will fit into more than one column of your grid. Once you have
plotted your coded data into these issue categories, you can begin considering which issues are
most significant to your professional context. This grid also should allow you to develop better
your "Contextual Analysis Plan."
Transcription features
Appropriate for open-ended answers as in focus groups, observation, individual
interviews, etc.
Strengthens ―audit trail‖ since reviewers can see actual data
Uses identifiers that make participant anonymous but still reveal information to
researcher; example Staff/Employee/Student number
Three Parts To Transcript
Background information, e.g. time, date, organizations involved and participants.
Verbatim (i.e. word for word) transcription
Observations made by researcher, e.g. diagram showing seating, intonation of speakers,
description of system, etc.
5.0 Conclusion
We cannot but transcribe data into appropriate format for system analysis. The choice of
transcription method adopted is mostly dependent on the system being investigated. Care
therefore must be exercised in selecting coding level especially for qualitative data.
6.0 Summary
In this unit data coding and Screening, we:
defined data coding as a systematic way used to condense extensive data-sets into smaller
analyzable units through the creation of categories and concepts derived from the data
explained why we have to code data,
listed the uses of data screening
explained Code determination of codes, why and the need for creating code book
discussed mixed coding method and listed its advantages and disadvantages
discussed outliers and how it can be handle in data analysis
7.0 Further Readings
Gamerman, D., & Lopes, H. F. (2006). Markov chain Monte Carlo: Stochastic simulation for
Bayesian inference. Boca Raton: Chapman & Hall/CRC.
Graham, C., & Talay, D. (2015). Stochastic Simulation and Monte Carlo Methods
Mathematical Foundations of Stochastic Simulation. Berlin: Springer Berlin Heidelberg.
Mai, J., Scherer, M., & Czado, C. (2017). Simulating copulas: Stochastic models, sampling
algorithms, and applications. New Jersey: World Scientific Publishing.
Nelson, B. (2015). Foundations and methods of stochastic simulation: A first course. Place
of publication not identified: Springer.
Kozachenko, Y., Pogorilyak, O., Rozora, I., & Tegza, A. (2016). Simulation of stochastic
processes with given accuracy and reliability. London: ISTE Press.
Cochard, G. (2019). Introduction to stochastic processes and simulation. London, UK: ISTE.
Rao, C. R., & Shanbhag, D. N. (2007). Stochastic processes: Modelling and simulation.
Amsterdam: Elsevier.
Gallager, R. G. (2017). Stochastic Processes: Theory for Applications. Cambridge, United
Kingdom: Cambridge University Press.
Jones, P. W., & Smith, P. (2018). Stochastic processes: An introduction. Boca Raton (Fla.):
Chapman & Hall/CRC.