You are on page 1of 41

Vishal Mishra (IBS, Hyderabad)

Random Variables : Basics

Experiment (a process that results in well defined outcomes)


Trial
Outcome
Sample Space
Event
Vishal Mishra (IBS, Hyderabad)

Random Variables
Definition: A random variables is used to numerically describe the outcomes of an experiment.
Experiment, Outcomes, Random Variable

Types of random variables:


Discrete: Finite number of values OR an infinite sequence of values (countably infinite)
Example: Tossing a coin 3 times (Number of heads), Inspecting the traffic at a
ticket/sales counter (Number of customers arriving in peak hour)

Continuous: Any possible numerical value


Example: Inspecting the traffic at a ticket/sales counter (Time between
arrivals), Customer servicing (Time for complaint resolution), Manufacturing
of a bulb (QC- life of a bulb in hrs)
Vishal Mishra (IBS, Hyderabad)

Random Variables

Experiment Example of a random variable

Attending classes
Playing matches in a tournament
Participating in 100 m sprint
Operations of a company
Watching Movies
Vishal Mishra (IBS, Hyderabad)

Random Variables

Experiment Random variable

Attending classes No. of classes attended


Playing matches in a tournament No. of wins
Participating in 100 m sprint Time taken to complete a race
Operations of a company Productivity of employees; Performance of Company
Watching Movies Preferred genres; Hours spent per week in watching
Vishal Mishra (IBS, Hyderabad)

Probability Concepts
Definition: Numerical measure of the chance of occurrence of an event.

Three approaches to Probability:


• Classical
• Relative Frequency
• Subjective

Key Characteristics of Probability:


0<= P(Ei) <= 1 where Ei is Event I, and P(Ei) is the probability of this event happening
∑ P(Ei) = 1 for all i
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
An arrangement/description that depicts/describes the values of a random
variables along with the probabilities associated with those values.

Discrete Probability Distribution (discrete random variable)

Continuous Probability Distribution (continuous random variable)

The characteristics of probability apply for probability distribution of a random


variable too. So, for a discrete probability distribution, if Xi denotes ith value of
the random variable X and f(Xi) denotes the probability of a specific value i.e. ith
value, then

0< = f(Xi) <= 1 and


∑ f(Xi) = 1
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Example:

Frequency & Relative Frequency Distribution

S. No. Colour Type Frequency Relative Frequency

1 Blue 10 0.3333

2 Red 14 0.4667

3 Green 6 0.2
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Example:

Relative Frequency Distribution S. No. Colour Type Relative Frequency

1 10 0.3333

2 20 0.4667

3 30 0.2

S. No. Colour Type Probability


Probability Distribution 1 10 0.3333
(Discrete/Continuous?)
2 20 0.4667
(Properties?)
3 30 0.2
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Example:
Class Intervals (Marks) Frequency Relative Frequency

Frequency/Relative Frequency Distribution 10 to 18 5 0.166666667


18 to 26 5 0.166666667
26 to 34 10 0.333333333
34 to 42 7 0.233333333
42 to 50 3 0.1

Class Intervals (Marks) Probability


10 to 18 0.166666667
Probability Distribution 18 to 26 0.166666667
(Discrete/Continuous?) 26 to 34 0.333333333
(Properties?) 34 to 42 0.233333333
42 to 50 0.1
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Example: An urban survey of 1000 households of a metropolitan city for studying the number
of motor vehicles owned by a household Number of Vehicles Probability
0 0.15
(Discrete/Continuous?) 1 0.3
(Properties?) 2 0.25
3 0.2
4 0.1
Example: A study (of 50 workers ) to assess time taken for assembling a desktop computer in a
factory.
Time Taken (hour) Probability
<1 0.25
(Discrete/Continuous?) 1-2 0.45
(Properties?) 2-3 0.25
>3 0.05
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Uniform Distribution

Binomial Distribution

Poisson Distribution
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Uniform Distribution: When an experiment result in outcomes that are finite and are equally
likely.

e.g. Toss of a fair coin (Outcome: Head/Tail), Throw of a fair dice (Outcome: face with one of
the value out of 1, 2, 3, 4, 5, 6).

