0% found this document useful (0 votes)
53 views68 pages

CLass 4 Random Variable

The document provides an overview of random variables and probability distributions. It defines random variables and gives examples of defining random variables for coin flips and dice rolls. It also defines key probability concepts like probability mass functions, cumulative distribution functions, expectation, moments, variance, standard deviation, and binomial distributions.

Uploaded by

shrey patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views68 pages

CLass 4 Random Variable

The document provides an overview of random variables and probability distributions. It defines random variables and gives examples of defining random variables for coin flips and dice rolls. It also defines key probability concepts like probability mass functions, cumulative distribution functions, expectation, moments, variance, standard deviation, and binomial distributions.

Uploaded by

shrey patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 68

CA714: Lecture 2.

1 Random Variables
and Probability Distributions

Source. Prof Stanley Chan., Purdue University


1 / 22
Probabilistic model
Example 1: Let us flip a
coin.
“probability of getting a
head” = P[“Head”]
...
Easy!

Exampl
e 2: Let
us flip 3
coins.
“pro
babi
lity
of
gett ©Stanley Chan 2020. All Rights Reserved.
2 / 12
Everything you need to know about a random
variable
Question: What are random variables?
Answer: Random variables are functions that translate words to
numbers.
Example: “Head” is a word description. “X = 1” is numerical
description.

Figure: Illustration of a random


variable.
©Stanley Chan 2020. All Rights Reserved.
3 / 12
The formal definition

Definition
A random variable X is a function X : Ω → R that maps an
outcome
ξ ∈ Ω to a number X (ξ) on the real line.

Why need Random


Variable? Coin flip:
Head or Tail Alphabet:
a, b, c, ..., z
We want to map these
outcomes to numbers.
Random variables are functions that translate words to
numbers!
©Stanley Chan 2020. All Rights Reserved.
4 / 12
Example

Flip a coin 2 times. The


sample space Ω is

Ω=
{(HH),
(HT),
(TH),
(TT)}.

Four events ξ1 = HH, ξ2 = HT, ξ3 = TH, ξ4 = TT.


Then,
X = number of H.
X (ξ1) = # of heads in {HH} = 2
X (ξ2) = # of heads in {HT} = 1 ©Stanley Chan 2020. All Rights Reserved.
5 / 12
The inverse mapping

When calculating the probability, go backward to the sample


space!

©Stanley Chan 2020. All Rights Reserved.


6 / 12
Example 1

©Stanley Chan 2020. All Rights Reserved.


7 / 12
Example

©Stanley Chan 2020. All Rights Reserved.


8 / 12
Probability Distributions

Definition : Probability distribution (probability mass function)-pmf


A probability distribution is a definition of probabilities of the values of
random variable x . A probability distribution must satisfy the following
conditions:

In Words In Symbols

1. The probability of each value of 0  P (x)  1


the discrete random variable is
between 0 and 1, inclusive.

2. The sum of all the probabilities is ΣP (x) = 1


1.
Probability Distributions (pmf)
Probability Distributions (pmf)
Graphing a Discrete Probability Distribution

Example:
Graph the following probability distribution using a histogram.
x P (x) P(x
2 0.0625 0.6 )
3 0.375
0.5
4 0.5625
0.4
Probability

0.3

0.2

0.1
0
x
2 3 4
X
Graphing a Discrete Probability Distribution

Example:
Graph the following probability distribution using a histogram.
x P (x) P(x
2 0.0625 0.6 )
3 0.375
0.5
4 0.5625
0.4
Probability

0.3

0.2

0.1
0
x
2 3 4
X
Cumulative Distribution Functions (Discrete)
Example
Exercise

Given the CDF F(x) for the discrete random variable X, Find:
(a) P(X = 3) (b) P(X > 2) (c) P(X)
Expectation (Mean)

The mean of a discrete random variable is given by


μ = E[X]= ΣxP(x).
Each value of x is multiplied by its corresponding probability and
the products are added.

Example:
Find the mean of the probability distribution for the sum of the two
spins.
x P (x) xP (x)
2 0.0625 2(0.0625) = 0.125 ΣxP(x) = 3.5
3 0.375 3(0.375) = 1.125
The mean of X is
4 0.5625 4(0.5625) = 2.25 3.5.
Moments and Variance

The Kth moment of a discrete random variable is given by


E[Xk]= Σx kP (x).

The variance of a discrete random variable is given by


Var(X) = 2 = E[(X– μ)2 ]= Σ(x – μ)2P (x).
= E[X2] – E[X]2
Moments and Variance

Example:
Find the variance of the probability distribution for X. The mean
is 3.5.

x P (x) x–μ (x – μ)2 P (x)(x – μ)2 ΣP(x)(x – 3.5)2


