Lecture Set 4
Lecture Set 4
DNSC 6311
Stochastic Foundations: Probability
Korel Gundem
1 / 29
Lecture Outline
2 / 29
Conditional Independence of RVs
▶ Let X , Y and Z be random variables. X and Y are
conditionally independent given Z if
▶ An equivalent definition is
PX |Z ,Y (x|z, y ) = PX |Z (x|z)
3 / 29
Example: Conditional Independence
▶ Consider random variables X , Y and Z with joint distribution:
Z=0 Z=1
Y=0 Y=1 Y=0 Y=1
X=0 0.405 0.045 X=0 0.125 0.125
X=1 0.045 0.005 X=1 0.125 0.125
▶ From the table we have PX ,Y ,Z (0, 0, 0) = 0.405 and
PX ,Y ,Z (0, 0, 1) = 0.125
5 / 29
Linear Independence
▶ If X and Y are independent then Cov (X , Y ) = 0 ⇒ no linear
relationship.
▶ In general Cov (X , Y ) = 0 does not imply independence, but
there are two exceptions: (i) X and Y are Bernoulli RVs (ii)
X and Y has a bivariate normal distribution.
▶ If X and Y are Bernoulli and Cov (X , Y ) = 0 then
E [XY ] = E [X ]E [Y ].
Note that for Bernoulli RVs E [X ] = Pr [X = 1] and
E [Y ] = Pr [Y = 1]. Also,
XX
E [XY ] = xy Pr [X = x, Y = y ],
x y
8 / 29
Discrete Example
▶ We can obtain the covariance as (See R Code)
▶ Note that the value of covariance does not tell us much about
the strength of linear relationship.
Cov (X , Y )
ρXY = p ,
V [X ]V [Y ]
such that −1 < ρXY < 1.
In our example we can obtain
−24
ρXY = √ = −0.30973.
444.75 × 13.5
9 / 29
R Code for Computations
R code: Discrete Joint Conditional Computations 3 Correlation.R
2020-09-22
10 / 29
Properties of Covariance and Variance
▶ Cov (X , X ) = V [X ]
▶ Cov (X , Y ) = Cov (Y , X )
▶ Cov (a + bX , c + dY ) = bdCov (X , Y )
▶ An important property is
V [X + Y ] = V [X ] + V [Y ] + 2Cov (X , Y )
V [aX + bY ] = a2 V [X ] + b 2 V [Y ] + 2abCov (X , Y ).
▶ The above can be generalized as
Xn n
X n X
X
2
V[ ai Xi ] = ai V [Xi ] + 2 ai aj Cov (Xi Xj )
i=1 i=1 i=1 j<i
11 / 29
Application: Portfolio Management
▶ Consider the two securities with returns X and Y in our
example.
E [P] = wE (X ) + (1 − w )E (Y )
V [P] = w 2 V [X ] + (1 − w )2 V [Y ] + 2w (1 − w )Cov (X , Y ).
P = w1 X1 + w2 X2 + · · · · · · + wK XK ,
where w1 + w2 + · · · · · · + wK = 1.
By choosing different (w1 , w2 , . . ., wK ) we obtain different
portfolios.
13 / 29
Discrete Probability Models
14 / 29
Discrete Uniform Model
For any two integers a ≤ b, suppose that the value of a random
variable X is equally likely to be each of the integers a, . . . , b.
X is called the discrete uniform random variable and has the
probability mass function:
1
b − a + 1 for x = a, . . . , b
Pr (X = x) = P(x) =
0 otherwise
0.020
0.10
0.08
0.015
0.06
P(X=x)
P(X=x)
0.010
0.04
0.005
0.02
0.000
0.00
1 2 3 4 5 6 7 8 9 10 1 4 7 10 14 18 22 26 30 34 38 42 46 50
X X
16 / 29
Discrete Probability Models: Binomial Model
▶ Bernoulli trials
17 / 29
Binomial Random Variable
▶ What are some examples ?
Why ?
Pn n
p x (1 − p)n−x = 1 (via binomial
▶ We can show that x=0 x
theorem)
18 / 29
Binomial Random Variable
0.08
0.8
0.06
0.6
0.04
0.4
0.02
0.2
0.00
0.0
0 1 2 3 4 5 6 30 40 50 60 70
n=10,p=0.1 n=100,p=0.5
19 / 29
Acceptance Sampling
▶ In quality control we want to decide whether to accept or
reject a group of items (called lot) based on specified quality
characteristics.
20 / 29
Acceptance Sampling: Example
▶ Assume that a sampling plan established as n = 15 and c = 0,
that is, 15 items will be inspected and the lot will be accepted
if 0 defectives are found.
What is the probability that the lot will be accepted if 5% of
the items are defective ?
21 / 29
Example
22 / 29
Operating Characteristic Curve
The plot of probability of acceptance versus percent defective is
known as the operating characteristic (OC) curve for the sampling
plan.
OC Curve:c=0,n=15 OC Curve:c=2,n=15
1.0
1.0
0.8
0.8
Probability of Acceptance
Probability of Acceptance
0.6
0.6
0.4
0.4
0.2
0.2
0.0
0.0
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
p p
23 / 29
Binomial Trees in Stock Market
Binomial model is used for evolution of stock prices in the market
assuming that the market is up (down) on a given day is a
Bernoulli random variable X = 1(0).
Under the random walk hypothesis, the behavior of the market on
any day is independent of the other days and this behavior can be
represented via a probability tree of Bernoulli Trials.
Example: Assume that we observe the market for 3 days, then we
consider a binomial random variable X where n = 3
X ∼ Binom(3, p)
p (1-p)
p (1-p) p (1-p)
0.15
0.10
0.05
0.00
0 2 4 6 8 10
25 / 29
Fitting a Binomial Model GE Stock Data Behaviour
Assume that we consider a binomial model to the Number Ups of
the GE Stock over the n = 10 trading days.
Based on the data, we can estimate probability of Up on a given
day as the relative frequency of the number of up days over the
2363 trading days which is 0.4854.
Fitted Binomial Distribution to GE Stock
0.25
0.20
Relative Frequency
0.15
0.10
0.05
0.00
0 2 4 6 8 10
number of up days
26 / 29
R code: stock prices Binomial.R 2020-09-22
all=read.table("prices.txt",header=TRUE)
ge=all[,4]
n=length(ge)
dge=rep(0,n)
idge=rep(0,n)
for (t in 2:n){
dge[t]=ge[t]-ge[t-1]
if (dge[t]>0) {idge[t]=1} else {idge[t]=0}
}
stge=idge[2:n]
sind=cumsum(stge)
tm=seq(1,n-1,by=1)
mat=cbind(tm,sind)
z=mat[tm%%10==0,]
N=rep(0,236)
N[1]=z[1,2]
for (t in 2:236){
N[t]=z[t,2]-z[t-1,2]
}
freq=rep(0,11)
prob=rep(0,11)
x=seq(0,10,by=1)
for (i in 1:11) {
freq[i]=sum(N==i-1)
}
relfreq=freq/sum(freq)
p=sum(stge)/n
for (i in 1:11) {
prob[i]=dbinom(i-1,10,p)
}
z=x+0.125
plot(x,relfreq,xlab="number of up days",ylab="Relative Frequency",type="h",lwd="3",
col="red",main="Fitted Binomial Distribution to GE Stock")
lines(z,prob,type="h",col="blue",lwd=3)
27 / 29
Properties of the Binomial Distribution
▶ Note that the binomial random variable X can be written as
the sum
Pn of n Bernoulli RVs, say, Y1 , Y2 , . . . , Yn , that is,
X = k=0 Yk and we can obtain the mean as
Xn n
X
E [X ] = E [ Yk ] = E [Yk ] = np.
k=0 k=0
V [X ] = np(1 − p).
▶ Why ?