0% found this document useful (0 votes)
3 views62 pages

STA107 Module 5 Random Variables

This document provides an overview of random variables, their definitions, and examples of their applications in various experiments. It distinguishes between discrete and continuous random variables, explains probability mass functions (pmf), and introduces the cumulative distribution function (CDF). The document also includes examples illustrating how to define random variables and calculate their probabilities.

Uploaded by

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

STA107 Module 5 Random Variables

This document provides an overview of random variables, their definitions, and examples of their applications in various experiments. It distinguishes between discrete and continuous random variables, explains probability mass functions (pmf), and introduces the cumulative distribution function (CDF). The document also includes examples illustrating how to define random variables and calculate their probabilities.

Uploaded by

waniakhankhan1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

STA107 – Module 5

Random Variables
Consider experiment of rolling 2 dice
• Sample space |S|= 62 = 36
• How do you define an event?
• List event’s sample points
E.g., A= {(3,1),(2,2),(1,3)}
• Describe the event
E.g., A= {“Sum of two rolls is 4”}
• Use a Random Variable
Common & practical way to describe
events and calculate their probability!

2
Random Variables
In any experiment, there are numerous characteristics that can be observed or measured, but in most
cases an experimenter will focus on some specific aspect or aspects of a sample.

For Example:

• In a study of commuting patterns in a metropolitan area, each individual in a sample might be asked
about commuting distance and the number of people commuting in the same vehicle.

• The General Social Survey (GSS) asks whether the sampled individuals are willing to pay higher prices
to protect the environment.

• The Canadian Community Health Survey (CCHS) asks whether the sampled individuals feel satisfied
with their life in general.

• Statistics Canada is interested in the number of people who live in a household.

3
Random Variables
• A Random Variable (RV) is a function from the sample space (S) to the real line (R)
• Essentially, a random variable assigns numbers to each outcome in S
• In Mathematical language, a random variable is a function whose domain is the sample space and
whose range is the set of real numbers.
• A variable because different numerical values are possible and random because the observed value
depends on which of the possible experimental outcomes results
• RVs are denoted by capital letters (usually X,Y, Z), and their values by lowercase letters
• E.g., the notation 𝑋(𝑆1 ) = 𝑎 means that a is the value associated with the outcome 𝑆1 by the r.v. X

4
Random Variables

5
Example #1
When a student calls a university help desk for technical support, they
will either immediately be able to speak to someone (S, for success) or
will be placed on hold (F, for failure).

With Ω = {𝑆, 𝐹}, define a random variable X by

𝑋 𝑆 = 1, 𝑋 𝐹 =0

The random variable X indicates whether (1) or not (0) the student can immediately speak to someone.

6
Example #2
Consider the experiment in which a telephone number in a certain area code is dialed
using a random number dialer (such devices are used extensively by polling organizations),
and define a random variable Y by

E.g., if 5282966 appears in the telephone directory, then Y(5282966) = 0,


whereas Y(7727350) = 1 tells us that the number 7727350 is unlisted.

7
Bernoulli Random Variable
In Examples #1 and #2, the only possible values of the random variable were 0 and 1.

Such a random variable arises frequently enough to be given a special name, after the individual who
first studied it.

Any random variable whose only possible values are 0 and 1 is called a Bernoulli random variable.

8
Example #3
Two gas stations are located at a certain intersection. Each one has six gas pumps.
Consider the experiment in which the number of pumps in use at a particular time of
day is observed for each of the stations.
• An experimental outcome specifies how many pumps are in use at the first station and
how many are in use at the second one.
• The 49 outcomes in S are displayed in the accompanying table.

9
Example #3

Define RVs X, Y, and U by

X = the total number of pumps in use at the two stations


Y = the difference between the number of pumps in use at station 1 and the number in use at station 2
U = the maximum of the numbers of pumps in use at the two stations

If this experiment is performed and s = (2, 3) results, then


X((2, 3)) = 2 + 3 = 5, so we say that the observed value of X was x = 5
Y((2, 3)) = 2 – 3 = -1, so we say that the observed value of Y was y = -1
10
U((2, 3)) = 3, and the observed value of U would be u = max(2, 3) = 3
Example #4
Consider an experiment in which 9-V batteries are examined until one with an acceptable
voltage (S) is obtained. The sample space is S = {S, FS, FFS, . . . }.

Define a random variable X by


X = the number of batteries examined before the experiment terminates

Then X(S) = 1, X(FS) = 2, X(FFS) = 3, . . ., X(FFFFFFS) = 7, and so on.

Any positive integer is a possible value of X, so the set of possible values is infinite.

