Chapter 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

BFC 34303

CIVIL ENGINEERING STATISTICS


Chapter 3
Random Variables and
Probability Distributions
Faculty of Civil and Environmental Engineering
Universiti Tun Hussein Onn Malaysia

What is a ‘random variable’?


A random variable is a quantity resulting from an experiment that, by
chance, can assume different values.

For example, if we toss two coins and count the


number of ‘heads’, there could be zero, one or two
heads. Thus, the number of heads appearing is
the random variable.
If X is the number of heads appearing,
X = 0, 1 or 2.

1
A random variable may be either discreet or continuous.

Discrete Random Variable Continuous Random Variable

• A variable that can assume • A variable where the data can


only certain clearly separated take infinitely many values,
values. within certain limitations.
• For example, number of • For example, height of
children in a family, volume of students, amount of sugar in a
milk bought at the store, scores drink, the time required to run
given by judges in a diving 100 m, etc.
competition, etc.

Probability Distribution of Discreet Random Variables


It is a complete set of all possible outcomes and their probabilities of
occurring. It is also sometimes called the probability function or the
probability mass function.
For example:

X Possible values of X
Number of dots appear when tossing a die 0, 1, 2, 3, 4, 5, 6
Number of books in a bag 0, 1, 2, 3, 4, 5, 6, 7, 8, ....
Number of students in a class 0, 1, 2, 3, 4, 5, 6, 7, 8, ….

2
Theory 1
The probability distribution of a discrete random variable 𝑋 is described
as the function 𝑃(𝑋=𝑥) = 𝑃(𝑥) which satisfies:

• 0≤𝑃 𝑥 ≤1
• ∑ 𝑃 𝑋 =1
• 𝑃 𝑥 = 𝑃(𝑋 = 𝑥 )

Example 3.1

Given the following:


x -1 0 1 2 3
P(X=x) 1/8 2/8 2/8 2/8 1/8

Show that the distribution is a probability distribution function.


Find:
(a) P(X < 1)
(b) P(X > 2)
(c) P(-1 < X < 1)

3
x -1 0 1 2 3
P(X=x) 1/8 2/8 2/8 2/8 1/8

P(-1) + P(0) + P(1) + P(2) + P(3)


= 1/8 + 2/8 + 2/8 + 2/8 + 1/8
=1
SP(X) = 1  This is a probability distribution function

(a) P(X < 1) = P(-1) + P(0)


= 1/8 + 2/8
= 3/8
7

x -1 0 1 2 3
P(X=x) 1/8 2/8 2/8 2/8 1/8

(b) P(X > 2) = P(3) = 1/8

(c) P(-1 < X < 1) = P(-1) + P(0) + P(1)


= 1/8 + 2/8 + 2/8
= 5/8

4
Cumulative Distribution of Discreet Random Variables
It is a function giving the probability that the random variable X is less
than or equal to x, for every value x.
For a discrete random variable, the cumulative distribution function is
found by summing up the probabilities.

Theory 2
The cumulative distribution function of a discrete random variable X is
described as the function 𝐹 𝑥 = 𝑃 𝑋 ≤ 𝑥 = ∑ 𝑃(𝑋 = 𝑥) which
satisfies:

• 𝐹(𝑥) is an increase function

• lim 𝐹 𝑥 = 1 , which is the maximum value is 1


• lim 𝐹 𝑥 = 0 , which is the minimum value is 0


10

5
Theory 3
The cumulative distribution function of a discrete random variable 𝑋
can be calculated by using the following formula:
• 𝑃 𝑋≤𝑟 =𝐹 𝑟
• 𝑃 𝑋 > 𝑟 =1−𝐹 𝑟
• 𝑃 𝑋 <𝑟 =𝑃 𝑋 ≤𝑟−1 =𝐹 𝑟−1
• 𝑃 𝑋 =𝑟 =𝐹 𝑟 −𝐹 𝑟−1
• 𝑃 𝑟 < 𝑋 ≤ 𝑠 =𝐹 𝑠 −𝐹 𝑟
• 𝑃 𝑟 ≤ 𝑋 ≤ 𝑠 =𝐹 𝑠 −𝐹 𝑟 +𝑓 𝑟
• 𝑃 𝑟 ≤ 𝑋 < 𝑠 =𝐹 𝑠 −𝐹 𝑟 +𝑓 𝑟 −𝑓 𝑠
• 𝑃 𝑟 < 𝑋 < 𝑠 = 𝐹 𝑠 − 𝐹 𝑟 − 𝑓(𝑠)

