Y]. Example 2 finds c for another joint PDF and calculates the joint CDF F(x,y).">Y]. Example 2 finds c for another joint PDF and calculates the joint CDF F(x,y).">
Stochastic Hydrology: Indian Institute of Science
Stochastic Hydrology: Indian Institute of Science
Stochastic Hydrology: Indian Institute of Science
INSTITUTE OF SCIENCE
STOCHASTIC HYDROLOGY
Lecture -2
Course Instructor : Prof. P. P. MUJUMDAR
Department of Civil Engg., IISc.
Summary
of
the
previous
lecture
Concept
of
a
random
variable
Discrete
and
conAnuous
random
variables
Probability
mass
funcAon,
density
funcAon
and
cumulaAve
distribuAon
funcAons
2
Corrections in the slides of Lecture-1
Slide Title of
No. Original Correction
slide
Continuous P [ x < X x + dx ] P [ x < X x + dx ]
23 f ( x) = lim f ( x) = lim
RVs dx dx dx 0 dx
d d
f1 ( x) + P [ x = d ] + f1 ( x)dx + P [ x = d ] +
Mixed
32
distributions
f ( x) = 1.0
d
2
f ( x)dx = 1.0
2
d
3
CorrecAons
in
Lecture-1
Slide No.23-Continuous RVs
f(x)
P [x < X < x+dx]
dx x
P [ x < X x + dx ]
f ( x) = lim where f ( x)dx = 1
dx dx
CORRECTED AS
P [ x < X x + dx ]
f ( x) = lim where f ( x)dx = 1
dx 0 dx 4
Bivariate
DistribuAons
In many situations, we would be interested in
simultaneous behavior of two or more random variables.
e.g., in hydrology, we may be interested in the joint
behavior of
Rainfall Runoff
Rainfall Recharge
Rainfall intensity- Peak flood discharge
Temperature Evaporation
Soil permeability GW yield
Flow rates on two streams
5
Bi-variate
DistribuAons
We denote (X,Y) as a two-dimensional random variable
(or a two dimensional random vector).
X and Y both discrete : two dimensional discrete r.v
X and Y both continuous : two dimensional continuous
r.v.
It is possible that one of the rvs of (X, Y), say, X, is
discrete while the other is continuous. In this course,
however, we deal only with cases in which both X & Y
are either discrete or continuous.
6
Probability
distribuAon
of
(X,
Y)
We define the joint probability mass function of a two
dimensional discrete r.v., (X,Y) as,
p( x , y ) =1
j =1 i =1
i j
7
Probability
DistribuAon
of
(X,
Y)
Similar to the CDF for one dimensional random
variables, we define the joint CDF of the two
dimensional discrete r.v., (X,Y) as
= p ( xi , y j )
xi x y j y
8
Example
:
Discrete
two-d
RV
Probability mass function
x
0 1 2 3 4
y
0 0 0.04 0.05 0.07 0.09
1 0.03 0.04 0.06 0.07 0.08
2 0.02 0.05 0.05 0.07 0.05
3 0.01 0.03 0.05 0.07 0.07
y = 2 x =3
F(3,2) = p ( x, y )
y =0 x =0
2) This states that the total
f ( x, y )dxdy = 1 volume under the surface
given by f(x, y) is 1.0
10
Joint
cdf
of
(X,
Y)
The joint cumulative distribution function F(x, y) of the
two dimensional random vector (x, y) is defined as
F(x, y) = P[X<x, Y<y]
y x
= f ( x, y ) dxdy
11
Example
1
X Y
1.Obtain c
2.Obtain P[X > Y]
12
Example 1 (contd)
1. To determine c ,
f ( x, y )dxdy = 1
9 10
c dxdy = 1
4 5
9 10
c [ x ] dy = 1
4 5
9
5c [ y ]4 = 1
25c = 1 c = 1
25
13
Example 1 (contd)
y xy
2. P[X > Y] = 1-P[X < Y] 9
9 y
= 1 f ( x, y )dxdy 5
5 5 4
9 y
1 0 x
= 1 dxdy 5 9 10
25 5 5
1 9
= 1 ( y 5)dy
25 5
9
1 y 2
= 1 5 y
25 2 5 14
Example 1 (contd)
1 92 52
= 1 5 9 + 5 5
25 2 2
= 1 0.32
= 0.68
P[X > Y] = 0.68
15
Example
2
= 0, elsewhere
Obtain
1.the constant c
2.F(x, y)
3.P[X < 1/2, Y < 3/4]
4.P[X > Y]
5.P[X+Y > 1]
16
Example
2
(contd)
1. To obtain c , f ( x, y )dxdy = 1
1 1
2 2
c ( x + y ) dxdy = 1
0 0
1 3 1
x 2
0 c 3 + xy dy = 1
0
1
1 2
0 c 3 + y dy = 1
3 1
y y 2c
c + = 1 =1 c = 3
2
3 3 0 3
17
Example
2
(contd)
x y x y
3 2
2. F(x, y) = 2
(
f ( x, y )dydx = x + y 2 dydx )
0 0 0 0
x 3 y
3 2 y
= x y + dx
0
2 3 0
x
3 2 y 3
= x y + dx
0
2 3
3 3 x
3 x y xy x3 y + xy 3
= + =
2 3 2 0 2
x3 y + xy 3 0<x<1
F ( x, y ) =
2 0<y<1
18
Example
2
(contd)
3 3
1
( ) 3 + 1 3 ( )
3. P[X < 1/2, Y < 3/4] = 2 4 2 4
2
39
=
256
=0.152
19
Example
2
(contd)
x=y
1
4. P[Y > X]
Limits x 0 to y y
x>y
y 0 to 1
1 y 0 1 x
3 2
P[Y > X] =
2
(
x + y 2 dxdy )
0 0
1 3 21 1
x 3xy 1 3 y 2 3
= + dy = + 2 y dy
0
2 2 y 0
2 2
3 4 1
y y y
= + = 1
2 2 2 2 20
0
Example
problem-2
1
5. P[X+Y > 1]
Limits x 0 to 1
y
y 1-x to 1
1 1
3 2 0
P[X+Y> 1] =
2
x + y 2
(
dydx ) 1 x
0 1 x
1 2 1 3 1
3x y y 3x 3x 2 3
= + dx = + 2 x dx
0
2 2 1 x 0
2 2
2 3 4 1
3x x y 3
= + =
4
4 2 2 0
21
Marginal
Probability
DistribuAon
We have seen f(x, y) as a joint probability
distribution
In discrete case, p(x, y) = P[X = x, Y = y]
indicates prob [X=x AND Y=y].
Consider the following distribution as in the
previous numerical example
22
Marginal
Probability
DistribuAon
Marginal distribution of Y
x
y 0 1 2 3 4 Sum
0 0 0.04 0.05 0.07 0.09 0.25
1 0.03 0.04 0.06 0.07 0.08 0.28
2 0.02 0.05 0.05 0.07 0.05 0.24
3 0.01 0.03 0.05 0.07 0.07 0.23
Sum 0.06 0.16 0.21 0.28 0.29 1.00
Marginal distribution of X
23
Marginal
Probability
DistribuAon
An element in the body of the table indicates P[X = xi,
Y = yj].
The marginal totals give P[Y = yj] and P[X = xi] resply.
For example, if we are interested in P[Y = 0], this is given
by marginal sum as 0.25.
Since the event P[Y = 0] can occur with X=0, X=1,..
X=5. we have P[Y=0, X=0 OR Y=0, X=1 OR ..]
25
Marginal
Density
FuncAons
In the continuous case, we proceed as follows
Let f(x, y) denote the joint pdf of (X, Y).
We define g(x) and h(y) as the marginal probability
density functions of X & Y respectively as
g ( x) = f ( x, y )dy , h( y ) = f ( x, y )dx
26
Marginal
Density
FuncAons
This may be seen from
P[c < X < d] = P[c < X < d, - < Y < ]
d
= f ( x, y )dy dx
c
d
= g ( x)dx
c
27
Marginal
Density
FuncAons
Thus g ( x) = f ( x, y )dy and F ( x) = g ( x)dx
5 < x < 10
f(x, y) = 1/25 4<y<9
= 0, elsewhere
29
Example
3
(contd)
1. To obtain g(x),
g ( x) = f ( x, y )dy 5 x 10
9
1
= dy
4
25
9
y
= = 1
25 4 5
1
g ( x) = 5 x 10
5
30
Example
3
(contd)
1. To obtain h(y),
h( y ) = f ( x, y )dx 4 y9
10
1
= dx
5
25
10
x
= = 1
25 5 5
1
h( y ) = 4 y9
5
31
Example
3
(contd)
2. To obtain G(x),
x
G ( x) = g ( x)dx 5 x 10
x
1
= dx
5
5
x
x
=
5 5
x 5
G ( x) = 5 x 10
5
32
Example
3
(contd)
2. To obtain H(y),
y
H ( y) = h( y)dy 4 y9
y
1
= dy
4
5
y
y
=
5 4
y4
H ( y) = 4 y9
5
33
Example
3
(contd)
34
Example 4
x>0
f(x, y) = e-y y>x
35
Example
4
(contd)
1. To obtain g(x),
g ( x) = f ( x, y )dy x>0
= e y dy
x
= e = e x
y
x
x
x x x
G ( x) = e dx = e
0
0
= 1 e x x>0
36
Example
4
(contd)
(
= 1 1 e2 )
= e2
37
CondiAonal
DistribuAon
A marginal distribution is the distribution of one variable
regardless of the value of the second variable
A joint distribution is the simultaneous occurrence of the
given values of the two variables
The distribution of one variable with conditions placed on
the second variable is called conditional distribution. For
example,
Distribution of X, given that Y=y0 or distribution of Y
given that c < X < d etc.
38
CondiAonal
DistribuAon
Definition: (X, Y) is a continuous two dimensional r.v. with a
joint pdf of f(x, y).
Let g(x) and h(y) be the marginal pdfs of X and Y
respectively
The conditional pdf of X given Y = y is defined as
f ( x, y )
g (x y) = h( y ) > 0
h( y )
Read as x given y
39
CondiAonal
DistribuAon
The conditional pdf of Y given X = x is defined as
f ( x, y )
h ( y x) = g ( x) > 0
g ( x)
The conditional pdf of X given Y R and conditional
pdf of Y given X R is defined as
f ( x, y ) dy
R
f ( x, y ) dx
R
g ( x y R) = , h ( y x R) =
h ( y ) dy
R
g ( x ) dx
R
40
CondiAonal
DistribuAon
The conditional pdfs g(x/y) and h(y/x) satisfy all conditions
for a pdf.
For a given y, g(x/y)>0, as both f(x,y) and h(y) are positive.
f ( x, y )
g (x y) =
h( y )
dx
1
= f ( x, y )dx
h( y )
h( y )
= =1.0
h( y )
Cumulative conditional distributions
x y
G (x y) = g ( x y ) dx, H ( y x) = h ( y x ) dy
41
Example
5
f(x, y) =
(
x 1+ 3y2 ) 0<x<2
4 0<y<1
= 0, elsewhere
1. Obtain h(y/x)
42
Example
5
(contd)
=
1
(
x 1+ 3y2 ) dy
0
4
1 3 1
= xy + y
4 0
( x + 1)
g ( x) = 0 x2
4
43
Example
5
(contd)
f ( x, y )
h ( y x) =
g ( x)
=
(
x 1+ 3y2 )
x +1
1
x
2. P[1/2 < Y < 1/X=x] = ( )
1 + 3 y 2 dy
1 x +1
2
x 3 1
= y + y 1
x +1 2
11 x
=
8 x + 1 44
Example
5
(contd)
11 1 11
2. P[1/2 < Y < 1/X=1] = = 16
8 1 + 1
3. To obtain P[Y < 3/4/X < 1],
f ( x, y ) dx
R
h( y x R) =
g ( x ) dx
R
1
f ( x, y ) dx
0
h ( y x 1) = 1
g ( x ) dx
0 45
Example
5
(contd)
1 1
(
x 1+ 3y2 )dx
f ( x, y)dx =
0 0
4
2 2 1
1 + 3 y x
=
4 2 0
1+ 3y2
=
8
1 1
( x + 1)
0 g ( x)dx = 0 4 dx
2 1
1 x 3
= + x =
4 2 8
0 46
Example
5
(contd)
1+ 3 y2
h ( y x 1) =
3
3
1+ 3y2
4
h ( y 3 / 4 x 1) = dy
0
3
1 3
3
= y + y 4
3 0
1 3 27 75
= + =
3 4 64 192
47
Independence of two random variables
48
As an example, inflow to a reservoir (X) and the rainfall
in the command area (Y) may be taken as independent,
if the command area is far removed from the reservoir.
Rainfall
Inflow
Reservoir
Command area 49
In water quality problems, for example, pollutant load (X)
and stream flow (Y) may be treated as independent
variables.
50
Independent R.V.
When two r.v.s are independent, g(x/y)=g(x)
Distribution of x given y is independent of y and hence
the original pdf itself gives the conditional pdf
f ( x, y )
g (x y) =
h( y )
f ( x, y )
g ( x) =
h( y )
f ( x, y ) = g ( x).h( y )
51
Independent R.V.
The random variables X and Y are stochastically
independent if and only if their joint density is equal to
the product of their marginal densities.
For discrete case, the two r.v.s are independent if and
only if
p(xi, yj) = p(xi) . p(yj) v i,j
52