11
Functions of Random Variables

12
Example
Flip 4 fair coins and define the RV X be the total number of Heads.

• What are the possible values X can take?

• Define Y = 4−X. How do you interpret new RV Y ?

13
Two Types of Random Variables

• Discrete Random Variable:


A discrete random variable is a random variable whose possible values constitute either a finite set or a
countably infinite set (e.g., the set of all integers, or the set of all positive integers).

• Continuous Random Variable:


A random variable is continuous if both of the following apply:
1. Its set of possible values consists either of all numbers in a single interval on the number line
(possibly infinite in extent, e.g., from −∞ to ∞) or all numbers in a disjoint union of such intervals
(e.g., [0, 10] ⋃ [20, 30]).
2. No possible value of the variable has positive probability, that is, P(X = c) = 0 for any possible value c.

14
Probability Distributions for Discrete Random Variables
When dealing with probabilities associated with random variables, it is often useful to have the following
representation in mind:

When probabilities are assigned to various outcomes in S, these in turn determine probabilities associated
with the values of any particular random variable X.

The probability distribution of X says how the total probability of 1 is distributed among (allocated to) the
various possible X values.

15
Probability Distribution of a Discrete Random Variable
The probability distribution or probability mass function (pmf) of a discrete random variable is
defined for every number x by

𝑝 𝑥 = 𝑃 𝑋 = 𝑥 = 𝑃(𝑎𝑙𝑙 𝑠 ∈ 𝑆: 𝑋 𝑠 = 𝑥)

In words, for every possible value x of the random variable, the pmf specifies the probability of observing
that value when the experiment is performed.

Note: The following conditions are required of any pmf:

• 𝑝 𝑥 ≥ 0 for all 𝑥
• σ𝑥 𝑝 𝑥 = 1, where the summation is over all possible x

Note: A probability mass function (pmf) is more simply called a probability function (pf).

16
Example # 1
Suppose we toss a coin three times and let X be the number of times that tails appear.
The sample space for this experiment is

Ω = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}

There are | Ω | = 23 = 8 sample points.

For the function X: Ω → ℝ we can write

X(HHH) = 0, X(HHT) = 1, X(HTH) = 1, X(HTT) = 2, X(THH) = 1, X(THT) = 2, X(TTH) = 2, X(TTT) = 3

0, 𝑖𝑓 𝑛𝑜 𝑡𝑎𝑖𝑙𝑠
1, 𝑖𝑓 1 𝑡𝑎𝑖𝑙
random variable 𝑋 =
2, 𝑖𝑓 𝑡𝑤𝑜 𝑡𝑎𝑖𝑙𝑠
3, 𝑖𝑓 𝑡ℎ𝑟𝑒𝑒 𝑡𝑎𝑖𝑙𝑠

17
Example # 1
In tabular form, mapping of the elementary events 𝜔 to 𝑋(𝜔) is summarized below

By taking into account that the eight elements of are equiprobable, we get

1
𝑃 𝑋 = 0 = 𝑝 𝜔 𝜖 Ω: 𝑋 𝜔 = 0 = 𝑃 𝐻𝐻𝐻 =
8
3
𝑃 𝑋 = 1 = 𝑝 𝜔 𝜖 Ω: 𝑋 𝜔 = 1 = 𝑃 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝑇𝐻𝐻 =
8
3
𝑃 𝑋 = 2 = 𝑝 𝜔 𝜖 Ω: 𝑋 𝜔 = 2 = 𝑃 𝐻𝑇𝑇, 𝑇𝐻𝑇, 𝑇𝑇𝐻 =
8
1
𝑃 𝑋 = 3 = 𝑝 𝜔 𝜖 Ω: 𝑋 𝜔 = 3 = 𝑃 𝑇𝑇𝑇 =
8

18
Example # 1
Visualizing pmf of X with a line graph

pmf of X is:

19
20
21
22
23
24
25
Example # 2

Suppose that two six-sided dice are rolled and the numbers appearing on the dice are observed.

The sample space S is given by

There are | 𝑆 | = 62 = 36 sample points.

26
Example # 2

If in rolling two fair dice, X is the sum, then X can only assume the values 2, 3, 4, . . . , 12

• Map outcomes to reals according to X

27
Example # 2
If in rolling two fair dice, X is the sum, then X can only assume the values 2, 3, 4, . . . , 12
with the following probabilities:

1
𝑃 𝑋 = 2 = 𝑃 (1,1) =
36
2
𝑃 𝑋=3 =𝑃 1,2 , (2,1) =
36
3
𝑃 𝑋=4 =𝑃 1,3 , 2,2 , (3,1) =
36