2 0.0625 –1.5 2.25  0.141  0.376
3 0.375 –0.5 0.25  0.094
The variance of X is
4 0.5625 0.5 0.25  0.141
approximately 0.376
Example
Exercise

Assume that the pair of dice is thrown and the random variable X is
the sum of numbers that appears on two dice. Find the mean or the
expectation of the random variable X which is the sum of numbers
that appear on two dice.
Exercise
Assume that the pair of dice is thrown and the random variable X is the
sum of numbers that appears on two dice. Find the probability distribution
and the mean or the expectation of the random variable X

Solution:
If two dice are thrown, then the total number of sample spaces
obtained is 36.
Given that, the random variable X is the sum of numbers that appear
on two dice, such as 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 or 12.

E[X]= 2(1/36) + 3(2/36) + 4(3/36) + 5(4/36) + 6(5/36) + 7(6/36) + 8(5/36) +


9(4/36) + 10(3/36) + 11(2/36) + 12(1/36)
= (2+6+12+20+30+42+40+36+30+22+12)/36
=7
Standard Deviation

The standard deviation of a discrete random variable is given by

σ = σ 2.

Example:
Find the standard deviation of the probability distribution for X.
The variance is 0.376.
σ  σ2
x P (x) x–μ (x – μ)2 P (x)(x – μ)2
 0.376  0.613
2 0.0625 –1.5 2.25 0.141
3 0.375 –0.5 0.25 0.094 Most of the values
differ from the mean
4 0.5625 0.5 0.25 0.141 by no more than 0.6
points.
Binomial
Distributions
Binomial Experiments

A binomial experiment is a probability experiment that


satisfies the following conditions.

1. The experiment is repeated for a fixed number of trials, where


each trial is independent of other trials.
2. There are only two possible outcomes of interest for each
trial. The outcomes can be classified as a success (S) or
as a failure (F).
3. The probability of a success P (S) is the same for each
trial.
4. The random variable x counts the number of successful
trials.
Notation for Binomial Experiments

Symbol Description

n The number of times a trial is repeated.

p = P (S) The probability of success in a single trial.


q = P (F) The probability of failure in a single trial. (q =
1 – p)

x The random variable represents a count of the


number of successes in n trials: x = 0, 1, 2,
3, … , n.
Binomial Experiments

Example:
Decide whether the experiment is a binomial experiment. If it is,
specify the values of n, p, and q, and list the possible values of the
random variable x. If it is not a binomial experiment, explain why.

• You roll a die 10 times and note the number the die lands
on.

This is not a binomial experiment. While each trial (roll) is


independent, there are more than two possible outcomes: 1, 2,
3, 4, 5, and 6.
Binomial Probability Formula

In a binomial experiment, the probability of exactly x successes in


n trials is
n!
P (x )  nC x p x q n  x  p x q n x .
(n  x )! x !
Example:
A bag contains 10 chips. 3 of the chips are red, 5 of the chips are
white, and 2 of the chips are blue. Three chips are selected, with
replacement. Find the probability that you select exactly one red
chip. 3
p = the probability of selecting a red chip   0.3
10
q = 1 – p = 0.7 P (1)  3C 1(0.3)1(0.7)2
n=3  3(0.3)(0.49)
x=1  0.441
Binomial Probability Distribution

Example:
A bag contains 10 chips. 3 of the chips are red, 5 of the chips are
white, and 2 of the chips are blue. Four chips are selected, with
replacement. Create a probability distribution for the number of red
chips selected.
3
p = the probability of selecting a red chip   0.3
10
q = 1 – p = 0.7
n=4 x P (x)
x = 0, 1, 2, 3, 4 0 0.240
The binomial
1 0.412 probability
2 0.265 formula is used
3 0.076 to find each
4 0.008 probability.
Finding Probabilities

Example:
The following probability distribution represents the probability of
selecting 0, 1, 2, 3, or 4 red chips when 4 chips are selected.
x P (x) a.) Find the probability of selecting no
0 0.24
more than 3 red chips.
1 0.412
2 0.265
3 0.076 b.) Find the probability of selecting
4 0.008 at least 1 red chip.
a.) P (no more than 3) = P (x  3) = P (0) + P (1) + P (2) + P (3)
= 0.24 + 0.412 + 0.265 + 0.076 = 0.993
b.) P (at least 1) = P (x  1) = 1 – P (0) = 1 – 0.24 = 0.76
Complement
Binomial Probability Distribution
Exercise

It is known that screws produced by a certain machine will be


defective with probability 0.01 independently of each other. If we
randomly pick 10 screws produced by this machine, what is the
probability that at least two screws will be defective?
Binomial Probability Distribution

