DSC4821 Full Study Guide
DSC4821 Full Study Guide
DSC4821 Full Study Guide
STOCHASTIC MODELLING
DSC4821
Study guide
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
2 Probability 7
2.1 LESSON 1: Basic concepts of probability theory . . . . . . . . . . . 7
2.2 LESSON 2: Study solved exercises in Hsu (2014), chapter 1 . . . . 10
2.3 LESSON 3: Test your understanding with supplementary problems 10
3 Random variables 11
3.1 LESSON 4: Definition and basic properties of random variables . . 11
3.2 LESSON 5: Study solved exercises in Hsu (2014), chapter 2 . . . . 15
3.3 LESSON 6: Test your understanding with the supplementary prob-
lems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.4 LESSON 7: Exercises on chapters 1 and 2 . . . . . . . . . . . . . . 16
iii
5.3 LESSON 13: Test your understanding with the supplementary prob-
lems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5.4 LESSON 14: Exercises on chapters 3 and 4 . . . . . . . . . . . . . . 31
6 Estimation theory 39
6.1 LESSON 15: Estimation theory . . . . . . . . . . . . . . . . . . . . 39
7 Stochastic processes 40
7.1 Lesson 16: Generating random numbers using R . . . . . . . . . . . 40
7.2 LESSON 17: Basic properties and examples . . . . . . . . . . . . . 42
7.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
7.2.2 Some important classes of stochastic processes. . . . . . . . 43
7.2.3 Markov processes . . . . . . . . . . . . . . . . . . . . . . . . 45
7.3 LESSON 18: Markov chains and applications to queueing theory . . 47
7.4 LESSON 19: Martingales . . . . . . . . . . . . . . . . . . . . . . . . 47
7.5 LESSON 20: Brownian motion . . . . . . . . . . . . . . . . . . . . 48
7.5.1 Random walk . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.5.2 Brownian motion or Wiener process . . . . . . . . . . . . . . 49
7.5.3 Some properties of Brownian motion . . . . . . . . . . . . . 53
7.5.4 First passage time and maximum of Brownian motion . . . . 54
7.5.5 Simulation of Brownian motion in R . . . . . . . . . . . . . 55
7.5.6 Martingale property of Brownian motion . . . . . . . . . . . 56
7.5.7 Geometric Brownian motion . . . . . . . . . . . . . . . . . . 57
7.6 LESSON 21: Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.7 LESSON 22: More exercises . . . . . . . . . . . . . . . . . . . . . . 59
7.8 LESSON 23: More exercises . . . . . . . . . . . . . . . . . . . . . . 69
iv
8.4 LESSON 27: More exercises . . . . . . . . . . . . . . . . . . . . . . 93
v
Chapter 1
1
Hsu, HP. 2014. Probability, random variables and random processes. 3rd edition.
New York: McGraw-Hill Education.
The purpose of these notes is to guide you through the prescribed book by Hsu in
order to understand this module.
Purpose of the module: Students who have completed this module will be able
to identify and apply relevant concepts and techniques or methods of probability
theory and stochastic processes to construct, design, analyse and solve mathe-
matical models representing real-life problems involving uncertainty that arise in
the fields of operations research, financial modelling, data science and decision
sciences.
Syllabus
• Random variables
• Conditional distribution
• Multivariate distributions
• Poisson processes
• Brownian motion
2
• Stopping times and the optional stopping theorem for martingales
• Estimation theory
Further reading
Assessment criteria
3
Outcome 2: Calculate probabilities relevant to multivariate distributions and
distributions of functions of random variables, and model and solve practical
problems involving these distributions.
Assessment criteria
Outcome 3: Apply the law of large numbers and the central limit theorem to
solve problems related to sums of random variables.
Assessment criteria
– explaining the law of large number and the central limit theorem
– applying these basic limit theorems of probability theory and key in-
equalities in probability theory to solve practical problems
Outcome 4: Formulate basic stochastic process models and analyse such models
qualitatively and quantitatively.
Assessment criteria
4
– classifying a stochastic process with respect to the concepts stationarity,
wide-sense stationarity, ergodicity and independent increments
Assessment criteria
5
Assessment criteria
6
Chapter 2
Probability
(This chapter in these notes corresponds to chapter 1 in the book by Hsu (2014).)
Study chapter 1 in Hsu (2014). Pay careful attention to the key concepts and
properties. Here the basic concepts of probability are clearly presented. You
should be able to define the following concepts:
• Sample sample: This is the set of all possible outcomes of a random ex-
periment. Understand the given examples.
• Event: It is a subset of the sample space. Example: Toss a coin twice. The
sample space is
S = {HH, HT, T H, T T }.
An example of an event is: “The first coin yields H.” This is the event
E = {HH, HT }. Because events are subsets, it is important to remember the
basic concepts and operations of set theory, such as “union”, “intersection”,
“complement”, “null set” and “disjoint sets”. Figure 1-1 is helpful.
7
Note:
∩ni=1 Ai = A1 ∩ A2 ∩ . . . ∩ An
and
∪ni=1 Ai = A1 ∪ A2 ∪ . . . ∪ An .
(i) The set S is itself an element of F and the empty set ∅ is also an
element of F . That is
S ∈ F and ∅ ∈ F .
(iii) The class F is closed under countable union (and also countable inter-
section). That is, if A and B are subsets of S that are in F , then their
union A ∪ B and their intersection A ∩ B are also in F . Moreover, this
is also true for any sequence A1 , A2 , . . . , An , . . . of subsets of S that are
in F :
i=1 Ai = A1 ∪ A2 ∪ . . . ∪ An ∪ . . . ∈ F
∪∞
and
i=1 Ai = A1 ∩ A2 ∩ . . . ∩ An ∩ . . . ∈ F .
∩∞
8
The smallest example of a σ-algebra on an event space S is
F = {S, ∅}.
or ∞
X
P (∪∞
i=1 Ai ) = P(Ai ).
i=1
9
• Independent events: Two events A and B are independent if
P(A ∩ B) = P(A)P(B).
Study solved exercises in Hsu (2014), chapter 1. The solved exercises have been
designed to help you understand the theoretical concepts and their properties.
Study all the problems and their solutions. You may skip problems 1.71 to 1.73.
Solve the supplementary problems in Hsu (2014), chapter 1. Use the hints given at
the end of the chapter and compare your solutions to those provided in the book.
10
Chapter 3
Random variables
Study chapter 2 in Hsu (2014). Understand the definitions and important proper-
ties. From now on we will work in an underlying probability space (S, F , P) even
if we do not always specify it.
1. S ∈ F .
11
On the set R consider all the open intervals (a, b) with a < b. The smallest
σ-algebra containing all these open intervals is called the Borel σ-algebra
on R. We denote it by B. The σ-algebra B is very large. Examples of sets
that are in B are:
R, ∅, (a, b) for all a < b; (−∞, a]∪[b, ∞); [a, b]; (a, b];{a}; [a, ∞) and (−∞, a).
X −1 (A) = {ω ∈ S : X(ω) ∈ A}
{X ≤ a} ∈ F .
And then we can consider its probability P({X ≤ a}). The same applies to
all other Borel sets (e.g. [a, b] and (a, +∞)).
Note that the event
12
Remark: In most cases when the sample space S is finite and has say n
elements, the σ-algebra considered on S is simply its power set P(S) (i.e.
the class consisting of all subsets of S). In this case any function X : S → R
is always a random variable; however when S is the whole real line R or an
interval such as [a, b] or [a, ∞) one must carefully check if indeed the function
X satisfies the condition of the definition before considering X as a random
variable.
1
P({ω1 }) = P({ω2 }) = . . . = P({ωn }) = .
n
(Here we say that all elementary events {ωi } are equally likely.)
• Understand Example 2.2 in Hsu (2014): Here a fair coin is tossed three
times. (By “fair coin” we mean that the two sides are equally likey to
appear.) The sample space is
Assume all the elementary events are equally likely. Here S is finite and then
we take F to be the whole power set of S (every subset of S is in F ). Let
X : S → R be the mapping where X(ω) is the number of heads of ω for all
ω ∈ S. Then X is a random variable. We can compute the probability that
X = 2. That is, P{X = 2}. The question can be reformulated as follows: In
an experiment of tossing a fair coin three times, what is the probability of
obtaining two heads?
Note that
13
and then
P{X = 2} = 3/8.
and
lim FX (x) = 1.
x→+∞
14
3.2 LESSON 5: Study solved exercises in Hsu
(2014), chapter 2
Study the solved exercises in Hsu (2014), chapter 2. These solved exercises have
been designed to help you understand the theoretical concepts and their properties.
Study all the problems and their solutions.
Solve the supplementary problems of chapter 2 in Hsu (2014). Use the hints given
at the end of the chapter and compare your solutions to those provided in the
book.
15
3.4 LESSON 7: Exercises on chapters 1 and 2
After studying chapters 1 and 2 in Hsu (2014) (i.e. after completing lessons 1– 6),
do the following exercises:
Question 1 Five people are sitting at a table in a restaurant. Two of them order
coffee and the other three order tea. The waiter forgot who ordered what
and hands the drinks in a random order to the five persons. Specify an
appropriate sample space and determine the probability that each person
gets the correct drink.
Question 2 In a high school class, 35% of the students take Spanish as a foreign
language, 15% take French as a foreign language, and 40% take at least one
of these languages. What is the probability that a randomly chosen student
takes French given that the student takes Spanish?
Question 4 Suppose that in a certain US state, 55% of registered voters are Re-
publicans, 35% are Democrats and 10% are Independents. When these vot-
ers were surveyed about increased military spending, 25% of the Republicans
opposed it, 70% of the Democrats opposed it and 55% of the Independents
opposed it. (a) What is the probability that a randomly selected voter in
this state opposes increased military spending? (b) A registered voter from
that state writes a letter to the local paper arguing in favour of increased
military spending. What is the probability that this voter is a Democrat?
Question 5 100 patients with gastroesophageal reflux disease are treated with
new a new drug to relieve pain from heartburn. Following treatment, the
time Ti , until the patient i next experiences pain from heartburn is recorded.
16
It is assumed that times are independent and identically distributed, with
the probability density function given by
(
λe−λt for t > 0
fTi (t) =
0 otherwise.
(a) The doctor treating the patients thinks that there is a 50% chance that
a random patient will stay pain free for a least 21 days. Show that the
value of λ on which the doctor’s judgment is based is 0.0330.
(b) Using
1 1
E(Ti ) = and Var(Ti ) = 2
λ λ
find the expectation and variance of the average
100
1 X
T = Ti .
100 i=1
Y −λ
√
λ
An insurance company issues 1 250 vision care insurance policies. The num-
ber of claims filed by a policyholder under a vision care insurance policy
17
during one year is a Poisson random variable with mean 2. Assume the
numbers of claims filed by different policyholders are mutually independent.
Calculate the approximate probability that there is a total of between 2 450
and 2 600 claims during a one-year period.
Hint: Use the fact that the total number of claims follows a Poisson distri-
bution of mean λ = 2 500.
(a) What is the probability that the number of telephone orders is more
than one in one hour?
(c) Use Chebyshev’s inequality (see relation (2.116) in Hsu (2014, p. 86))
to give a lower bound of P (200 ≤ S ≤ 250). Use
(a) Calculate the posterior probability that a part is defective if the test
says it is defective.
18
Question 9 Let Ω = {1, 2, 3, 4} and consider the set
(b) Are the following true of false? Give reasons for your answers.
19
probability that the source is substance A is p.
(a) Give the conditional probability that n emissions are detected given
that the source is substance A.
(c) Show that the conditional probability that the source is substance A
given that n emissions are detected denoted p(A|n) is given by
1
p(A|n) = 1−p −1.8
.
4.9 n
1+ p
e 3.1
p(B|n) ≥ p(A|n)
Question 12 Suppose that X and Y are random variables where both X 2 and
Y 2 have finite expectations; that is,
(a) Develop E(g(t)) and using the obvious fact that E(g(t)) ≥ 0 for all
t ∈ R, show that
p p
|E(XY )| ≤ E(X 2 ) E(Y 2 ).
20
(b) Deduce from (a) that if E(X 2 ) if finite, so is E(X), and in fact
|E(X)|2 ≤ E(X 2 ).
(c) Deduce from (b) that if X is a random variable having a finite mean µ,
E(X 2 ) is finite if and only if Var(X) is finite; that is,
(c) Assume that the amount spent by each customer follows the normal
distribution. Compute the same probability
21
holder is classified as
Of these policyholders, 3 000 are young, 4 600 are male, and 7 000 are mar-
ried. The policyholders can also be classified as 1 320 young males, 3 010
married males, and 1 400 young married persons. Finally, 600 of the poli-
cyholders are young married males. Calculate the number of the company’s
policyholders who are young, female and single and calculate the probability
that a randomly selected policyholder is young, female and single. Hint:
Draw Venn diagrams.
p(n + 1) = 0.2p(n)
where p(n) represents the probability that the policyholder files exactly n
claims during the period. Under this assumption, calculate the probability
that a policyholder files more than one claim during the period.
22
Age of Probability Portion of Company’s
Driver of Accident Insured Drivers
18–20 0.06 0.08
21–30 0.03 0.15
31–65 0.02 0.49
66–99 0.04 0.28
A randomly selected driver that the company insures has an accident. Cal-
culate the probability that the driver was aged 18 to 20.
Given that a patient survived, calculate the probability that the patient was
categorised as serious upon arrival.
1
P (N = n) = , n = 0, 1, 2, . . .
(n + 1)(n + 2)
(Note that
∞
X 1
=1
n=0
(n + 1)(n + 2)
23
given that there have been at most four claims during that month.
Calculate the expected total amount of refunds from the sale of 100 printers.
2 000P (X ≤ 1) + 1 000P (1 ≤ X ≤ 2) + 0P (X ≥ 2)
24
Chapter 4
We consider our underlying probability space (S, F , P) and the Borel σ-algebra
B on R. We also consider the Borel σ-algebra on R2 and Rn in general. Borel
σ-algebra on R2 is the smallest σ-algebra on R2 containing subsets of the form:
for all a < b and c < d in R. This implies in particular that if A and B are
Borel subsets of R, then A × B is a Borel subset of R2 . Other examples of Borel
subsets of R2 are: the unit disc D = {(x, y) ∈ R2 : x2 + y 2 ≤ 1} and the circle
{(x, y) ∈ R2 : x2 + y 2 = 1}.
25
• A bivariate random variable (X, Y ) is a function
{ω ∈ S : (X(ω), Y (ω)) ∈ A}
26
• N-variate random variable: The notion of a bivariate random variable is
easily extended to n-variate ranom variate. Here we have n random variables
(X1 , X2 , . . . , Xn ). The joint cdf is
Study solved exercises in Hsu (2014), chapter 3. These solved exercises have been
designed to help you understand the theoretical concepts and their properties.
Study all the problems and their solutions. You may skip Exercises 3.21, 3.24,
3.46 and 3.54.
Solve the supplementary problems in Hsu (2014), chapter 3. Use the hints given at
the end of the chapter and compare your solutions to those provided in the book.
27
Chapter 5
28
Set
Z = g(X, Y ) and W = h(X, Y ).
• Understand how to determine the pdf and cdf of g(X) and g(X, Y ), and
the joint pdf and cdf of (Z, W ). This extends to n-variate random variables.
E[g(X)] ≥ g(E[X]).
• Understand the weak law of large numbers, the strong law of large numbers
and the central limit theorem.
Study the solved exercises in Hsu (2014), chapter 4. These solved exercises have
been designed to help you understand the theoretical concepts and their properties.
Study all the problems and their solutions. You may skip Exercises 4.35, 4.37 and
4.43.
29
5.3 LESSON 13: Test your understanding with
the supplementary problems
Solve the supplementary problems in Hsu (2014), chapter 4. Use the hints given at
the end of the chapter and compare your solutions to those provided in the book.
30
5.4 LESSON 14: Exercises on chapters 3 and 4
After studying chapter 3 and chapter 4 in Hsu (2014) (i.e. after completing lessons
8–14), do the following exercises:
Question 2 A hurricane policy covers both water damage, X, and wind damage,
Y , where X and Y have the joint density function
Question 3 At the start of a week, a coal mine has a high-capacity storage bin
that is half full. During the week, 20 loads of coal are added to the stor-
age bin. Each load of coal has a volume that is normally distributed with
mean 1.50 cubic metres and standard deviation 0.25 cubic metres. During
the same week, coal is removed from the storage bin and loaded into 4 rail-
road cars. The amount of coal loaded into each railroad car is normally
distributed with mean 7.25 cubic metres and standard deviation 0.50 cubic
metres. The amounts added to the storage bin or removed from the storage
bin are mutually independent.
Calculate the probability that the storage bin contains more coal at the end
of the week than it had at the beginning of the week.
31
Hint: Let K be the amount of coal in the storage bin at the beginning
of the week, X the total amount of coal added to the storage bin and Y
the amount of coal removed from the storage. You are asked to compute
P {K + X − Y > K}, that is, P {X − Y > 0}. Use the fact that the
sum of independent normally distributed random variables is also a nor-
mally distributed random variable (with appropriate mean and variance).
2
More precisely, if X ∼ N (µX , σX ) and Y ∼ N (µY , σY2 ), and X and Y are
independent, then
2
X + Y ∼ N (µX + µY , σX + σY2 ).
Question 5 The annual profits that company A and company B earn follow a
bivariate normal distribution.
Company A’s annual profit has mean 2 000 and standard deviation 1 000.
Company B’s annual profit has mean 3 000 and standard deviation 500.
Calculate the probability that company B’s annual profit is less than 3 900,
32
given that company A’s annual profit is 2 300.
Question 6 The number of minor surgeries, X, and the number of major surg-
eries, Y , for a policyholder this decade have the joint cumulative distribution
function
F (x, y) = 1 − (0.5)x+1 1 − (0.2)y+1
Question 7 Every day, the 30 employees at an auto plant each has probability
0.03 of having one accident and zero probability of having more than one
accident. Given there was an accident, the probability of it being major is
0.01. All other accidents are minor. The numbers and severities of employee
accidents are mutually independent. Let X and Y represent the numbers
of major accidents and minor accidents, respectively, occurring in the plant
today for a single employee.
Denote by p(x, y) the joint mass distribution of the random variables X and
Y.
(a) Compute
p1 (0, 0); p1 (1, 0); p1 (0, 1) and p1 (1, 1).
(b) Deduce the joint moment–generating function, MX,Y (s, t) of the ran-
dom variables X and Y .
(c) Let V and W represent the total numbers of major accidents and minor
accidents, respectively, occurring in the plant today for all the 30 em-
ployees. Compute the joint moment–generating function, MV,W (s, t).
Substantiate your answer.
Question 8 Let X be the annual number of hurricanes hitting City A and let Y
be the annual number of hurricanes hitting City B. Assume X and Y are in-
dependent Poisson variables with respective means 1.70 and 2.30. Calculate
V ar(X − Y |X + Y = 3).
33
Question 9 Two random variables U and V have a joint distribution function as
tabulated below:
pU,V (u, v) u=0 u=1 u=2
v=0 0.1 0.05 0.3
v=1 0.05 0.25 0.25
(a) Find the marginal probability mass functions of U and V .
Let U = X + Y and V = 2X − Y − 3.
Find!the mean vector and the covariance matrix of the random vector W =
U
.
V
Question 11 Let R be the region
R = {(x, y) : 0 ≤ x ≤ 1, 0 ≤ y ≤ 1/2}
and let X and Y be random variables with joint probability density function
(
k(x + 2y), (x, y) ∈ R
fX,Y (x, y) =
0 otherwise.
34
(c) Let 0 ≤ x ≤ 1. Find the conditional probability density function of Y
given that X = x.
Question 12 The continuous type random variables X and Y have the joint
density function
(
x+y if 0 < x < 1 and 0 < y < 1
fX,Y (x, y) =
0 otherwise.
(b) Use this moment–generating function to compute the first and second
moments of X.
Question 14 Suppose that an analyst determines that the revenue (in rands) that
a small restaurant makes in a week is a random variable, X, with moment–
generating function
1
MX (t) = .
(1 − 25 000t)4
Find the standard deviation of the revenue that the restaurant makes in a
week.
35
Let X represent the combined losses from the three cities. Calculate the
moment E(X 3 ).
1 1 1 1
MX (t) = e−2t + e−t + et + e2t ,
6 3 4 4
find
P {|X| ≤ 1}.
(Hint: If necessary use the same argument as in Problem 4.60 (b) in Hsu
(2014, p. 191).
PX (t) = e−0.2(1−t)
Use the central limit theorem to show that the distribution of the random
variable Yλ converges to the distribution of the standard normal distributed
for λ → ∞.
Question 19 (a) Give the characteristic function for the uniform distribution
on the interval [−1, 1].
Here you need to compute the integral
Z ∞
ϕ(t) = ejxt f (x)dx
−∞
36
where f (x) is the pdf of the uniform distribution on [−1, 1].
1
ϕX (t) = (2 cos(t) + 3 cos(2t) + j sin(2t)) .
5
Note that in the section 4.8, Characteristic functions (Hsu 2014, p. 156), the
complex number i such that i2 = −1 is denoted as j.
A complex number is a number of the form a + bj, where a and b are real
numbers and j is such that j 2 = −1. Recall that there is no real number
x such that x2 = −1. Then j is not a real number. Example: 2 + 3j
is a complex number. The set of complex number is denoted C. Clearly,
R ⊂ C. Generally the complex number j is denoted as i and then a + bj is
also denoted as a + bi.
37
who exceed their contracted time allowance; that is,
X1 + X2 + . . . + Xn
X=
n
(a) Determine the mean and standard deviation of the mean excess time
X.
(b) Using the central limit theorem, find an estimate of the probability
that the mean excess time used by the 100 customers in the sample is
between 24 and 26 minutes; that is, find P {24 < X < 26}.
(c) Suppose that one customer who exceeds the time limit for his cell phone
contract is randomly selected. Find the probability that this individual
customer’s excess time is between 24 and 26 minutes.
(d) Explain why the probabilities in (b) and (c) are different.
(e) Find the 95th percentile for the sample mean excess time for samples
of 100 customers who exceed their basic contract time allowances; that
is, determine k such that P {X < k} = 0.95.
38
Chapter 6
Estimation theory
• Solve the supplementary problems and compare your solutions to those pro-
vided in the book.
39
Chapter 7
Stochastic processes
The following codes can be used to generate or sample a list of n random numbers
from the given distributions:
• Log normal distribution whose logarithm has mean equal to meanlog and
standard deviation equal to sdlog
rlnorm(n, meanlog, sdlog)
• Truncated normal distribution on the interval (a, b) (Here you need the
package “truncnorm”.)
rtruncnorm(n, a, b, mean, sd)
40
• Poisson distribution of parameter lambda
rpois(n, lambda)
• Discrete uniform distribution with parameters min, max (here you need the
package “fitur”)
rdunif(n, min, max)
41
ample)
7.2.1 Introduction
42
such as intervals [0, a], {0, 1, 2, . . . , n} or the whole set N. If T is an interval or
the full set [0, ∞), we say that the stochastic process {X(t) : t ∈ T } is a process
with a continuous time parameter, and if T is N or a subset of N, we say that the
process has a discrete time parameter.
Stock prices are generally modelled by stochastic processes. For a given stock,
X(t) or Xt represents the price at time t.
43
1500
1000
500
0
2005 2010 2015 2020
Figure 7.1: Plot of the stock price for GOOGLE since 1 January 2000
50
40
30
20
10
0
2000 2005 2010 2015 2020
Figure 7.2: Plot of the stock price for S&P500 since 1 January 2000
44
7.2.3 Markov processes
• A discrete-state Markov process (i.e. a Markov process that can only take a
finite of infinitely countable number of values) is called a Markov chain. For
a discrete-time and discrete-state Markov chain {Xn : n ∈ N}, we have that
for every n and all states i0 , i1 , . . . , in−1 , i, j,
45
X is the matrix P = (pij ) defined by
Note that ∞
X
pij ≥ 0 for all i, j and pij = 1 for all j.
j=0
P{Xn = j|X0 = i}
with
p0 (n) + p1 (n) + p2 (n) + . . . = 1.
p(n) = p(0)P n
46
• Understand the concepts accessible state, recurrent state, transient state,
period state, absorbing state, fundamental matrix, stationary distribution
and limiting distributions.
• Understand the concepts renewal process, counting process and Poisson pro-
cess.
• Understand the definition of a stopping time and the optional stopping the-
orem.
47
7.5 LESSON 20: Brownian motion
• X0 = 0.
1
P{Xn+1 − Xn = 1} = P{Xn+1 − Xn = −1} = .
2
1
P{ξn = 1} = P{ξn = −1} = .
2
is a random walk.
n: number of steps
X0 = 0
For k = 1 to n do
Generate xi in {-1, +1} with equal probability
Xk = Xk + xi
Keep record of all the Xk’s.
48
20 40 60 80 100
-5
-10
-15
n <- 100
X0 <- 0
L <- c(X0)
X <- X0
for(k in 1:n){
xi <- sample(c(-1,1), 1,prob = c(1/2, 1/2))
X <- X + xi
L <- append(L, X)
}
where
n
= 0 if (n + k)/2 is not an integer.
(n + k)/2
49
A Brownian motion is a stochastic process X = {Xt : t ≥ 0} defined on a proba-
bility space (Ω, F , P) satisfying the following properties:
1. X0 = 0.
3. For each t the random variable Xt has the normal distribution with mean 0
and variance t.
4. For 0 < t1 < t2 < . . . < tn and real numbers a1 , a2 , . . . , an the sum
has also the normal distribution. This means that (Xt )t≥0 is a Gaussian
process.
1 − x2
f (x) = √ e 2t , −∞ < x < +∞.
2πt
In particular, Z a
1 − x2
P{X(t) ≤ a} = √ e 2t dt
−∞ 2πt
and in general if A1 , A2 , . . . , An are Borel subsets of the reals, then
50
is given by
x2 2
2
1 + (x2 −x1 ) +...+ (xn −xn−1 )
Z Z Z
− 12 t1 (t2 −t1 ) (tn −tn−1 )
... e dx1 dx2 . . . dxn .
A1 A2 An
Intuitively the Brownian motion on a bounded interval [0, T ] can be seen as a limit
of a random walk rescaled as follows:
1
P{ξk = 1} = P{ξk = −1} = .
2
• Fix a number n ∈ N.
• Set
S0 = 0 and Sk+1 = Sk + ξk .
• Set
Sk
X(0) = 0 and X(tk ) = √ , k = 1, 2, 3 . . . , n.
n
• Join these points to find the values of intermediary time points t ∈ [0, T ].
That is
X(t) = Sb nt
T
c
where
nt nt
b c is the largest integer m such that m ≤ < m + 1.
T T
R Code
51
0.8
0.6
0.4
0.2
-0.2
T <- 3
n <- 1000
S0 <- 0
RW <- c(S0)
S <- S0
for(k in 1:n){
xi <- xi <- sample(c(-1,1), 1,prob = c(1/2, 1/2))
S <- S + xi
RW <- append(RW, S)
}
BM <- RW/sqrt(n)
B <- function(t){
u<- floor(n * t/T)
return(BM[u+1])
}
t <- seq(0,3,T/n)
plot(t, B(t),
main="Random walk approximation of Brownian motion on [0, 3]",
ylab="B(t)",
type="l",
col="blue")
52
7.5.3 Some properties of Brownian motion
Let Fs , for s > 0, be the sub σ–algebra of F generated by the family (Xu : 0 ≤
u ≤ s) of random variables. That is, Fs describes the past (together with the
present) of the Brownian motion up to time s. It contains all the information
pertaining to the Brownian motion from the origin until time s. Similarly, the
sub–σ-algebra spanned by (Xu : u > s) describes the future of Brownian motion
from time s.
Assume that a Bronwian motion traveller started her journey at the origin (point
0) and currently at time s she is situated at position a on the real line. That is,
she has already spent s units of time (say four hours). Does she get tired? Bring
in a fresh Brownian motion traveller and ask him to start his journey at position a
where the first traveller is currently situated. The probability that after t hours the
first traveller will enter a given region is the same probability that after t hours the
second traveller will enter the same region (whether near or far from the current
position a). In other words, the fresh traveller will neither be faster nor slower
than the first traveler. That is, the first four hours spent by the first traveller did
not alter her movement. She is still as fresh as the new traveler at any point in
time. The past is irrelevant, only the present position matters.
The probability of the future given the present and the past is equal to the prob-
ability of the future given the present. Here the past is irrelevant.
That is the Markov property of Brownian motion. It is easy to see that the random
walk also has the Markov property.
53
Example Find
It is the same as
P{X(3) < 5|X(2) = 1}.
because the increments are independent (the random variables X(3) − X(2) and
X(2) are independent).
Assume that a Brownian traveller (starting at the 0) reaches level 5 for the first
time at time t = 3. What is the probability that she will be beyond level 8 at time
T = 4? This is simply
P{X(4) − X(3) > 3}.
Note: Any process that satisfies the Markov property is called a Markov process.
The first time a Brownian path reaches level a is called the passage time (or more
precisely first passage) at level a. We denote it τa . It is also a random variable.
2 x2
fMT (x) = √ e− 2T , 0 ≤ x < ∞.
2πT
54
0.5
-0.5
-1.0
-1.5
To simulate and plot a standard Brownian motion on the interval [0, T ] with n
steps, use the following code:
T <- 3
n<- 1000
dt <- T/n
t <- seq(0, T, dt) # time
## first, simulate a set of random deviates
x <- rnorm(n,0,1)*sqrt(dt)
## now compute their cumulative sum
x <- c(0, cumsum(x))
plot(t, x,
main="Simulation of Brownian motion on [0, 3]",
ylab="B(t)",
type="l")
55
Exercise: Simulate 10 000 standard Brownian motion paths on the interval [0, 1]
(use n = 1 000 steps), find the maximum of each path and give the corresponding
histogram. Estimate the probability that the maximum is less than or equal to 1.
Compare your answer to the exact value. Consider the following code:
m<- 10000
T <- 1
n<- 1000
dt <- T/n
t <- seq(0, T, dt)
ListMax <- c()
for(i in 1:m){
x <- rnorm(n,0,1) *sqrt(dt)
x <- c(0, cumsum(x))
mx <- max(x)
ListMax <- append(ListMax, mx)
}
hist(ListMax)
mean(ListMax <= 1)
E (X(t)|Fs ) = X(s).
Here, as we already know, Fs contains all the information related to the process
up to time s.
56
7.5.7 Geometric Brownian motion
Given real numbers µ and σ with σ > 0, if {W (t) : t ≥ 0} is the Brownian motion,
then the process {S(t) : t ≥ 0} defined by
σ2
S(t) = S0 e(µ− 2
)t+σW (t)
is called the geometric Brownian motion. The parameter µ is the drift, σ is the
volatility and S0 is the initial value S(0). The process is the solution to the
following stochastic differential equation:
(
dS(t) = µS(t)dt + σS(t)dW (t)
S(0) = S0
that is
√
S(ti+1 ) = S(ti ) + µS(ti )∆ + σS(ti )ξi ∆
n <- 1000;
T <- 3;
57
150
140
130
120
110
100
mu <- 0.14;
sigma <- 0.20;
dt <- T/n;
S0 <- 100; (*just an example*)
xi <- rnorm(n, 0,1)
S <- S0;
GBM <- c(S0);
for(k in 1:n){
ti <- k*dt;
xi <- rnorm(1,0,1)
S <- S * (1 + mu*dt + (sigma)* xi* sqrt(dt))
GBM <- append(GBM, S)
}
58
7.6 LESSON 21: Exercises
Question 1 Consider the Markov chain whose transition probability matrix is:
0 0 1 0 0 0
0 0 0 0 0 1
0 0 0 0 1 0
P = 1 .
1 1
3
3 3
0 0 0
1 0 0 0 0 0
1 1
0 2
0 0 0 2
59
The transition matrix is:
1 1 1
4 2
0 4
1 1 1
0 2 4 4
P =
0 0 1 1
.
2 2
0 0 0 1
(a) Classify the four states as transient or recurrent and give reasons for
your answers. What does this tell you about the long-run fate of some-
one with this disease?
(c) Determine (i) the probability that a patient whose symptoms are mod-
erate will be permanently disabled two years later; and (ii) the proba-
bility that a patient whose symptoms are under control will have severe
symptoms one year later.
(d) Calculate the probability that a patient whose symptoms are moderate
will have severe symptoms four years later.
(e) Write out the transition matrix for this new Markov chain and classify
the states as transient or recurrent.
(g) The annual cost of health care for each patient is 0 in state 1, $1 000 in
state 2, $2 000 in state 3 and $8 000 in state 4. Calculate the expected
annual cost per patient when the system is in steady state.
60
tributed random variables such that
1 2
P {Xn = 1} = and P {Xn = −1} = .
3 3
Define
Sn = X1 + X2 + . . . + Xn
(a) What is the probability that he caught exactly two fish by 10:00 yes-
terday?
(b) What is the probability that he caught exactly two fish by 10:00 yes-
terday and five fish by 11:00 yesterday?
(c) What is the expected time that he caught his fifth fish?
(d) Suppose that we know that by 13:00 yesterday he caught exactly three
fish. What is the probability that by 14:00 yesterday he caught a total
of exactly ten fish? And what is the probability that he caught his first
fish after 10:00 yesterday?
(e) Suppose that we know that he did not catch any fish until after 10:00
yesterday. Given that information, what is the expected time that he
caught his first fish?
(a) Suppose that I arrive at the platform and intend to take the first west-
bound train that arrives. What is the expected time I have to wait until
the first train arrives?
(b) After ten minutes, no train has arrived and I am still on the platform.
What is the expected further time I have to wait until the first train
61
arrives?
(b) For 0 < s < t, write a formula for the conditional pdf of B(t) given
B(s) = x.
(c) For 0 < s < t, write a formula for the conditional pdf of B(s) given
B(t) = x.
(d) Using conditions defining the Brownian motion, give a detailed proof
of the Brownian scaling property: {X(t), t ≥ 0} defined by X(t) =
√
cB(t/c) is also a Brownian motion, for c > 0 fixed.
(f) For the geometric Brownian motion {X(t) = eB(t) , t ≥ 0}, calculate
E[X(t)] and V ar[X(t)].
(a) Using the fact that limt→0 tB(1/t) = 0, show that the process {X(t) :
t ∈ [0, 1]} defined by
X(t) = tB(1/t)
Show that this process is Gaussian, and find its mean and covariance
functions.
62
(c) With the Brownian bridge defined in question (b), show that the process
{W (t) : t ∈ [0, 1]} defined by
t
W (t) = (1 + t)X , 0≤t≤1
1+t
(a) Given t > 0, state the distribution of B(t), including any parameters.
(b) Given real numbers 0 ≤ s < t, determine the joint probability density
function
fB(s),B(t) (x1 , x2 ).
Sn2 − Tn2 : n = 1, 2, . . .
is a martingale.
(a) What is the probability that the first particle appears after three min-
utes?
(b) What is the probability that the first particle appears after three min-
utes but before five minutes?
(c) What is the probability that exactly one particle is emitted in the in-
terval from three to five minutes?
(d) What is the probability that exactly one particle is emitted in the inter-
val from zero to four minutes, and that exactly one particle is emitted
in the interval from three to five minutes?
63
Question 11 Let H be a real number such that 0 < H < 1. A Gaussian process
{X(t) : t ≥ 0} is called a fractional Brownian motion with Hurst parameter
H if
(i) X(0) = 0.
(a) Prove that for a fractional Brownian motion {X(t) : t ≥ 0}, the auto-
covariance function is given by
1 2H
t + s2H − |t − s|2H .
KX (t, s) = E[X(t)X(s)] =
2
(b) Prove that for H = 1/2, a fractional Brownian motion also has indepen-
dent increments and hence it is a Brownian motion, but for H 6= 1/2,
a fractional Brownian motion does not have independent increments.
An analyst considers historical data and model the dynamics of the company
accounts as a Markov chain with the following one-month transition matrix
(with respect to the states
P, B, C, I in that order):
64
1.00 0.00 0.00 0.00
0.00 1.00 0.00 0.00
T =
0.70
.
0.00 0.00 0.30
0.35 0.65 0.00 0.00
Once a debt is paid (i.e., once the item enters state P), the probability of
moving to state B, C, or I is obviously zero. If a debt is in state C at
the beginning of the month, then at the end of the month, there is a 0.70
probability that it will enter state P and a 0.30 probability that it will enter
state I. If a debt is in state I at the beginning of the month, then at the end
of the month, there is a 0.35 probability that it will enter state P and a 0.65
probability that it will become a bad debt. Finally, after an account has
been listed as a bad account (i.e. state B), it is transferred to the company
overdue accounts section for collection.
(a) Classify the four states as transient, recurrent or absorbing states, and
give reasons for your answers.
where
!
0.70 0.00
R=
0.35 0.65
65
where Φ is the fundamental matrix of the Markov chain (see relation (5.50)
in in Hsu (2014, p. 215)). The answer is of the form (a, b) where a is the
amount that will be paid while the amount b will be declared as bad debt.
Question 13 (Background)
66
remain one month old, a 0.46 probability that the entire bill would be carried
over so that it was two months old, and a 0.32 probability that the bill would
be paid in the month. For bills two months old, there was a probability of
0.54 that the oldest portion would be paid so that the bill would remain
one month old, a 0.16 probability that the next-oldest portion of the bill
would be paid so that it would remain two months old, a 0.18 probability
that the bill would be paid in the month, and a 0.12 probability that the bill
would be listed as a bad debt and turned over to a collection agency. If a
bill has been paid or listed as a bad debt, it would no longer move to any
other billing status. Under normal circumstances (i.e. not a holiday season),
the store averaged $1 350 000 in outstanding bills during an average month;
$750 000 of this amount would be current, $400 000 would be one month old,
and $200 000 would be two months old. The vice president of finance for the
store wanted Carla to determine how much of this amount would eventually
be paid or end up as bad debts in a typical month. She also wanted Carla
to tell her if an average cash reserve of $60 000 per month would be enough
to cover the expected bad debts that would occur each month.
Hint: First determine the transition matrix and follow the same argument
as in the previous question to answer this question.
(a) Show that the probability that a driver classified as standard at the
beginning of the first year would be classified as standard at the start
67
Table 7.1: One-year transition probabilities matrix
Ratings at year-end
Initial ratings AAA AA A BBB BB B CCC Default
(b) Show that the probability that a driver classified as standard at the be-
ginning of the first year would be classified as standard at the beginning
of each of the first four years is 0.125.
Question 15 Over time, bonds are liable to move from one rating category to
another. This is sometimes referred to as credit ratings migration. Rating
agencies use historical data to produce a rating transition matrix. This
matrix shows the probabiltiy of a bond moving from one rating to another
during a certain period of time. Usually the period of time is one year.
Table 7.1. gives a rating transition matrix produced from historical data by
Standard and Poor’s (S&P) in 2001.
(a) Classify the states of ratings (transient or recurrent). What ratings are
absorbing states?
68
(b) Determine the classes of communicating states.
(d) Now consider what will happen in the long run, assuming that the
transition matrix above operates every year. In the long run, what
fraction of bonds are in state AAA? What fraction of bonds are in
default?
Question 1 The performance of a system with one processor and another with
two processors are compared. Let the interarrival times of jobs be exponen-
tially distributed with parameter λ = 1 job per second. Let’s first consider
the system with one processor. The service time of the jobs is exponentially
distributed with a mean of 0.5 seconds.
(1) For an increase of λ with 10%, how much will the response time (i.e.
the total time for a job in the system) increase?
(2) Calculate the average waiting time, the average number of customers
in the server and the utilisation of the server. What is the probability
of the server being empty?
Let’s now compare this system with a system of two cheaper processors, each
with a mean service time of one second.
(1) For an increase of λ with 10%, how much will the response time in-
crease?
(2) Calculate the average waiting time, the average number of customers
in the server and the utilisation of the server. What is the probability
of both of the servers being busy?
Question 2 A take-away food counter has one server. Customers arrive randomly
at a rate of λ per hour. If there is a queue, some customers go elsewhere
69
1
so that the probability of a potential customer staying for service is n+1
when there are n customers in the shop already waiting or being served.
Service times are independent, but the server is new to the job and tends to
µ
make mistakes under pressure, so the rate of service drops to n+1 per hour
when there are n customers present, where µ > λ. Model this system as a
birth-and-death process.
λ
pn = (n + 1)ρn p0 , with ρ = .
µ
(b) Show that the server will be busy for a proportion ρ(2 − ρ) of the time.
Hint: You may need to use the identity
∞
X 1
(n + 1)xn = for |x| < 1.
n=0
(1 − x)2
(i) relocating one of the scanners to the opposite end of the shop so that
there will be separate queues for each machine, with customers assumed
equally likely to enter either queue
(ii) selling one scanner, leaving only one to serve all the customers
For the three possible options (including the existing setup) calculate, where
possible, the proportion of customers who will be served immediately on
arrival (i.e. without joining the queue) and advise the manager appropriately.
70
probability mass function (where 0 < θ < 1 is a parameter):
X 0 1 2 3
P(X) 2θ/5 3θ/5 2(1 − θ)/5 3(1 − θ)/5
The following ten independent observations were sampled from such a dis-
tribution:
(2; 0; 3; 2; 2; 2; 1; 0; 1; 1).
Question 5 A telephone switch has ten output lines and a large number of in-
coming lines. Upon arrival a call on the input line is assigned an output
line if such line is available – otherwise the call is blocked and lost. The
output line remains assigned to the call for its entire duration, which is of
exponentially distributed length. Assume that 180 calls per hour arrive in
Poisson fashion, whereas the mean call duration is 110 seconds.
(1) Determine the blocking probability, that is the probability that a ran-
dom call will be blocked.
(2) On average, how many calls are rejected per hour? Substantiate your
answer.
(3) What is the proportion of time that all ten output lines are available?
71
Question 7 A small bank has two tellers, one for deposits and one for with-
drawals. The service time for each teller is exponentially distributed with
a mean of one minute. Customers arrive at the bank according to a Pois-
son process, with mean rate 40 per hour. It is assumed that depositors and
withdrawers constitute separate Poisson processes, each with mean rate 20
per hour, and that no customer is both a depositor and a withdrawer. The
bank is thinking of changing the current arrangement to allow each teller to
handle both deposits and withdrawals. The bank would expect that each
teller’s mean service time would increase to 1.2 minutes, but it hopes that
the new arrangement would prevent long lines in front of one teller while
the other teller is idle, a situation that occurs from time to time under the
current setup. Analyse the two arrangements with respect to the average
idle time of a teller and the expected number of customers in the bank at
any given time.
Question 8 A service station has one petrol pump. Cars arrive at the station
according to a Poisson process at a mean rate of 15 per hour. However, if
the pump is already being used, these potential customers may balk (drive
on to another service station). In particular, if there are already n cars in the
service station, the probability that an arriving potential customer will balk
is n/3 for n = 1, 2, 3. The time required to service a car has an exponential
distribution with a mean of four minutes.
(d) Find the expected time spent in the system for those cars that stay.
72
with probability mass function
Question 10 A bank employs four tellers to serve its customers. Customers arrive
according to a Poisson process at a mean rate of two per minute. However,
business is growing and management projects that the mean arrival rate will
be three per minute a year from now. The transaction time between a teller
and a customer has an exponential distribution with a mean of one minute.
(a) Use the M/M/s model to determine how well these guidelines are cur-
rently being satisfied.
(b) Evaluate how well the guidelines will be satisfied a year from now if no
change is made in the number of tellers.
Hint: Use the fact that in an M/M/s system, if Wq denotes the time that
a customer spends waiting in the queue, then
s−1
!
X
P {Wq > t} = 1− Pn e−sµ(1−ρ)t .
n=0
Question 11 The time T (in seconds) for a chemical reaction to take place at a
73
certain pressure has the distribution
( 2
2βte−tβ if t > 0
fT (t) =
0 otherwise
74
Chapter 8
This chapter is not part of the syllabus, but it contains useful concepts and tech-
niques with applications in financial modelling.
8.1.1 Definition
The definition is not difficult to understand. We start with very simple cases.
75
(a) For 0 ≤ a ≤ b, by definition
Z b
dW (s) = W (b) − W (a)
a
Z b Z b
3dW (s) = 3 dW (s) = 3(W (b) − W (a))
a a
Z b
0 dW (s) = 0
a
Z t
dW (s) = W (t) − W (0) = W (t), for t ≥ 0.
0
(Clearly these stochastic integrals are random variables, not real numbers.)
Example 1: Compute the mean and variance of
Z 10
1[1,14] dW (s).
0
(b) If G is a fixed random variable (defined on the same probability space as the
process {W (t) : t ≥ 0}) and G does not depend on time t in all the interval
[a, b] and G is measurable with respect to Fa (this means intuitively that G
is completely determined by the information available at time t = a), then
Z b Z b
GdW (s) = G dW (s) = G(W (b) − W (a)).
a a
76
(c) From (a) and (b) we can easily compute the stochastic integral of the form
Z t
G1 1[a1 , b1 ] (s) + G2 1[a2 , b2 ] (s) + . . . + Gn 1[an , bn ] (s) dW (s)
0
a1 ≤ b 1 ≤ a2 ≤ b 2 . . . ≤ an ≤ b n
In fact,
Z t
G1 1[a1 , b1 ] (s) + G2 1[a2 , b2 ] (s) + . . . + Gn 1[an , bn ] (s) dW (s)
0
Z t Z t Z t
= G1 1[a1 , b1 ] (s)dW (s) + G2 1[a2 , b2 ] (s)dW (s) + . . . + Gn 1[an , bn ] (s)dW (s).
0 0 0
That is,
n
! n Z
Z t X X t
Gi 1[ai , bi ] (s) dW (s) = Gi 1[ai , bi ] (s)dW (s) .
0 i=1 i=1 0
77
(d) What can we do to define the stochastic integral
Z t
H(s)dW (s)
0
(i) The process {Hs : s ≥ 0} is adapted to the filtration {Fs : s ≥ 0}. This
means that for every s ≥ 0, the random variable Hs is measurable with
respect to the σ-algebra Fs (defined by the available information of the
dynamics of the Wiener process up to time s).
R∞
(ii) The expectation of the random variable 0 Hs2 ds is finite, that is
Z ∞
E Hs2 ds < ∞.
0
78
If these two conditions are verified, then there exists a sequence (Hsn ) of
simple processes that converges to the process (Hs ) in the sense that
Z ∞
lim E (Hsn 2
− Hs ) ds = 0.
n→∞ 0
(e) Note: We have briefly discussed how the stochastic integral with respect
to Brownian motion is defined. Note that in the general setting we will not
use the definition to calculate stochastic integrals. We will discuss the Itô
formula and see how it can be used to calculate some special stochastic in-
tegrals explicitly. However, note that it is generally very difficult to calculate
stochastic integrals.
Before discussing Itô’s formula, we need to study some beautiful properties of the
stochastic integral.
(i) The process {At : t ≥ 0} is increasing; that is, As (ω) ≤ At (ω) for s ≤ t
and all ω ∈ Ω.
79
to show that the process {Wt2 − t : t ≥ 0) is also a martingale. Clearly the
process {At : t ≥ 0}, defined by At = t (which is actually a deterministic
function of t), satisfies all the required properties to be a quadratic variation
of (Wt )). Therefore, the quadratic variation of the Wiener process
is At = t, that is
hW it = t.
hσW it = σ 2 t.
(i.e. the variance of Nt is just the expected value of its quadratic vari-
80
ation). Note that
Z t
E[Nt ] = 0 and E[Nt2 ] =E Hs2 ds .
0
(c) The definition of a stochastic integral with respect to Brownian motion has
been extended to martingales. If {Mt : t ≥ 0} is a martingale (with respect
to a fixed filtration {Ft : t ≥ 0}) with continuous paths and {Ht : t ≥ 0}
is an adapted process, then we can repeat everything we have done for the
Wiener process and define the stochastic integral
Z t
Hs dM (s).
0
Observe that here we have replaced the dt in the case of Brownian motion
by dhM is , where as you know hM i is the quadratic variation of M .
81
For example, an increasing function is a function of bounded variation; also, a
decreasing function is a function of bounded variation. The function f (t) = t
has bounded variation. Any continuously differentiable function f (i.e. f is
differentiable and its derivative f 0 is continuous) has bounded variation.
Under some conditions, we can define the stochastic integral with respect to
a semi-martingale. If Xt = Mt + At is a semi-martingale and {Ht : t ≥ 0} is
adapted, then Z Z t Z t t
Hs dXs = Hs dMs + Hs dAs .
0 0 0
Z t Z t Z t Z t Z t
Hs dXs = Hs d(σWs ) + Hs d(µs) = σ Hs dWs + µ Hs ds.
0 0 0 0 0
hXit = hM it
82
then
Z 8 Z 8
4dX(t) = 4 dX(t)
2 2
Z 8
= 4 d(3W (t) + 5t)
2
Z 8 Z 8
= 4 3 dW (t) + 5 dt
2 2
= 12(W (8) − W (2)) + 5(8 − 2)
= 12(W (8) − W (2)) + 30.
Itô’s formula is the cornerstone of stochastic calculus. It must be very well under-
stood.
83
(At ) has bounded variation), we have the formula:
t
1 t 00
Z Z
0
f (Xt ) − f (X0 ) = f (Xs )dXs + f (Xs )dhXis
0 2 0
Z t Z t
1 t 00
Z
0 0
= f (Xs )dMs + f (Xs )dAs + f (Xs )dhM is .
0 0 2 0
Then t t t
Wt2
Z Z Z
1
= Ws dWs + ds = Ws dWs + t/2
2 0 2 0 0
84
An extension of Itô’s formula: Consider a C 2 function of two variables
0 ∂t ∂x
Z t
∂f
+ (s, W (s))dW (s). (8.1)
0 ∂x
∂f ∂f ∂ 2f
(s, x) = x, (s, x) = s and (s, x) = 0.
∂t ∂x ∂x2
We find that Z t Z t
tW (t) − 0 = W (s)ds + sdW (s),
0 0
which is equivalent to
Z t Z t
s dW (s) = tW (t) − W (s)ds.
0 0
85
8.2 LESSON 25: A brief note on stochastic dif-
ferential equations
for all t ≥ 0.
In order for the SDE to have a solution, that is for a process X that satisfies the
SDE to exist, there are assumptions that must be imposed on the drift function µ
and the diffusion coefficient σ. We do not discuss these here.
To simulate the stochastic process X satisfying the SDE on a finite interval [0, T ],
we can use the following scheme (called the Euler–Maruyama method):
Input:
the drift µ
the diffusion coefficient σ
the initial value X0
86
the time horizon: interval [0, T ]
the discretisation parameter n ∈ N
X(ti+1 ) = X(ti ) + µ(ti , X(ti ))∆ + σ(ti , S(ti ))(W (ti+1 ) − W (ti )),
that is
√
X(ti+1 ) = X(ti ) + µ(ti , X(ti ))∆ + σ(ti , S(ti ))ξi ∆
87
To simulate the solution process, use the following R code:
n <- 1000
T <- 10
kappa <- 10
theta <- 1
mu <- function(x){
return(kappa*(theta - x))
}
sigma <- 0.25
D <- T/n;
X0 <- 0.5;
X <- X0;
path <- c(X0)
for(k in 1:n){
t <- k*D;
xi <- rnorm(1,0,1)
X <- X + mu(X)*D + sigma* sqrt(D) * xi;
path <- append(path, X)
}
t <- seq(0, T, D)
plot(t, path,
main="Simulation of the solution to SDE on [0, 10]",
ylab="X(t)",
type="l")
88
1.1
1.0
0.9
2 4 6 8 10
V (T ) = max(0, ST − K),
that is
(
ST − K if ST > K
V (T ) =
0 otherwise
(a) Then simulate a sample path of the stock price process {St : t ∈ [0, T ]}
by subdividing the interval into 1 000 subintervals of equal length.
Use the following code:
(c) Repeat this 2 000 times and deduce the value V0 of the option at time
t = 0. Use
V0 = e−rT E(VT ).
89
Compare your answer to the exact option price USD 11.469.
√
dSt = rSt dt + vt St dWt1
√
dvt = κ(θ − vt )dt + σ vt dWt2
where (Wt1 ) and (Wt2 ) are two Brownian motions (on the same probability
space) such that for each t > 0,
E(Wt1 Wt2 ) = ρt
Consider a European call option on the stock and take T = 1, S0 = 100 and
r = 0.05 for the call option parameters. Assume that the process parameters
are v0 = 0.04, κ = 1.2, θ = 0.04, ρ = −0.5 and σ = 0.3.
Then simulate a sample path of the stock price process {St : t ∈ [0, T ]} by
subdividing the interval [0, T ] into 10 000 subintervals of equal length. Use
the following code:
90
sigma <- 0.3
S0 <- 100
v0 <- 0.04
D <- T/n
S <- S0
v <- v0
LL <- c(S0)
for(k in 1:n){
B <- rnorm(1,0,1)
Z <- rnorm(1, 0,1)
W1 <- B;
W2 <- rho * B + sqrt(1- rho^2)*Z
v < v + kappa*(theta - v)* D + sigma * sqrt(v)* sqrt(D)* W2;
S <- S + r * S* D + sqrt(v) * S * sqrt(D)* W1;
LL <- append(LL, S)
}
t <- seq(0, T, D)
plot(t, LL,
main="Simulation of the solution to SDE on [0, 1]",
ylab="X(t)",
type="l")
Question 3 Consider the Black–Scholes asset price model (under the risk-neutral
probability measure)
91
(i) If A ⊂ D then the number of elements of the random set Π in A
(that number is a random variable) follows the Poisson distribution
with parameter Z
Λ(A) = λ(x)dx.
A
That is,
|Π ∩ A| ∼ P oisson(Λ(A)).
(ii) if A and B are subsets of D that are disjoint, then the random variables
|Π ∩ A| and |Π ∩ B| are independent.
The intensity function λ specifies the number of points of the Poisson process,
on average, are located in a given region. The process will have many points
where λ is large and will have only few points where λ is small. Clearly, for
any subset A of D,
E(|Π ∩ A|) = Λ(A).
a <- 0
b<- 15
lambda <- 1.3
total_intensity <- lambda*(b-a)
92
N <- rpois(1, total_intensity)
X <- runif(N, a, b)
For each iteration, N is the number of events that occur in the interval [a, b]
and the sequence X contains the arrival times (times at which the events
occur). This algorithm is based on the following well known result: For a
Poisson process with constant intensity λ, under the condition that N events
happen in the interval [a, b], the set of the N event times is distributed as a
set of N independent U [a, b] random variables.
1 2
S(t) = S0 eσW (t)+(µ− 2 σ )t , t ≥ 0
(Exercise 2) 1. Show that the solution to the SDE (stochastic differential equa-
tion)
( 1 2
dXt = 31 Xt3 dt + Xt3 dWt
X0 = x > 0.
is given by 3
1 1
Xt = x + Wt .
3
3
93
Hint: Consider the function
3
1 1
f (y) = x 3 + y
3
Xt = f (t, Wt )
where
1
f (t, x) = x.
1+t
The SDE is equivalent to:
Z t Z t
1 1
Xt = − Xs ds + dWs .
0 1+s 0 1+s
Now we use Itô’s formula (8.1) to verify that this equality holds for
1
Xt = Wt .
1+t
et dXt + et Xt dt = dWt
94
and use
d(et Xt ) = et d(Xt ) + Xt et dt.
4. In general, apply Itô’s formula to show that the solution to the SDE
(
dXt = (aXt + bt )dt + σt dWt
X 0 = x0
(Exercise 3) Find stochastic differential equations that are solved by the following
stochastic processes (α and β are constants):
4. Vt = tW (t).
(Exercise 4) If dS(t) = µS(t)dt + σS(t)dW (t), where µ and σ are constants, find
a stochastic differential equation satisfied by:
1. Vt = αt + βS(t)
2. Vt = ln S(t)
3. Vt = S(t)e−αt
95
We recall that the solution of this SDE is (as already discussed)
2
σW (t)+ µ− σ2 t
St = S0 e .
σ2
V (t) = αt + βS0 eσW (t)+(µ− 2
)t
.
where r is a constant.
96
Solutions to exercises
(Exercise 2) (Exercise 2.1) The problem is to verify that Xt is the solution of the
given SDE.
1. Clearly
3
1 1
X0 = 0 3 + W0 = 0 (since W0 = 0) .
3
2. We use Itô’s formula again. Note that the given SDE is equivalent
to
1 t 13
Z Z 2
Xt = x + Xs ds + Xs3 dWs .
3 0
Let 3
1 1
f (y) = x 3 + y .
3
(Here x is a fixed constant and y is the only one variable.) Then
3
1 1
f (Wt ) = x + Wt = Xt .
3
3
We have that
2 2
0 1 1 1 1 1
f (y) = 3 x + y3 × = x + y
3
3 3 3
and then 2
0 1 1 2
f (Ws ) = x + Ws
3 = Xs3 .
3
97
Also, 1
00 1 1 1 2 1 1
f (y) = 2 x 3 + y × = x3 + y
3 3 3 3
and hence
00 2 1 1 2 1
f (Ws ) = x 3 + Ws = Xs3 .
3 3 3
Therefore, Z t Z t
2 1 1
Xt = x + Xs dWs +
3
X 3 ds
0 3 0
Xt = f (t, Wt )
where
1
f (t, x) = x.
1+t
(Do you understand why?) The SDE is equivalent to
Z t Z t
1 1
Xt = − Xs ds + dWs .
0 1+s 0 1+s
Now we use Itô’s formula to verify that this equality holds for
1
Xt = Wt .
1+t
Use
Z t
∂ 2f
∂f
f (t, W (t)) − f (0, W0 ) = (s, W (s)) + 2 2 (s, W (s)) ds
1
0 ∂t ∂x
Z t
∂f
+ (s, W (s))dW (s).
0 ∂x
98
We have that
∂f 1 ∂f 1
= ⇒ (s, Ws ) =
∂x 1+t ∂x 1+s
∂f −x ∂f −Ws
= 2
=⇒ (s, Ws ) =
∂t (1 + t) ∂y (1 + s)2
and
∂ 2f
= 0.
∂x2
Therefore,
Z t Z t
1 Ws
f (t, Wt ) − f (0, W0 ) = dWs − ds
0 1+s 0 (1 + s)2
Z t Z t
1 1
= dWs − Xs ds
0 1+s 0 1+s
Ws
because Xs = .
1+s
Then Z t Z t
1 1
Xt = dWs − Xs ds.
0 1+s 0 1+s
by et to find
et dXt + et Xt dt = dWt .
This is equivqalent to
99
the equation becomes
d et Xt = dWt .
Let
Yt = et Xt .
dYt = dWt .
The solution is
Yt = Y0 + Wt = e0 × X0 + Wt = x + Wt .
et Xt = x + Wt
or equivalently
Xt = e−t (x + Wt ).
(Exercise 3.1) Write Vt = f (Wt ) = Wt3 where f (x) = x3 . Then f 0 (x) = 3x2
and f 00 (x) = 6x. Hence, from the formula
Z t Z t
f (Wt ) = 3Ws2 dWs +3 Ws ds,
0 0
we find
Z t 2
Z t 1
Vt = 3 Vt dws + 3
3
Vt 3 ds
0 0
which is equivalent to
( 2 1
dVt = 3Vt 3 dWt + 3Vt 3 dt
V (0) = 0.
100
1
Note that Vt = Wt3 ⇒ Wt = Vt 3 and Vt denotes the same thing as V (t).
Vt = f (t, Wt )
where
f (t, x) = αt + βx2 .
Then
∂f ∂f
= 2βx ⇒ (s, Ws ) = 2βWs ,
∂x ∂x
∂f ∂f
= α⇒ (s, Ws ) = α,
∂t ∂y
∂ 2f ∂ 2f
= 2β ⇒ (s, Ws ) = 2β.
∂x2 ∂x2
Therefore,
Z t
∂ 2f
∂f
Vt − V0 = (s, W (s)) + 2 2 (s, W (s)) ds
1
0 ∂t ∂x
Z t
∂f
+ (s, W (s))dW (s)
0 ∂x
Z t Z t Z t
= 2βWs dWs + α ds + βds.
0 0 0
Z t
= 2βWs dWs + (α + β) t.
0
101
We recall that the solution of this SDE is
2
σW (t)+ µ− σ2 t
St = S0 e
Then
σ2
V (t) = αt + βS0 eσW (t)+(µ− 2
)t
.
(Exercise 5) (Exercise 5.1) Recall that if r is a constant, and f (t) and g(t) are
functions depending on t, then
We have that
dXt = rdXt + σdWt .
or equivalently
102
But clearly, using relation (8.2), we have that
Therefore,
d(e−rt Xt ) = σe−rt dWt .
Let
Yt = e−rt Xt .
Then
dYt = σe−rt dWt ,
which is equivalent to
Z t
Y (t) = Y0 + σe−rs dWs .
0
that is, Z t
rt rt
Xt = xe + σe ērs dWs .
0
(Exercise 5.2) The mean and variance of Xt can easily be found from the
relation Z t
rt rt
Xt = xe + σe ērs dWs .
0
We have that
103
Z t
rt rt rs
E [Xt ] = E xe + E σe ē dWs .
0
E xert = xert .
Rt
Now remember that the mean of a stochastic integral 0 g(s)dW (s) is
zero. Then we find
Z t
rt rt rt
E [Xt ] = xe + σe E σe rs
ē dWs = xert + σert × 0 = xert .
0
and
Z t Z t 2
Xt2 2 2rt
=x e + 2xσe 2rt rs
ē dWs + σ e 2 2rt rs
ē dWs .
0 0
Then
Z t " Z t 2 #
2 2 2rt 2rt rs 2 2rt rs
E Xt = E x e + E 2xσe ē dWs + E σ e ē dWs
0 0
"Z 2 #
t
2 2rt 2rt 2 2rt
= xe + 2xσe ×0+σ e E ērs dWs .
0
104
Now remember that if
Z t
Nt = g(s)dW (s),
0
then Z t
E Nt2 = E 2
(g(s)) ds .
0
105