0% found this document useful (0 votes)
208 views28 pages

Chapter 2: Random Variables

The document discusses random variables including discrete and continuous random variables. It defines key concepts such as probability functions, distribution functions, independence and conditional distributions. Examples are provided to illustrate how to calculate probabilities and find marginal and conditional distributions.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
208 views28 pages

Chapter 2: Random Variables

The document discusses random variables including discrete and continuous random variables. It defines key concepts such as probability functions, distribution functions, independence and conditional distributions. Examples are provided to illustrate how to calculate probabilities and find marginal and conditional distributions.
Copyright
© Attribution Non-Commercial (BY-NC)
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
You are on page 1/ 28

Chapter 2: Random Variables

2.1 Introduction
X => a random variable; why random?
Outcome of experiment of chance
Also known as a function X defined on a prob. space

Outcome quantitative or qualitative


X => age of a person drawn randomly from one pop.
X => eye color of a person drawn randomly from one pop.
Other examples?
Details on discrete and continuous r.v.
1 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
2.2 Discrete random variables
A discrete sample space, => a discrete r.v.
If X is a discrete r.v., the distribution of X is given
by the probability function (p.f.)
Notation used:
The p.f. has the following properties:
2 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) 0 >
i
x f
( ) 1
1
=

i
x f
Prob X takes a
specific value
Chapter 2: Random Variables
A p.f. can takes the form --- formula or a table
listing all the possible values of x and its
probabilities, f(x).
Suppose we flip a coin two times. The sample space
of this experiment is {HH, HT, TH, TT}. Suppose X is a
random variable, denoting the number of heads.
Based on the sample space, we know that X can
take values of 0, 1 or 2.
A p.f. in terms of formula is:
3 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
x x
x
x f

|
|
.
|

\
|
=
2
5 . 0 5 . 0
2
) (
Chapter 2: Random Variables
Can easily verify that all f(x) for x = 0,1,2 is greater
than or equal to 0 and that the sum of f(x
i
) is 1
A p.f. can also be described in a table
A p.f. relates each value of a discrete r.v. with its
probability of occurrence.
4 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Number of Heads (X) Probability (f(X))
0 0.25
1 0.50
2 0.25
Obtained by looking
at the sample space
Chapter 2: Random Variables
A vector of two discrete r.v (X and Y) is defined
by the joint p.f.
Notation used:
Usually a joint p.f. is given in a two-way table.
Suppose X could take these values {S, H, P, C} and Y
could take the values {0, 1}
5 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( ) y Y x X P y x f = = = , ,
S H P C
0 3/52 3/52 3/52 3/52
1 10/52 10/52 10/52 10/52
P(X=S and Y=1) = 10/52
Sum => 1
Chapter 2: Random Variables
Marginal distribution => distribution of the
subset of random variables
Example of marginal dist: Suppose there is a
random vector (X, Y) with the joint p.f. f(x,y).
Thus, we will have univariate marginal distributions
6 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( )

=
y
X
y x f x f ) , (
( )

=
x
Y
y x f y f ) , (
Sum all the values for each
given Y
Sum all the values for each
given X
Chapter 2: Random Variables
7 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
S H P C
0 3/52 3/52 3/52 3/52
1 10/52 10/52 10/52 10/52
Y
X
Based on the above joint p.f. find the marginal distribution of X
and marginal distribution of Y
Chapter 2: Random Variables
If there is a random vector (X,Y,Z) with the joint
p.f. f(x,y,z) => what are the marginal
distributions that one can consider?
Need to think of all possible subsets
There will be univariate and bivariate
8 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( )

=
z y
X
z y x f x f
,
) , , ( ( )

=
z
Y X
z y x f y x f ) , , ( ,
,
Other possible examples?
Chapter 2: Random Variables
2.3 Distribution functions
Mathematical notation is:
Accumulated probability from - up to x
Also known as cumulative distribution function,
c.d.f.
The properties of c.d.f are given as follows:
For all x =>
F is nondecreasing
F is right-continuous (not necessarily strictly)
9 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( ) x X P x F s =
( ) 1 0 s s x F
Chapter 2: Random Variables
10 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Example of c.d.f.
Discrete
Continuous
Mixed
1
1
1
0
0
0
Chapter 2: Random Variables
The probability that X lies in the interval (a,b],
where a < b is given by:
When X is discrete: The c.d.f. can be obtained
from p.f.
11 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( ) ( ) a F b F b X a P
X X
= s <
( ) ( )

s
=
x u
u f x F
Chapter 2: Random Variables
Suppose that a random variable X has the
following probability function (p.f.)
Find the following values:
Plot the c.d.f.
12 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
X Probability (f(X))
0 0.4
1 0.3
2 0.2
3 0.1
( ) ) 3 ( ), 2 ( ), 1 ( , 0 s s s s X F X F X F X F
Chapter 2: Random Variables
A median of X is any number m such that:
The median is uniquely defined only if the c.d.f.
is strictly monotonic.
13 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) 2 / 1 = s m X P ( ) 2 / 1 = > m X P
&
f (x)
x
Is this monotonic???
Chapter 2: Random Variables
2.4 Continuous random variables
When X is a continuous r.v., the distribution of X
is given by probability density function (p.d.f.)
The properties of p.d.f are:
The c.d.f. is continuous at each x and so prob
assigned to an individual value is 0.
Eg: Suppose the sample space contains all real
numbers, thus P(X= 2.5) = 0 or P(X=-200)=0
14 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
0 ) ( > x f
}