Solution
Let X be the number of defective screws out of 10.
Then X can be considered as a binomial r.v. with
parameters (10, 0.01). Hence, using the binomial pf p(x), we
obtain
Mean, Variance and Standard Deviation

Population Parameters of a Binomial Distribution


Mean: μ  n p
Variance: σ 2  n pq
Standard deviation: σ  n pq
Example:
One out of 5 students at a local college say that they skip breakfast
in the morning. Find the mean, variance and standard deviation if 10
students are randomly selected.
n  10 μ  np σ 2  n pq σ  n pq
1
p   0.2  10(0.2)  (10)(0.2)(0.8)  1.6
5
q  0.8 2  1.6  1.3
Poisson Distribution
The Poisson distribution is a discrete probability distribution of a
random variable x that satisfies the following conditions.

1. The experiment consists of counting the number of times an event,


x, occurs in a given interval. The interval can be an interval of
time, area, or volume.
2. The probability of the event occurring is the same for each interval.
3. The number of occurrences in one interval is independent of
the number of occurrences in other intervals.

The probability of exactly x occurrences in an interval is


μ x e μ
P (x ) 
x!
where e  2.71818 and μ is the mean number of occurrences.
Poisson Distribution

Example:
The mean of number of students failed per year in a particular
subject is 4. Find the probability that in a given year,
a.) there are exactly 3 students failed,
b.) there are more than 3 students failed.
a .)   4, x  3 b.) P (m or e t h a n 3)
 1  P (x  3)
3 -4
4 (2.71828)
P (3)   1  [P (3)  P (2) + P (1) + P (0)]
3!

 0.195  1  (0.195  0.147  0.073  0.018)


 0.567
Poisson Distribution

Exercise:
As only 3 students came to attend the class today, find the
probability for exactly 4 students to attend the classes tomorrow
Poisson Distribution

Solution

Also, Find Probability distribution of number of students to


attend the classes tomorrow, CDF(4), F(4).
More Discrete
Probability
Distributions
Geometric Distribution
A geometric distribution is a discrete probability
distribution of a random variable x that satisfies the
following conditions.

1. A trial is repeated until a success occurs.


2. The repeated trials are independent of each other.
3. The probability of a success p is constant for each
trial.

The probability that the first success will occur on trial x is


P (x) = p(q)x – 1, where q = 1 – p.
Geometric Distribution

Example:
A fast food chain puts a winning game piece on every fifth
package of French fries. Find the probability that you will win a
prize,
a.) with your third purchase of French fries,
b.) with your third or fourth purchase of French fries.
p = 0.20 q = 0.80
a.) x = 3 b.) x = 3, 4
P (3) = (0.2)(0.8)3 – 1 P (3 or 4) = P (3) + P (4)
= (0.2)(0.8)2  0.128 + 0.102
= (0.2)(0.64)  0.230
= 0.128
More exercises

(a) Assume that the pair of dice is thrown and the random variable X
is the sum of numbers that appears on two dice. Find the
Probability distribution, CDF of the random variable X which is
the even number on the first die.

(b) If a person is throwing dice and will stop once he gets 5,


Find P(x), where x is the number of trials, the expected
number of times he would get 5 in four trials, Var(x) in four
trials. (Geometric distribution)
Solution

If a person is throwing dice and will stop once he gets 5,


Find P(x), where x is the number of trials, the expected
number of times he would get 5 in four trials, Var(x) in four
trials. (Geometric distribution)
Solution:
the probability of success p =
Continuous Random Variables
and
Probability Distributions

Source. Prof Stanley Chan., Purdue University


43 / 22
Continuous Random Variable
Continuous Probability Distributions
Continuous Probability Distributions
Continuous Probability Distributions

Note: e power 0 is 1 and power


infinity is 0
Exercise
Exercise-solution
Continuous Probability Distributions
Exercise

Calculate F(x) and


Exercise- solution

If F(x) = x2 , what is f(x)?


Expectation, Moment and Variance
Expectation, Moment and Variance
Example
Example
Uniform Random Variable and Its distribution
Cumulative Distribution Function
Exponential Random Variable and Its distribution
Exponential Random Variable
Image Processing (Pixels Distribution)
Histogram Equalization

(a) A face image


from the CALTECH
face database, (b) its
histogram, (c) the
equalized face
image using HE, (d)
and its respective
histogram.
Gaussian (Normal) Random Variable
Gaussian (Normal) Random Variable
Standard Gaussian (Normal) Random Variable
Gaussian image( Blurring)

σ controls smoothing
Gaussian image( Blurring or smoothing)
Questions?

©Stanley Chan 2020. All Rights Reserved.


68 / 12

You might also like