1
𝑃 𝑋 = 12 = 𝑃 (6,6) =
36

pmf of X is:

28
29
30
31
32
33
Example # 3
The gene for albinism in humans is recessive. That is, carriers of this gene have probability 1/2 of passing it
to a child, and the child is albino only if both parents pass the albinism gene. Parents pass their genes
independently of each other. Consider when both parents carry the albinism gene and have three children.
Let the random variable X be the number of children that are albino. Find the probability mass function of X.

34
35
36
Example # 4
Consider a group of five potential blood donors—A, B, C, D, and E—of whom only A and B have type O+
blood. Five blood samples, one from each individual, will be typed in random order until an O+ individual is
identified. Let the random variable Y be the number of typings necessary to identify an O+ individual.

a. Describe the pmf of Y and present it in a tabular form.


b. Construct a line graph of pmf of Y.

37
38
39
Example # 5
In the United States, the number of twin births is approximately 1 in 90.
Let X be the number of births in a certain hospital until the first twins are born.
X is a random variable. Denote twin births by T and single births by N.

a. Define the sample space.

a. Give the set of all possible value of X.

b. Find the pmf of X.

40
Example # 6
Starting at a fixed time, we observe the sex of each newborn child at a certain hospital until a girl (G) is
born. Let P(G) = p (a number between 0 and 1), assume that successive births are independent, and
define the random variable X by X = number of births observed. Find a general formula that describes
probability mass function of X.

41
Random Variable Distribution

• Events can also be defined by ranges of values of random variables.

• E.g.,

• The distribution of random variable X is the collection of probabilities 𝑃(𝑋 ∈ 𝐴) for all subsets A of the
real line
• Distribution determines probability of all events defined by X

42
Example
For some fixed value x, we often wish to compute the probability that the observed value of X will be at
most x.

For example, let X be the number of beds occupied in a hospital’s emergency room at a certain time of
day, and suppose the pmf of X is given by

43
Example

pmf of X is given by

• The probability that at most two beds are occupied is P(X ≤ 2) = p(0) + p(1) + p(2)
= 0.20 + 0.25 + 0.30 = 0.75
• Since X ≤ 2.7 iff X ≤ 2, we also have P(X ≤ 2.7) = 0.75, and similarly P(X ≤ 2.999) = 0.75
• Since 0 is the smallest possible X value, P(X ≤ -1.5) = 0, P(X ≤ -10) = 0, and in fact for any negative
number x, P(X ≤ x) = 0
• And because 4 is the largest possible value of X, P(X ≤ 4) = 1, P(X ≤ 9.8) = 1, and so on.
• Very importantly, P(X < 2) = p(0) + p(1) = 0.45 < 0.75 = P(X ≤ 2), because the latter probability includes
the probability mass at the x value 2 whereas the former probability does not.
• More generally, P(X < x) < P(X ≤ x) whenever x is a possible value of X.
• Furthermore, P(X ≤ x) is a well-defined and computable probability for any number x.
44
Cumulative Distribution Function
Distribution of any random variable X is determined by its cumulative distribution function (CDF),
defined as

𝐹 𝑥

And its values must lie in the interval [0, 1] 0 ≤𝐹 𝑥 ≤1

45
Properties of Cumulative Distribution Function

F is nondecreasing

Note that these properties follow directly from axiom of probability

46
Property of Cumulative Distribution Function
If 𝐹 is distribution function of a random variable X, then 0 ≤ 𝐹 𝑥 ≤ 1

Proof:

By definition

𝐹 𝑥 =𝑃 𝑋≤𝑥

Since P(.) is the probability of the event and lies between 0 and 1, that is 0 ≤ 𝑃 𝑋 ≤ 𝑥 ≤ 1, then

0 ≤𝐹 𝑥 ≤1

47
Property of Cumulative Distribution Function
𝐹 is monotonically non-decreasing

For example, 𝐹(𝑥1 ) ≤ 𝐹(𝑥2 ) if 𝑥1 < 𝑥2

Proof:

Let 𝑥1 , 𝑥2 ∈ ℝ with 𝑥1 < 𝑥2

⇒ {𝑋 ≤ 𝑥1 } ⊂ {𝑋 ≤ 𝑥2 }

⇒ P(𝑋 ≤ 𝑥1 ) ≤ P(𝑋 ≤ 𝑥2 )

⇒ 𝐹(𝑥1 ) ≤ 𝐹(𝑥2 )

48
Property of Cumulative Distribution Function
𝐹 is right-continuous,

For example, 𝐹 𝑥 + 0 = lim 𝐹 𝑥 + ℎ = 𝐹(𝑥)