Probability function is f(X) = 1/n ; where n is the number of possible outcomes i.e.
the number of values, a random variable can take
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Uniform Distribution:

Probability function is f(X) = 1/n ; where n is the number of possible outcomes i.e.
the number of values, a random variable can take
X f(X)
Example: Number on the face of a fair dice 1 1/6
2 1/6
3 1/6
4 1/6
5 1/6
6 1/6
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Two key characteristics (parameters that describe a distribution)

Expected Value (Mean): E(X) = µ = ∑ [ Xi * f(Xi) ]

Variance: Var (X) = E(X - µ)2 = σ 2 = ∑ [ (Xi - µ) 2 * f(Xi) ]

Exercise: Calculate these values for the example of throw of a dice


Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Expected Value (Mean): E(X) = µ = [∑ Xi * f(Xi)]

X f(X) X * f(X) (X-Mean)2 (X-Mean)2 * f(X)


Variance: Var (X) = ∑ [(Xi - µ) 2 * f(Xi)]
1 1/6
2 1/6
Exercise: Calculate these values for the 3 1/6
example of a throw of a dice 4 1/6
5 1/6
6 1/6

Mean Variance
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:

Expected Value (Mean): E(X) = µ = ∑ [Xi * f(Xi)]

X f(X) X * f(X) (X-Mean)2 (X-Mean)2 * f(X)


Variance: Var (X) = ∑ [(Xi - µ) 2 * f(Xi)]
1 1/6 0.166667 6.25 1.041666667
2 1/6 0.333333 2.25 0.375
Exercise: Calculate these values for the 3 1/6 0.5 0.25 0.041666667
example of a throw of a dice 4 1/6 0.666667 0.25 0.041666667
5 1/6 0.833333 2.25 0.375
6 1/6 1 6.25 1.041666667

Mean 3.5 Variance 2.9167


Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Associated with an experiment consisting of a sequence of identical and independent


trials that result in two outcomes (for each trial) labelled as success and failure such
that the probability of success and failure is constant from one trial to the other.
Example: 4 tosses of a fair coin

If n= number of trials; p = probability of success on each trial (probability of failure = 1-p);


x = number of successes in n trials

Then probability of x successes in n trials is given by Probability function,

𝑛!
f(x) = * px * (1-p) (n-x)
𝑥! 𝑛−𝑥 !
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

𝑛!
f(x) = * px * (1-p) (n-x) ;
𝑥! 𝑛−𝑥 !

(Note: 1! = 0! =1) Where (n factorial OR factorial n), n! = n*(n-1)*(n-2)*(n-3)…

Probability function is also called as probability mass function for discrete distributions

Exercise 1: Computing factorial - Find out the value of 6! = 6*5*4*3*2*1 = 720


Exercise 2: Find the probability of 1 head in 4 tosses of a fair coin
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

we want to find the probability of 1 head in 4 tosses of a fair coin

Here n= 4; p = ½ = 0.5; x = 1

Then probability of x successes in n trials is given by Probability function,

4!
f(1) = * (0.5)1 * (0.5) (4-1) ;
1! 4−1 !

= 4 * 0.5 * 0.125
= 0.25
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Tree Diagram: Experiment of 4 tosses of a fair coin
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Tree Diagram: E.g., we want to find the probability of 1 head in 4 tosses of a fair coin

Total no. of
outcomes
= 16

Outcomes with
Only 1 head
=4

Probability = 4/16 = 0.25


Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Expected Value (Mean) : E(X) = µ = n * p

Variance: Var (X) = E(X - µ)2 = σ 2= n* p * (1-p)

For the earlier example, if the outcome of interest is the number of heads

mean (no. of heads in 4 tosses) = 4 * 0.5 = 2


variance (no. of heads in 4 tosses ) = 4 * 0.5 *0.5 = 1
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Experiment is Four tosses of a fair coin, Outcome of interest is head

Problem: Using the original formulas for mean (E.V) and variance of a distribution find
out the mean and variance of the distribution in the above experiment