11

Example 3.2

𝑃(𝑋=𝑥) is the probability distribution function of 𝑋. Find the cumulative


distribution function of 𝑋.

x -2 -1 0 1 2
P(X=x) 0.12 0.22 0.24 0.23 0.19

P(X < -2) = 0


F(x) = P(X < x)
F(-2) = P(X < -2) = P(-2) = 0.12
F(-1) = P(X < -1) = P(-2) + P(-1) = 0.12 + 0.22 = 0.34
F(0) = P(X < 0) = P(-2) + P(-1) + P(0) = 0.12 + 0.22 + 0.24 = 0.58

12

6
x -2 -1 0 1 2
P(X=x) 0.12 0.22 0.24 0.23 0.19

F(1) = P(X < 1) = P(-2) + P(-1) + P(0) + P(1)


= 0.12 + 0.22 + 0.24 + 0.23 = 0.81
F(2) = P(X < 2) = P(-2) + P(-1) + P(0) + P(1) + P(2)
= 0.12 + 0.22 + 0.24 + 0.23 + 0.19 = 1.0

𝟎, 𝑿 < −𝟐
𝟎. 𝟏𝟐, −𝟐 ≤ 𝑿 < −𝟏
𝟎. 𝟑𝟒, −𝟏 ≤ 𝑿 < 𝟎
𝑭 𝒙 =
𝟎. 𝟓𝟖, 𝟎≤𝑿<𝟏
𝟎. 𝟖𝟏, 𝟏≤𝑿<𝟐
𝟏, 𝑿≥𝟐
13

Or alternatively:

x < -2 -2 -1 0 1 >2
P(X=x) 0 0.12 0.22 0.24 0.23 0.19
F(x) 0 0.12 0.34 0.58 0.81 1

𝟎, 𝑿 < −𝟐
𝟎. 𝟏𝟐, −𝟐 ≤ 𝑿 < −𝟏
𝟎. 𝟑𝟒, −𝟏 ≤ 𝑿 < 𝟎
𝑭 𝒙 =
𝟎. 𝟓𝟖, 𝟎≤𝑿<𝟏
𝟎. 𝟖𝟏, 𝟏≤𝑿<𝟐
𝟏, 𝑿≥𝟐

14

7
Example 3.3

Given 𝐹(𝑥) is cumulative distribution function of 𝑋, find the probability


distribution function of 𝑋.

0, 𝑋 < −1
0.08, −1 ≤ 𝑋 < 2
𝐹 𝑥 = 0.36, 2 ≤ 𝑋 < 5
0.67, 5 ≤ 𝑋 < 7
1, 𝑋≥7

15

0, 𝑋 < −1
0.08, −1 ≤ 𝑋 < 2
𝐹 𝑥 = 0.36, 2 ≤ 𝑋 < 5
0.67, 5 ≤ 𝑋 < 7
1, 𝑋≥7

Probability distribution function of 𝑋:

x F(x) P(X=x)
-1 0.08 0.08 – 0 = 0.08
2 0.36 0.36 – 0.08 = 0.28
5 0.67 0.67 – 0.36 = 0.31
7 1 1 – 0.67 = 0.33

16

8
Mean of a Probability Distribution
It is the weighted average over all possible outcomes, with the weight
for each outcome being the relative frequency or probability associated
with that outcome.

Theory 4
Mean (or expected value) of a probability distribution is

where 𝑋 = the i-th outcome of X


𝜇=𝐸 𝑋 = 𝑋 𝑃(𝑋 ) 𝑃 𝑋 = the probability of occurrence of the i-th
outcome of X
i = 1, 2, 3, ….

17

Variance of a Probability Distribution


It is the weighted average of the squared differences between each
possible outcome and the average value of the outcomes, with the
weights being the probabilities associated with each of the outcomes.