ℎ⟶0

Proof:

Let A = {𝑋 ≤ 𝑥} and B = {𝑋 ≤ 𝑥 + ℎ}

Since A ⊂ B and P is monotone

𝐹 𝑥 + ℎ − 𝐹 𝑥 = 𝑃 𝐵 − 𝑃(𝐴)
=𝑃 𝑥 <𝑋 ≤𝑥+ℎ

Taking limits as ℎ ⟶ 0, we have

𝐹 𝑥+0 −𝐹 𝑥 = 𝑃 𝜙 = 0

⇒𝐹 𝑥+0 =𝐹 𝑥
Hence, 𝐹 is right-continuous. 49
Note
CDF gives probability of random variable X being smaller or equal to x, for any value of x
• Use CDF to find probability of random variable X being in any interval (a, b]

𝑃(𝑎 < 𝑋 ≤ 𝑏) = 𝑃 𝑋 ≤ 𝑏 − 𝑃(𝑋 ≤ 𝑎) = 𝐹(𝑏) − 𝐹 𝑎

Proof:
The event 𝑎 < 𝑋 ≤ 𝑏 and 𝑋 ≤ 𝑎 are disjoint
And (𝑎 < 𝑋 ≤ 𝑏) ∪ (𝑋 ≤ 𝑎) = 𝑋 ≤ 𝑏
𝑃(𝑎 < 𝑋 ≤ 𝑏) + 𝑃(𝑋 ≤ 𝑎) = 𝑃 𝑋 ≤ 𝑏
𝑃(𝑎 < 𝑋 ≤ 𝑏) + 𝐹(𝑎) = 𝐹 𝑏
𝑃(𝑎 < 𝑋 ≤ 𝑏) = 𝐹(𝑏) − 𝐹 𝑎

50
Note

Remark:
𝑃(𝑎 ≤ 𝑋 ≤ 𝑏) = 𝑃 𝑋 = 𝑎 + 𝑃(𝑎 < 𝑋 ≤ 𝑏)
= 𝑃 𝑋 = 𝑎 + [𝐹 𝑏 − 𝐹 𝑎 ]

𝑃(𝑎 < 𝑋 < 𝑏) = 𝑃(𝑎 < 𝑋 ≤ 𝑏) − 𝑃 𝑋 = 𝑏


= 𝐹 𝑏 −𝐹 𝑎 − 𝑃(𝑋 = 𝑏)

𝑃(𝑎 ≤ 𝑋 < 𝑏) = 𝑃 𝑋 = 𝑎 + 𝑃(𝑎 < 𝑋 ≤ 𝑏) − 𝑃 𝑋 = 𝑏


= 𝑃 𝑋 = 𝑎 + [𝐹 𝑏 − 𝐹 𝑎 ] −𝑃 𝑋 = 𝑏

51
Note

52
Note that since F is right continuous, F(a) is the right-hand limit of F.
This implies the following important fact:

Let F be the distribution function of a random variable X


P(X = a) is the difference between the right- and left-hand limits of F at a.
• If the function F is continuous at a, these limits are the same and equal to F(a). Hence P(X = a) = 0.
• Otherwise, F has a jump at a, and the magnitude of the jump, F(a) − F(a−), is the probability that X = a.
• Table below shows probabilities of events for a variable X given in terms of its distribution function F.

Table source: Table 4.1 in Introduction to Probability: Models and Applications by Balakrishnan, Koutras and Politis
53
Example # 1
Suppose we toss a coin three times and let X be the number of times that tails appear.
The sample space for this experiment is
Ω = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}

For the function X: Ω → ℝ we can write


X(HHH) = 0, X(HHT) = 1, X(HTH) = 1, X(HTT) = 2, X(THH) = 1, X(THT) = 2, X(TTH) = 2, X(TTT) = 3
In tabular form, mapping of the elementary events 𝜔 to 𝑋(𝜔) is summarized below

By taking into account that the eight elements of are


equiprobable, the pmf of X is:

54
Example # 1
Define CDF of X.

Graph CDF of X.

For X a discrete random variable, the graph of F(x) will have a jump at every possible value of X and
55
will be flat between possible values. Such a graph is called a step function.
56
57
Example #2
A store carries flash drives with 1, 2, 4, 8, or 16 GB of memory.
The accompanying table gives the distribution of X = the amount of memory in a purchased drive:

a. Graph the pmf of X.


b. Determine F(x) for each of the five possible values of X.
c. Find F(2.7)
d. Find F(7.999)
e. Give the CDF of X.
f. Graph the CDF of X.

58
59
60
61
62

You might also like