4 Convergence and Simulation
4 Convergence and Simulation
and
Simulation Illustration
1 / 50
Recap and Recheck
i.i.d
In the last lecture, we know that if X1 , . . . , Xn ∼ N (0, 1) then
1
X̄ ∼ N 0, and S 2 ∼ χ2n−1
n
2 / 50
Sample Mean of i.i.d Uniform
1 import numpy as np
2 import scipy . stats
3 from scipy . stats import uniform
4
5 X = uniform ( -1 ,1) # create a random variate U ([ -1 ,1])
6
7 n = 10000 # number of sample
8 X_bar = np . array ([]) # create an array to store values
sample mean
9 for i in range ( n ) :
10 x = X . rvs (100) # generate 100 random numbers from U
([ -1 ,1])
11 x_bar = np . mean ( x ) # generate a sample mean
12 X_bar = np . append ( X_bar , x_bar ) # add sample mean to
the storage array
13
14 # plot histogram of sample mean to have a shape of
distribution of X_bar
15 plt . hist ( X_bar , bins = ’ auto ’)
16 plt . show ()
3 / 50
Histogram of Generated Sample Mean from U([−1, 1])
4 / 50
Asymptotic analysis
5 / 50
In this session
we study and illustrate with simulation some types of convergence
of a sequence of random variables in probability discipline including
convergence
▶ in distribution
▶ in probability
▶ almost surely
which are related to the two important limit theorems. We know
that these limits are useful in statistics inference with the sample
taken from a population with mean µ and variance σ 2
▶ Law of large number (LLN)
X1 + · · · + Xn
X¯n = →µ
n
in probability and almost surely
▶ Central limit theorem (CLT)
Xn − µ
√ → N (0, 1)
σ/ n
in distribution
6 / 50
Sequence of Random Variables
Types of Convergence
Properties of convergence
7 / 50
Here, we would like to discuss what we precisely mean by a
sequence of random variables.
▶ Remember that, in any probability model, we have a sample
space Ω and a probability measure P . A random variable X is
a mapping that assigns a real number to any of the possible
outcome in Ω.
▶ When we have a sequence of random variables
X1 , X2 , X3 . . . , it is also useful to remember that we have an
underlying sample space Ω
8 / 50
Example 1
Consider the following random experiment: A fair coin is tossed
once. Here, the sample space has only two elements Ω = {H, T }.
We define a sequence of random variables X0 , X1 , X2 , X3 , . . . , on
this sample space as follows:
(
1
n+1 if the coin turn Head
Xn =
0 if the coin turn Tail
10 / 50
Example 2 (cont)
11 / 50
Sequence of Random Variables
Types of Convergence
Convergence in Distribution
Convergence in Probability
Almost Surely Convergence
Properties of convergence
12 / 50
Convergence in Distribution
13 / 50
Example 2 - Revisit
14 / 50
Example 3
Consider a sequence of random varible (Xn )n≥1 with c.d.f
1 − 1 − 1 nx if x > 0
n
FXn (x) =
0 otherwise
then for all x > 0
nx
1
lim FXn (x) = lim 1 − 1 − = 1 − e−x
n→∞ n→∞ n
and for all x ≤ 0
lim FXn (x) = lim 0 = 0
n→∞ n→∞
That is
(
1 − e−x if x > 0
lim FXn (x) = = FX (x)
n→∞ 0 otherwise
where X ∼ E(1), i.e. X has exponential distribution with intensity
d
1. In other word, Xn −
→ X or (Xn )n≥0 converges in distribution to
E(1)
15 / 50
16 / 50
Exercise
d
Prove that Xn −
→ E(1)
17 / 50
Convergence in Probability
18 / 50
Example 4
P
Suppose Xn ∼ E(n) then Xn − → 0. That is the sequence
X1 , X2 , . . . converges in probability to the zero random variable X.
19 / 50
Example 4
P
Suppose Xn ∼ E(n) then Xn − → 0. That is the sequence
X1 , X2 , . . . converges in probability to the zero random variable X.
Solution
For any ϵ > 0, we have
Z ∞
P (|Xn − 0| > ϵ) = P (Xn > ϵ) = ne−nx dx = e−nϵ
ϵ
So
P
So Xn −
→0
19 / 50
20 / 50
Exercise
P
Show that Xn −
→0
21 / 50
Some Useful Concentration Inequalities
Markov’s Inequality
If X is a non-negative RV and a > 0 then
E(X)
P (X ≥ a) ≤
a
Chebysev’s Inequality
If X has E(X) = µ and V ar(X) = σ 2 then
σ2
P (|X − µ| ≥ k) ≤
k2
22 / 50
Proof for(Markov’s Inequality.
a, if X ≥ a
Let Y = →Y ≤X
0, otherwise
So
E(X)
E(Y ) ≤ E(X) ⇔ aP (X ≥ a) ≤ E(X) ⇒ P (X ≥ a) ≤
a
23 / 50
Proof for(Markov’s Inequality.
a, if X ≥ a
Let Y = →Y ≤X
0, otherwise
So
E(X)
E(Y ) ≤ E(X) ⇔ aP (X ≥ a) ≤ E(X) ⇒ P (X ≥ a) ≤
a
V ar(X)
P (|X − µ| ≥ k) ≤
k2
23 / 50
Example 5
1 σ2
Let Yn be random variable with E(Yn ) = n and V ar(Yn ) = n
P
where σ > 0 is a constant. Prove that Xn −
→0
24 / 50
Example 5
1 σ2
Let Yn be random variable with E(Yn ) = n and V ar(Yn ) = n
P
where σ > 0 is a constant. Prove that Xn −
→0
Solution
For any ϵ > 0, we have
P
lim P (|Xn − 0| = 0 ⇒ Xn −
→0
n→∞
24 / 50
Exercise
1 σ2
Let Yn be random variable with E(Yn ) = n and V ar(Yn ) = n
where σ > 0 is a constant.
For a given random variable X, consider
Xn = X + Yn
P
Prove that Xn −
→X
25 / 50
Almost Surely Convergence
Definition
A sequence of random variables X1 , X2 , . . . , Xn . . . converges
almost surely to a random variable X if
Example
Revisit example 1, consider the random variable X defined by
X(H) = 0, X(T ) = 0
We have
So
{w ∈ Ω : lim Xn (w) = X(w)} = {H, T } = Ω
⇒ P (w ∈ Ω : lim X (w) = X(w)) = P (Ω) = 1 26 / 50
Exercise
27 / 50
Sufficient Condition for Almost Surely Convergence
Theorem
Consider a sequence of random variables X1 , X2 , . . . . If
∞
X
P (|Xn − X| > ϵ) < ∞
n=1
a.s
for all ϵ > 0 then Xn −−→ X.
28 / 50
Example 6
Consider a sequence X1 , X2 , . . . such that
(
1
n with probability 0.5
Xn =
− n1 with probability 0.5
a.s
Show that Xn −−→ 0
29 / 50
Example 6
Consider a sequence X1 , X2 , . . . such that
(
1
n with probability 0.5
Xn =
− n1 with probability 0.5
a.s
Show that Xn −−→ 0
Solution
For ϵ > 0, we have
1 1
|Xn − 0| > ϵ ⇔ >ϵ⇔n<
n ϵ
Hence
∞ ⌊1⌋
ϵ
⌊1⌋
ϵ
X X X 1
P (|Xn − X| > ϵ) = P (|Xn | > ϵ) = 1=⌊ ⌋<∞
n=1 n=1 n=1
ϵ
a.s
So Xn −−→ 0
29 / 50
Exercise
Yn = min(X1 , X2 , . . . , Xn )
a.s
Prove that Yn −−→ 0
30 / 50
Sequence of Random Variables
Types of Convergence
Properties of convergence
31 / 50
Weak Law of Large Numbers
Theorem
X1 , . . . , Xn : independent and identically distributed RVs (they
have the same distribution) and E(Xi ) = µ, V ar(Xi ) = σ 2 < ∞.
Then for any ϵ > 0
X1 + · · · + Xn
P − µ > ϵ → 0 as n → ∞
n
X1 +···+Xn P
That is the sample mean X¯n = n −
→ µ
32 / 50
Weak Law of Large Numbers
Theorem
X1 , . . . , Xn : independent and identically distributed RVs (they
have the same distribution) and E(Xi ) = µ, V ar(Xi ) = σ 2 < ∞.
Then for any ϵ > 0
X1 + · · · + Xn
P − µ > ϵ → 0 as n → ∞
n
X1 +···+Xn P
That is the sample mean X¯n = n −
→ µ
Proof.
We have E(X̄n ) = µ and V ar(X̄n ) = σ 2 . Apply Chebysev’s
inequality
σ 2 n→∞
P (|X¯n − µ| > nϵ) ≤ 2 −−−→ 0
nϵ
32 / 50
Strong Law of Large Number
Theorem
X1 , . . . , Xn : independent and identically distributed RVs (they
have the same distribution) and E(Xi ) = µ, V ar(Xi ) = σ 2 < ∞.
Then for any ϵ > 0
X1 + · · · + Xn
P − µ > ϵ → 0 as n → ∞
n
33 / 50
Sequence of Random Variables
Types of Convergence
Properties of convergence
34 / 50
Central Limit Theorem
X1 +···+Xn Sn
where X̄n = n = n is the sample mean
35 / 50
Example 7 - CLT 1
36 / 50
The distribution of Sn is closer and closer to the bell shape - the
shape of normal distribution. So is the sample mean X̄n
37 / 50
Example 8 - CLT 2
38 / 50
Proof Idea of CLT
−µ
X̄n√
Prove that the moment generating function of σ/ n
M X̄n√−µ (s)
σ/ n
39 / 50
Outline proof for µ = 0
▶ MaX+b (s) = ebs MX (as)
▶ MX1 +···+Xn (s) = (MX1 (s))n
▶ MX̄n = (MX1 ( ns ))n
√
▶ M X̄√
n (s) = MX̄n ( σ/s√n ) = MX̄n ( s σ n ) = MX1 ( σ√
s
n
)n
σ/ n
▶ Second order Taylor series expansion
E(X12 ) 2 σ2
MX1 (s) = 1 + E(X1 )s + s + o(s2 ) = 1 + s2 + o(s2 )
2! 2
▶
2 !n !n
σ2 s s2
M X̄√
n (s) = 1+ √ + o(s2 ) = 1+ + o(s2 )
σ/ n 2 σ n 2n
s2
→e2
as n → ∞
40 / 50
For µ ̸= 0
as n → ∞
▶ X̄n = Ȳn + µ and then
X̄n − µ Ȳn
√ = √
σ/ n σ/ n
▶
s2
M X̄n√−µ (s) = M Ȳ√
n (s) → e 2
σ/ n σ/ n
as n → ∞
41 / 50
Simulation to illustrate CLT
42 / 50
Delta Method
If Yn has a limiting Normal distribution then the delta method
allows us to find the limiting distribution of g(Yn ) where g is any
smooth function.
Theorem (Delta Method)
Suppose that
Yn − µ d
−
→ N (0, 1)
√σ
n
g(Yn ) − g(µ) d
g ′√
(µ)σ
−
→ N (0, 1)
n
In other word,
! !
σ2 (g ′ (µ)σ)2
If Yn ∼ N µ, then g(Yn ) ∼ N g(µ),
n n
43 / 50
Example 9
Let X1 , ,̇Xn are i.i.d with mean µ and finite variance σ 2 . By CLT
X̄n − µ X1 + · · · + Xn
∼ N (0, 1) where Xn =
√σ n
n
44 / 50
Sequence of Random Variables
Types of Convergence
Properties of convergence
45 / 50
Properties of Convergence
46 / 50
Example
Let X1 , . . . , Xn are i.i.d with mean µ and finite variance σ 2 .
Denote
X1 + · · · + Xn
X̄n =
n
then by weak LLN
X12 + · · · + Xn2 P
→ E(X 2 )
−
n
and
P
X̄n −
→ E(X)
It implies that
P
[X̄n ]2 −
→ [E(X)]2
and
n
1X P
Xi2 − [X̄n ]2 −
→ E(X 2 ) − [E(X)]2 = V ar(X)
n i=1
47 / 50
Homework
48 / 50
content...
49 / 50
content...
50 / 50