Theory 5
Variance of a probability distribution is

𝜎 = 𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 − 𝐸 𝑋
where 𝑋 = the i-th outcome of X
𝐸 𝑋 = 𝑋 . 𝑃(𝑋 ) 𝑃 𝑋 = the probability of occurrence of the i-th
outcome of X
i = 1, 2, 3, ….

18

9
Theory 6
Standard deviation of a probability distribution is

𝜎 = 𝑠𝑡𝑑 𝑋 = 𝑉𝑎𝑟(𝑋)

Note: 𝐸 𝑎𝑋 + 𝑏 = 𝑎𝐸 𝑥 + 𝑏
𝑉𝑎𝑟 𝑎𝑋 + 𝑏 = 𝑎 𝑉𝑎𝑟 𝑥 + 𝑉𝑎𝑟 𝑏 = 𝑎 𝑉𝑎𝑟 𝑥 + 0

19

Example 3.4

𝑃(𝑋=𝑥) is the probability distribution function of 𝑋. Find the value of k


and calculate the mean and standard deviation for this probability
distribution.

x -1 0 1 2 3
P(X=x) 0.34 0.23 0.12 0.15 k

We know that SP(X) = 1


0.34 + 0.23 + 0.12 + 0.15 + k = 1
k = 0.16

20

10
x -1 0 1 2 3
P(X=x) 0.34 0.23 0.12 0.15 0.16

Mean, E(X)
E(X) = S x P(X) = -1(0.34) + 0(0.23) + 1(0.12) + 2(0.15) + 3(0.16)
= 0.56
E(X2) = S x2 P(X) = (-12)(0.34) + (02)(0.23) + (12)(0.12) + (22)(0.15)
+ (32)(0.16)
= 2.5
Var(X) = E(X2) – [E(X)]2 = 2.5 – (0.56)2 = 2.19
Std(X) = √Var(X) = √2.19 = 1.48
21

Probability Distribution of Continuous Random Variables


Continuous random variables can take any numeric value within a range
of value. The range may be infinite or bounded at either both ends.
Examples of probability distributions of continuous random variables:

X Possible values of X
Height of Year 5 primary school students 130 cm < x < 160 cm
Time taken to complete a 20-minute quiz 1 minute < x < 20 minutes
Distance between two cities 10 km < x < 20,010 km

22

11
Theory 7
Properties of the Probability Density Function (pdf), i.e. f(x), of
Continuous Random Variables:

• 𝑓(𝑥) ≥ 0

• ∫ 𝑓 𝑥 𝑑𝑥 = 1

• 𝑃 𝑎<𝑥<𝑏 =𝑃 𝑎≤𝑥<𝑏 =𝑃 𝑎<𝑥≤𝑏 =𝑃 𝑎≤𝑥≤𝑏 =


∫ 𝑓 𝑥 𝑑𝑥

23

Example 3.5

The continuous random variable 𝑋 has the pdf given below:

3
𝑓 𝑥 = 4 2𝑥 − 𝑥 , 0 < 𝑥 < 2
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Find (a) P(X > 1)


(b) P(X < 1)
(c) P(0.5 < X < 2)

24

12
(a) P(X > 1) = P(1 < X < 2)

3 3 𝑥 3 2 1
2𝑥 − 𝑥 𝑑𝑥 = 𝑥 − = 2 − − 1 −
4 4 3 4 3 3
3 8 1
= 4− − 1−
4 3 3
= 0.50

25

(b) P(X < 1) = P(0 < X < 1)

3 3 𝑥 3 1 0
2𝑥 − 𝑥 𝑑𝑥 = 𝑥 − = 1 − − 0 −
4 4 3 4 3 3
3 1
= 1− − 0
4 3
= 0.50

26

13
(c) P(0.5 < X < 2)

3 3 𝑥 3 2 0.5
2𝑥 − 𝑥 𝑑𝑥 = 𝑥 − = 2 − − 0.5 −
. 4 4 3 .
4 3 3
3 8 0.5
= 4− − 0.5 −
4 3 3
= 0.75

27

Example 3.6

