Probability and Statistics
Dr. Faisal Bukhari
Punjab University College of Information Technology
(PUCIT)
Textbook
Probability & Statistics for Engineers & Scientists,
Ninth Edition, Ronald E. Walpole, Raymond H. Myer
Dr. Faisal Bukhari, PUCIT, PU, Lahore 2
Reference books
❑Probability Demystified, Allan G. Bluman
❑Schaum's Outline of Probability and Statistics
❑MATLAB Primer, Seventh Edition
❑MATLAB Demystified by McMahon, David
Dr. Faisal Bukhari, PUCIT, PU, Lahore 3
Distribution of marks
❑Mid term = 35 points
❑Final term = 40 points
❑Sessional marks = 25 points
I. Assignments = 4 × 1 = 4 points
II. Quizzes = 6 × 2 = 12 points
III. A survey based project (in IEEE conference
paper format) = 9 points
Dr. Faisal Bukhari, PUCIT, PU, Lahore 4
References
Readings for these lecture notes:
❑Probability & Statistics for Engineers & Scientists, Ninth
Edition, Ronald E. Walpole, Raymond H. Myer
❑ Probability Demystified, Allan G. Bluman
❑ Practical Statistics for Data Scientists: 50 Essential
Concepts, Peter Bruce and Andrew Bruce
❑ https://www.mymarketresearchmethods.com/types-of-
data-nominal-ordinal-interval-ratio/
❑http://www.thefreedictionary.com/statistics
These notes contain material from the above three
resources.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 5
Basic concepts [1]
Statistics is defined as
“The mathematics of the collection, organization, and
interpretation of numerical data, especially the analysis
of population characteristics by inference from sampling”
OR
Statistics is a science which deals with collection,
classification, distribution and interpretation of data.
OR
Statistics is a science of uncertainty.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 6
Basic concepts [2]
❑In the study of statistics, we are concerned
basically with the presentation and interpretation
of chance outcomes that occur in a planned study
or scientific investigation.
❑The statistician is often dealing with either
numerical data, representing counts or
measurements, or categorical data, which can be
classified according to some criterion.
❑Any recording of information, whether it be
numerical or categorical is considered as an
observation. Dr. Faisal Bukhari, PUCIT, PU, Lahore 7
Basic concepts [3]
❑The numbers 2, 0, 1, and 2, representing the
number of accidents that occurred for each month
from January through April during the past year at
the intersection of Driftwood Lane and Royal Oak
Drive, constitute a set of observations
❑Similarly, the categorical data N, D, N, N, and D,
representing the items found to be defective or
non-defective when five items are inspected, are
recorded as observations.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 8
Key Terms for Data Types
❑Continuous
• Data that can take on any value in an interval.
• Synonyms: interval, float, numeric
❑Discrete
• Data that can only take on integer values, such as
counts.
• Synonyms: integer, count
Dr. Faisal Bukhari, PUCIT, PU, Lahore 9
Key Terms for Data Types
❑Categorical
• Data that can only take on a specific set of
values.
• Example: Sex, type of chocolate, color
• Synonyms: enums, enumerated, factors, nominal,
polychotomous
❑Binary
• A special case of categorical with just two
categories (0/1, True, False).
• Synonyms: dichotomous, logical, indicator
❑Ordinal
• Categorical data that has an explicit ordering.
• Synonyms: ordered factor
Dr. Faisal Bukhari, PUCIT, PU, Lahore 10
Data Types
❑Binary data is an important special case of
categorical data that takes on only one of two
values, such as 0/1, yes/no or true/false.
❑Another useful type of categorical data is ordinal
data in which the categories are ordered; an
example of this is a numerical rating (1, 2, 3, 4, or 5)
Dr. Faisal Bukhari, PUCIT, PU, Lahore 11
Data Types
❑There are two basic types of structured data:
numeric and categorical.
❑Numeric data comes in two forms: continuous,
such as wind speed or time duration, and discrete,
such as the count of the occurrence of an event.
❑Categorical data takes only a fixed set of values,
such as a type of TV screen (plasma, LCD, LED, …) or
a state name (Alabama, Alaska, …).
Dr. Faisal Bukhari, PUCIT, PU, Lahore 12
Nominal scales
oNominal scales are used for labeling variables, without any
quantitative value.
o “Nominal” scales could simply be called “labels.”
o Here are some examples, below. Notice that all of these
scales are mutually exclusive (no overlap) and none of them
have any numerical significance.
o A good way to remember all of this is that “nominal”
sounds a lot like “name” and nominal scales are kind of like
“names” or labels.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 13
Nominal scale example
oType of chocolate
• Dark(1)
• Milk(2)
• White (3)
oSex
• Male(0)
• Female(1)
oColor
• Red(1)
• Green(2)
• Blue(3)
• Yellow(4)
Dr. Faisal Bukhari, PUCIT, PU, Lahore 14
Ordinal scale
oWith ordinal scales, it is the order of the values is what’s
important and significant, but the differences between each
one is not really known.
oTake a look at the example on below. In each case, we know
that option 4 is better than option 3 or option 2, but we
don’t know–and cannot quantify–how much better it is.
o For example, is the difference between “OK” and
“Unhappy” the same as the difference between “Very
Happy” and “Happy” ? We can’t say.
oOrdinal scales are typically measures of non-numeric
concepts like satisfaction, happiness, discomfort, etc.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 15
Ordinal scale example
o“Ordinal” is easy to remember because is sounds like
“order” and that’s the key to remember with “ordinal
scales”–it is the order that matters, but that’s all you really
get from these.
oAdvanced note: The best way to determine central
tendency on a set of ordinal data is to use the mode or
median; the mean cannot be defined from an ordinal set.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 16
Key Ideas
❑Data are typically classified in software by their
type
❑Data types include continuous, discrete,
categorical (which includes binary), and ordinal
❑Data-typing in software acts as a signal to the
software on how to process the data
Dr. Faisal Bukhari, PUCIT, PU, Lahore 17
Basic concepts [4]
❑Probability can be defined as the mathematics of
chance.
❑Statisticians use the word experiment to describe
any process that generates a set of data.
OR
❑A probability experiment is a chance process that
leads to well defined outcomes or results. For
example, tossing a coin can be considered a
probability experiment since there are two well-
defined outcomes—heads and tails.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 18
Basic concepts [5]
❑An outcome of a probability experiment is the
result of a single trial of a probability experiment.
❑A trial means flipping a coin once, or drawing a
single card from a deck. A trial could also mean
rolling two dice at once, tossing three coins at once,
or drawing five cards from a deck at once.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 19
Basic concepts [6]
❑The set of all possible outcomes of a statistical
experiment is called the sample space and is
represented by the symbol S.
OR
❑The set of all outcomes of a probability experiment is
called a sample space. Some sample spaces for various
probability experiments are shown here.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 20
Basic concepts [7]
❑Each outcome in a sample space is called an
element or a member of the sample space, or
simply a sample point.
❑Each outcome of a probability experiment occurs at
random.
❑Each outcome of the experiment is equally likely
unless otherwise stated.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 21
Basic concepts [8]
❑An event then usually consists of one or more
outcomes of the sample space.
OR
❑ An event is a subset of a sample space.
❑An event with one outcome is called a simple
event.
❑An event consists of two or more outcomes, it is
called a compound event.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 22
Example
A single die is rolled. List the outcomes in each event:
a. Getting an odd number
b. Getting a number greater than four
c. Getting less than one
Dr. Faisal Bukhari, PUCIT, PU, Lahore 23
Example cont.
SOLUTION:
S = {1, 2, 3, 4, 5, 6}
a. Let A be the event contains the outcomes 1, 3,
and 5.
A = {1, 3, 5}, n(A) = 3
b. Let B be the event contains the outcomes 5, and
6.
B = {5, 6}, n(B) = 2
c. Let C be the event that contains a number less
than one
C = {}
Dr. Faisal Bukhari, PUCIT, PU, Lahore 24
Basic concepts [8]
Classical Probability:
The formula for determining the probability of an event
E is
n(E)
P(E) =
n(S)
OR
Number of outcomes contained in the event E
P(E) =
Total number of outcomes in the sample space
Dr. Faisal Bukhari, PUCIT, PU, Lahore 25
Example:
Two coins are tossed; find the probability that both
coins land heads up.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 26
SOLUTION:
S = {HH, HT, TH, and TT}
n(S) = 4
Let A be the event of getting a both heads
A = {HH}
n(A) = 1
P (A) = ¼ = 0.25 (or 25 %)
Dr. Faisal Bukhari, PUCIT, PU, Lahore 27
Example:
A die is tossed; find the probability of each event:
a. Getting a two
b. Getting an even number
c. Getting a number less than 5
Dr. Faisal Bukhari, PUCIT, PU, Lahore 28
Example cont.
SOLUTION:
S = {1, 2, 3, 4, 5, 6}
n(S) = 6
Number of outcomes contained in the event E
P(E) =
Total number of outcomes in the sample space
a. Let A be the event of getting a “two”
A ={2}
n(A) = 1
P (A) = 1Τ6 = 0.1667 (or 16.67%)
Dr. Faisal Bukhari, PUCIT, PU, Lahore 29
Example cont.
b. a. Let B be the event of getting a “even number”
A = {2, 4, 6}
n(A) = 3
P (B) = 3Τ6 = 1Τ2 = 0.5 (or 50%)
c. a. Let C be the event of getting a “less than 5”
C= {1, 2, 3, 4}
n(C) = 4
P (C) = 4Τ6 = 2Τ3 = 0.6666 (or 66.67%)
Dr. Faisal Bukhari, PUCIT, PU, Lahore 30
Basic concepts [9]
Rule 1: The probability of any event will always be a
number from zero to one. Probabilities cannot be
negative nor can they be greater than one.
Rule 2: When an event cannot occur, the probability
will be zero.
EXAMPLE: A die is rolled; find the probability of
getting a 7.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 31
Basic concepts [10]
Rule 3: When an event is certain to occur, the
probability is 1.
EXAMPLE: A die is rolled; find the probability of
getting a number less than 7.
Rule 4: The sum of the probabilities of all of the
outcomes in the sample space is 1.
EXAMPLE: P(H) = 1Τ2, P(T) = 1Τ2, P(H) + P(T) = 1.
Dr. Faisal Bukhari, PUCIT, PU, Lahore 32
Basic concepts [10]
Complement : The complement of an event A with
respect to S is the subset of all elements of S that are
not in A. We denote the complement of A by the
symbol A' or 𝑨ഥ or Ac
Rule 5: The probability that an event will not occur is
equal to 1 minus the probability that the event will
occur.
EXAMPLE: P(H) = 1Τ2, P(T) = 1- P(H) = 1Τ2
Dr. Faisal Bukhari, PUCIT, PU, Lahore 33
Suggested Readings
2.1 Sample space
2.2 Events
2.3 Counting Sample Points
Dr. Faisal Bukhari, PUCIT, PU, Lahore 34