=1 ) ( dx x f
Chapter 2: Random Variables
The relationship between c.d.f (F) and p.d.f. (f)
are given as follows:
Thus, derivative of F (x) will give the p.d.f. (f)
To find the prob of an interval:
An open, closed or half-open intervals have the
same probability
15 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( ) ( )
}

= s =
x
du u f x X P x F
( ) ( )
}
= < <
b
a
dx x f b X a P
Chapter 2: Random Variables
Graphic presentation of the relationship
between F(x) and f(x)
16 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Just read the
cumulative
probability F(a)
from the graph
) ( ) ( a X P a F s =
To get F(x), integrate f(x)
Chapter 2: Random Variables
Example: Suppose the c.d.f. of X is given by :-
Find the following probabilities:
P (1 < X < 4) P (X = 3) P (X > 0)
- Find the median of X
17 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( )

>
=

elsewhere 0
0 if 8 . 0 1 x e
x F
x
Chapter 2: Random Variables
Graphic presentation
18 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Real line
Median: divide
the data sets
into two parts
1
st
quartile:
divide into
another two
parts
3
rd
quartile:
divide into
another two
parts
P = 0.25
P = 0.5
P = 0.75
Chapter 2: Random Variables
Example: Suppose the c.d.f. of X is given by :-
Try plotting the c.d.f. of X
Find the p.d.f. of X (hint: needs to find the derivative)
Based on the obtained p.d.f., find P (0.2 < X < 0.5)
19 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( )

>
< <
s
=
1 1
1 0
0 0
2
x
x x
x
x F
Chapter 2: Random Variables
2.5 Continuous random vectors
Suppose the joint dist of (X, Y) has the following
property:
The joint distribution is called continuous
bivariate dist and can be obtained by:
20 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
Example of bivariate random variables:
Measure the height and weight of a person drawn
randomly from one population
X => represents the height; Y => represents the
weight
S0 (X, Y) is a random vector having a continuous
bivariate distribution
21 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
The joint p.d.f. has the following properties:
The marginal distribution can be found by
integrating the joint p.d.f.
22 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( )
}
=
Y
X
dy y x f x f , ( ) ( )
}
=
X
Y
dx y x f y f ,
Chapter 2: Random Variables
Example: Suppose the p.d.f. is given as f(x, y) =
3(x + y) for x > 0, y > 0 and x + y < 1. Find the
marginal p.d.f. of X.
Based on the formula:
Answer:
23 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) ( )
}

+ =
x
X
dy y x x f
1
0
3
(


2
1
3
2
x
Chapter 2: Random Variables
2.6 Conditional distributions
Already discussed this in terms of conditional
probability
Concept is similar and is extended:
The conditional p.f. of X given Y=y is:
Marginal p.f. of X = x is given by this formula:
24 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
The conditional p.d.f. of X given Y=y is:
Note that, the same notation is used (similar to the
case of p.f.)
Marginal or unconditional p.d.f. of X can be
obtained by:
25 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
Example: The joint p.d.f. f(x,y) = 2 for 0<y<x<1
and the conditional distribution f(y|x) is
uniform on interval (0, x).
What is the marginal p.d.f. f
X
(x)?
What is the marginal p.d.f. f
Y
(y)?
Obtain the conditional p.d.f. f(x|y).
26 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Chapter 2: Random Variables
2.7 Independence
Two experiments are independent when the
model does not change with the coming of new
knowledge.
Two r.v. X and Y are independent provided that:
Or alternatively
27 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
Note: f can be either
a p.f. or a p.d.f.
f
Y
(y) cannot be 0
Chapter 2: Random Variables
Example: Suppose that the joint p.d.f. of X and Y
are given as follows:
Verify that both variables X and Y are
independent.
Hint: Demonstrate
28 NAA, Universiti Pendidikan Sultan Idris, Sem1, 2011/12
( ) 0 , 0 for , > > =

y x e y x f
y x
( ) ( ) ( ) y f x f y x f
Y X
. , =

You might also like