Expected Value: E(X) = µ = ∑ [Xi * f(Xi)]

Variance: Var (X) = E(X - µ)2 = σ 2 = ∑ [(Xi - µ) 2 * f(Xi)]


Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Experiment is Four tosses of a fair coin, Outcome of interest is head (i.e., random
variable is the number of heads)
x (no. of heads) Probability, f(x)

0
Expected Value: E(X) = µ
1
Variance: Var (X) = E(X - µ)2 = σ 2
2

4
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Experiment is Four tosses of a fair coin, Outcome of interest is head

x (no. of heads) Probability, f(x)

E(X) = µ = ∑ [Xi * f(Xi)] 0 0.0625

1 0.25
Var (X) = E(X - µ)2 = σ 2 = ∑ [(Xi - µ) 2 * f(Xi)]
2 0.375

3 0.25

4 0.0625
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Experiment is Four tosses of a fair coin, Outcome of interest is head

x (no. of
heads) Probability, f(x) x * f(x) (x-Mean)2 (x-Mean)2 * f(x)
E(X) = µ = ∑ [Xi * f(Xi)] 0 0.0625
1 0.25
Var (X) = E(X - µ)2 = σ 2 2 0.375

= ∑ [(Xi - µ) 2 * f(Xi)] 3 0.25


4 0.0625

Mean Variance
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Graphical representation of probability distribution (Experiment is Four tosses
of a fair coin, Outcome of interest is head)
x (no. of heads) Probability, f(x)
f(x) (Probability)
0.4
0 0.0625
0.35

0.3
1 0.25
0.25

0.2 2 0.375
0.15

0.1 3 0.25
0.05

0
4 0.0625
0 1 2 3 4
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Practice Problem: In a throw of a fair dice, one is interested in the outcome of an even
number. What is the probability that in 10 throws we will get an even number i) 2 times ii) 8
times iii) at least 3 times?
What is the probability that we will get an odd number iv) 2 times v) less than 2 times vi) at the
most 2 times vii) at least 2 times?

n=10; p=0.5

vii. f(x<2) + f(x>=2)= 1; ∑ f(x) = 1


Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions:Binomial Probability Distribution:
Solution:
p=0.5(for getting an even number), n=10

i) f(x=2) = 0.0439
ii) f(x=8) = 0.0439

iii) f(x>=3) = f(x=3) + f(x=4) +…+ f(x=10)


= 1 – [f(x=0)+f(x=1)+f(x=2)] = 1-0.0547 = 0.9453

(Since, ∑ f(Xi) = 1 i.e., f(x=0)+f(x=1)+f(x=2)+f(x=3)+f(x=4)+….+f(x=9)+f(x=10) = 1


[f(x=3)+f(x=4)+…+f(x=9) + f(x=10)] = 1 – [f(x=0)+f(x=1)+f(x=2)]
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:
Solution:
P=0.5 (for getting an odd number), n=10

iv) f(x=2) = 0.0439

v) f(x<2) = [f(x=0)+f(x=1)] = 0.0108


Note: This can also be written and calculated as 1 – f(x>=2), since f(x<2) + f(x>=2) = 1
as ∑ f(Xi) = 1

vi) f(x<=2) = f(x=0)+f(x=1) + f(x=2) = 0.0108 + 0.0439 = 0.0547


vii) f(>=2) = f(x=2) + f (x=3) + … + f(x=10) = 1 – [f(x=0)+f(x=1)] = 1- 0.0108 = 0.9892
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Binomial Probability Distribution:

Practice Problem : In a city 25% of the people use metro train. From a random sample of 12
people what is the probability that i). exactly 8 people use the metro ii). less than 2 people use
the metro
f(x=8)
f(x<2) = f(x=0) + f(x=1)