The continuous random variable 𝑋 has the pdf given below:

2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Find (a) the value of c


(b) P(X < 1)
(c) P(2.5 < X < 3)

28

14
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

(a) the value of c

∫ 2𝑐 𝑑𝑥 = 1
2𝑐 𝑥 = 1
2𝑐 2 − 0 = 1
4𝑐 = 1
𝟏
𝑐=
𝟒

29

2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

(b) P(X < 1)

1 1 𝑥 1 𝟏
2 𝑑𝑥 = 𝑑𝑥 = = −0=
4 2 2 2 𝟐

30

15
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

(c) P(2.5 < X < 3)

1 3
2 (2𝑥 − 3) 𝑑𝑥 = (𝑥 − ) 𝑑𝑥
. 4 . 2
3 𝑥 3𝑥 (3) 3(3) 2.5 3 2.5
𝑥− 𝑑𝑥 = − = − − −
. 2 2 2 .
2 2 2 2

= 0.625

31

Cumulative Distribution of Continuous Random Variables


You might recall that the cumulative distribution function is defined for
discrete random variables as:

𝐹 𝑥 =𝑃 𝑋≤𝑥 = 𝑓𝑡

Again, F(x) accumulates all of the probability less than or equal to x. The
cumulative distribution function for continuous random variables is just a
straightforward extension of that of the discrete case.
All we need to do is replace the summation with an integral.
32

16
Theory 8
The cumulative distribution function of a continuous random variable 𝑋
is described as the function:

𝐹 𝑥 =𝑃 𝑋≤𝑥 =∫ 𝑓 𝑥 𝑑𝑥 for −∞ < 𝑥 < ∞

33

Example 3.7

The continuous random variable 𝑋 has the pdf given below:

𝑥
𝑓 𝑥 = 8, 0<𝑥<4
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Find (a) P(X < 2)


(b) P(X > 1)

34

17
𝑥
𝑓 𝑥 = 8, 0<𝑥<4
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Cumulative distribution function (cdf):


For 0 < x < 4

𝑥 𝑥 𝑥 𝑥
𝑑𝑥 = = −0 =
8 16 16 16

0, 𝑥<0
 𝐹 𝑥 = 𝑥 /16, 0 ≤ 𝑥 < 4
1, 𝑥≥4

35

0, 𝑥<0
𝐹 𝑥 = 𝑥 /16, 0 ≤ 𝑥 < 4
1, 𝑥≥4

2
(a) P(X < 2) = P(X < 2) = F(2) = = 𝟎. 𝟐𝟓
16

1
(b) P(X > 1) = 1 – P(X < 1) = 1 – F(1) = 1 − = 𝟎. 𝟗𝟑𝟕𝟓
16

36

18
Mean, Variance and Standard Deviation of Continuous
Random Variables

Theory 9
The mean (or expected value) of a continuous random variable 𝑋 is:

𝜇=𝐸 𝑋 = 𝑥. 𝑓 𝑥 𝑑𝑥

37

Theory 10
The variance of a continuous random variable 𝑋 is:

𝜎 = 𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 − 𝐸(𝑋)
where 𝐸 𝑋 = 𝑥 . 𝑓 𝑥 𝑑𝑥

Theory 11
The standard deviation of a continuous random variable 𝑋 is:

𝜎 = 𝑆𝑡𝑑 𝑋 = 𝑉𝑎𝑟(𝑋)

38

19
Example 3.8

The continuous random variable 𝑋 has the pdf given below. Determine
the mean and variance.

𝑥
𝑓 𝑥 = 8, 0<𝑥<4
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

Mean
𝑥 𝑥 𝑥 4
𝐸 𝑋 = 𝑥 𝑑𝑥 = 𝑑𝑥 = = − 0 = 𝟐. 𝟔𝟔𝟕
8 8 24 24

39

Variance
𝑥 𝑥 𝑥 4
𝐸 𝑋 = 𝑥 𝑑𝑥 = 𝑑𝑥 = = − 0 = 8.0
8 8 32 32

𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 − 𝐸 𝑋 = 8.0 − 2.667 = 𝟎. 𝟖𝟖𝟕

40

20

You might also like