Practice Problem : A machine at a production plant for the manufacturing of electrical motor
produces 2% defective parts. If 25 parts are selected randomly what is the probability that i) 1
part is defective ii). More than 5 parts are defective iii). At least 3 parts are defective?
p=0.02, n=25
f((x=1); f(x>5) = 1 – f(x<=5)
f(x>=3) = 1- f(x<3)
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Associated with an experiment where one is interested in number of occurrences in an


interval (of time and space) such that the probability of an occurrence is same for the
intervals of same length, occurrence/non-occurrence in any interval is independent of the
occurrence/non-occurrence in another interval.

Example: no. of cars passing through a signal in a given hour; no. of telephone calls in a given
duration at a call centre

If µ = mean number of occurrences (observed from the past data) and x = number of
occurrences in an interval
Then probability of x occurrences

f(x) = (e-µ * µx) / x! where e (a mathematical constant)


= 2.71828
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Problem: Consider visitors on a web-site during sale hours. if past data indicates that the mean
number of such visitors in a given minute is 7, what is the probability of 10 visitors landing on
the web-site during a minute during sale hours? (Assume that such visits follow a Poisson
distribution)
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Problem: Consider visitors on a web-site during sale hours. if past data indicates that the mean
number of such visitors in a given minute is 7, what is the probability of 10 visitors landing on
the web-site during a minute during sale hours? (Assume that such visits follow a Poisson
distribution)

Here µ = 7, x = 10
Then Poisson probability of 10 visitors
f(10) = (e-7 * 710) / 10!
= 0.071
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:
Consider visitors on a web-site during sale hours. if past data indicates that the number of such
visitors in a given minute is 7, what is the probability of 10 visitors landing on the web-site
during a minute during sale hours? (Assuming that such visits follow a Poisson distribution)

f(x) (Probability)
Graphical representation 0.16

0.14

0.12

0.1

0.08

0.06

0.04

0.02

0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 25
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Mean and Variance are same for Poisson distribution

Expected Value (Mean) : E(X) = µ = Variance, Var (X)

Problem: Past data shows that phone calls arrive at a call centre at the rate of 36 per hour. Find out

- The probability of receiving 45 calls per hour


- The probability of receiving 4 calls in a five minute interval
- The probability of receiving at least 4 calls in a five minute interval
- The probability of receiving at most 3 calls in a five minute interval
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Problem: Past data shows that phone calls arrive at a call centre at the rate of 36 per hour. Find
out

- The probability of receiving 45 calls per hour (mean = 36) : f(X=45) = 0.021

- (36 calls per hour = 36 calls in 60 minutes. In 60 minutes there are 36 calls, thus, using
unitary method no. of calls in 5 minutes = (36*5)/60 = 3)

The probability of receiving 4 calls in a five minute interval (mean = 3) : f(X=4) = 0.168
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

(Since, f(x=0)+f(x=1)+f(x=2)+f(x=3)+f(x=4) + ……..+ = 1)

f(X>= 4) = 1 – f(x<4) = 1 – [f(x=0)+f(x=1)+f(x=2)+f(x=3)]

- The probability of receiving at least 4 calls in a five minute interval (mean = 3) : f(X>= 4) =
0.3528

- The probability of receiving at most 3 calls in a five minute interval (mean = 3) : f(X<=3) =
f(x=0)+f(x=1)+f(x=2)+f(x=3) = 0.6472
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Practice Problem: Past data indicates that the mean number of vehicles passing through a
signal during a minute is 5. If the occurrence of the vehicles follows Poisson distribution then
what is the probability that 10 vehicles will pass in 2 minute through that signal.
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Practice Problem: Past data indicates that the mean number of vehicles passing through a
signal during a minute is 5. If the occurrence of the vehicles follows Poisson distribution then
what is the probability that 10 vehicles will pass in 2 minute through that signal.

Solution: µ = 10, x = 10
f(x = 10) = (e-10 * 1010) / 10! = 0.1251
Vishal Mishra (IBS, Hyderabad)

Probability Distributions
Discrete Probability Distributions: Poisson Probability Distribution:

Practice Problem: The average number of customer calls at a call centre during a 30 second
duration is 3. If the calls follow a Poisson distribution then what is the probability that 5 calls
will come in a 2-minute duration. What about more than 3 calls?

mean=?
f(x = 5)
f(x>3) = 1- f(x<=3)

You might also like