Professional Documents
Culture Documents
Pricing Theory
Pr. Eymen Errais
2023
1
© 2023 University of Tunis - Tunis Business
School
Table of Contents
Acknowledgment ........................................................................................................................ 4
Why this Book? And How Will It Benefit You? ........................................................................... 5
The Story of the village of Capitalis ..................................................................................................... 5
I. Introduction to Probability Theory ...................................................................................... 8
and Stochastic Processes ............................................................................................................ 8
Introduction......................................................................................................................................... 8
The Concepts of Certainty and Likelihood .......................................................................................... 8
What is Probability theory? ................................................................................................................. 8
Sample Space, Sigma-algebra (Sigma-field) and probability measures .............................................. 8
1. Sample Space........................................................................................................................... 9
2. Sigma-algebra (Sigma-field)................................................................................................... 10
3. Measurable space.................................................................................................................. 12
4. Probability measure .............................................................................................................. 12
5. Probability space ................................................................................................................... 13
Random variables and their properties............................................................................................. 14
1. Random variable.................................................................................................................... 16
2. Generated sigma-algebra ...................................................................................................... 18
3. Cumulative distribution ......................................................................................................... 19
4. Density function .................................................................................................................... 20
Stochastic processes, filtrations, and stopping times. ...................................................................... 22
How Can I Differentiate Between Randomness and Stochasticity? .................................................. 22
1. Stochastic processes.............................................................................................................. 23
2. Filtrations............................................................................................................................... 24
3. Stopping time ........................................................................................................................ 28
II. Conditional Expectation .................................................................................................... 32
Why Do You Need to Add a Condition When You Are Making a Prediction? ................................... 32
1. Conditional Probability .......................................................................................................... 34
2. Conditional Expectation ........................................................................................................ 35
3. Properties of Conditional Expectation .................................................................................. 38
4. Conditional Expectation and orthogonal projection. ............................................................ 38
III. Martingales.................................................................................................................... 40
1. Introduction ........................................................................................................................... 42
2. Martingale Properties ........................................................................................................... 42
3. Additional Exercises............................................................................................................... 47
2
IV. Brownian Motion........................................................................................................... 51
Introduction ................................................................................................................................... 52
V. Stochastic Calculus ........................................................................................................ 60
1. Ito Process ............................................................................................................................. 62
2. Quadratic variation................................................................................................................ 62
3. Itô’s Lemma ........................................................................................................................... 63
4. Quadratic covariation ............................................................................................................ 67
5. Multiplication theorem ......................................................................................................... 67
6. Itô Isometry ........................................................................................................................... 68
VI. Credit Risk Modeling ..................................................................................................... 71
1. Structural models .................................................................................................................. 71
2. Reduced form models ........................................................................................................... 74
VII. Interest rate Modeling .................................................................................................. 78
Short rate models .......................................................................................................................... 78
References ................................................................................................................................ 82
Appendix ................................................................................................................................... 85
I. Math Review ............................................................................................................................. 85
II. Introduction to R .................................................................................................................... 101
1. Working with Rstudio .......................................................................................................... 101
2. Working Directories:............................................................................................................ 102
3. Packages .............................................................................................................................. 103
4. Import data into R ............................................................................................................... 104
5. Manipulating Data ............................................................................................................... 107
6. Visualizing data .................................................................................................................... 110
3
Acknowledgment
This book emerged from my students' urgent need for a comprehensive guide to stochastic
calculus tailored for non-mathematics majors. Initially, it took shape from my lecture notes,
evolving significantly through invaluable inputs from my students and teaching assistants. I
extend my heartfelt gratitude to Iheb Dhaouadi, Taha Yacine Ayoub, Alae Amami, Mouna Turki,
Manar Labidi, Karim Razgallah, and Ons Harrabi for their contributions. Special appreciation is
due to Nour Causseini and Takwa Karoud for their exceptional roles. Nour's creative approach
made complex measure theory concepts accessible and engaging, weaving them into a fairy
tale narrative. Takwa's rigor and discipline were instrumental in developing an annex vital for
non-math students. Lastly, I must express my deepest thanks and love to my wife, Cyrine, for
her extraordinary patience during the countless nights spent completing this book.
4
Why this Book? And How Will It Benefit You?
One night, Investire gazed at the twinkling stars and thought to himself, "Oh, if only
I could know the future value of my apples! I would know exactly when to go to the center of
Capitalis and when to stay in my orchard, snuggled in my cozy bed. That way, I could time my
apple sales perfectly for maximum profit and plan for my dream library!" But that wasn't the
only puzzle troubling Investire's curious mind. Among the stacks of books he collected, there
were some ancient spell books that held secrets to the value of knowledge. "What if I could
learn if these books become more valuable the longer, I keep them?" he wondered. "Then I
could exchange them for even rarer tomes and still enjoy the juicy apples from my orchard!"
Driven by his dreams of owning the most magnificent library, Investire set off on a
thrilling adventure to seek answers to his questions. He roamed through mystical forests,
consulted wise sages, and travelled to the far corners of Capitalis. His journey finally led him to
a hidden chamber within the town's ancient library. As he rummaged through a pile of dusty
old books, Investire stumbled upon an ancient spell book with a mysterious title: "Theoria
Pretiorum Res Mobilium Dynamica." Intrigued, he opened it and found the first page inscribed
with magical words: "May these lines be your guide to foresee the rhythm and motion of what
you own, just as you gaze upon the stars in their celestial path and see how they move and
where they go. With this wisdom, you shall navigate the stormy seas of Capitalis uncertainty,
avoiding the siren calls of risky ventures and steering towards the shores of prosperity." With
excitement coursing through his veins, Investire realized that this magical spell-book would
help him predict the future value of his precious apples. The tome was divided into chapters,
1
The origin of the word to invest “investire” in Latin.
5
each containing a legendary treasure map with missing parts that needed to be filled in. Little
did Investire know that this book held the key to a powerful spell.
With days passing by, Investire became the owner of the biggest library in Capitalis
and Finis the alchemist who transformed uncertainty into truth and was sought by kings and
queens from distant lands.
Takeaway Message:
We entered the world of Capitalis, where Investire, the apple trader, sought the appreciation
of the value of his apples before going to the center of the village! That’s Investing! Investire
dreamt of knowing the future worth of his apples, to time his investment just right, manage
risks, and craft the perfect hedging strategy. His wish came true with the spell book "Theoria
Pretiorum Res Mobilium Dynamica" – Dynamic Asset Pricing Theory (DAPT). Legends within,
like APT and CAPM, were passed down to you already, but the true marvels were the complex
legends of valuing other types of financial assets, that you are also familiar with, like
derivatives. These legends had missing parts that needed to be filled in. Indeed, these
mathematical models require variables to reveal asset value. Investire's friend, Finis was
intrigued and questioned the accuracy of DAPT. To test their accuracy, they delved into
Empirical Dynamic Asset Pricing, where models turned from myths to powerful tools. Who are
the kings and queens who sought Finis and wanted to know more about Dynamic Asset Pricing
Theory? It's you, yes indeed most of you, the future researchers, academics, economists willing
to help policy makers and central banks make sounder decisions, financial engineers,
quantitative analysts, financial risk managers, and investors. Remember, though DAPT is a
sophisticated area of finance that unveils the future price of assets. However, life happens, and
2
The origin of the word Finance in Latin Finis or the end, it referred to the settlement of debts.
6
probability is not certainty. Yet it is certainly worth being taught. That’s why it’s now time for
some probability theory and some stochastic processes.
7
I. Introduction to Probability Theory
Introduction
measures
Organizing the Library
8
A true bookworm, like a mathematician with sigma-algebra, can come up with
countless creative ways to sort their books and keep things super organized. However, there is
a limit to the number of categories he can create; defined by the cardinality of his library, which
is the number of books he possesses. Interestingly, Investire realized that no matter how hard
he tried to invent new ways to categorize his books, his record was always 2 raised to the
power of the cardinality.
Investire came with so many ways of categorizing his books, and although he hates to admit
it, he sometimes forgets how to navigate his library. That’s why for every categorization
method, that is for every sigma algebra, he created a navigation map to help him make sense
of all his books (sample space) and how he organized them (sigma algebra) and that he calls
his measurable space.
Investire loves to read, however he has always been indecisive about what to read. This led
him to ask his friend Finis to pick up a book for him every day. The moment Finis enters
Investire’s Library he feels like he is in a Playground of Randomness. He wanders in the library
(sample space), through the shelves where Investire organized his books into different
categories following his set of rules (sigma-algebra) and should choose a book for Investire
while enjoying seeing him so nervous. Indeed, every night, Investire was eagerly awaiting the
next day’s literary adventure. So, he decided to consult his spell book, again, to predict the next
tome he will be reading. The spell book instructed “Take your navigation map and to each book
featuring on the map, close your eyes and assign a number from 0 to 1; You shall find yourself
in an uncertain space that will diminish your uncertainty and Finis’s Playground of Randomness
will be less perplexing. The next step will be revealed in the next page”. In simpler terms this
means that Investire takes his measurable space, and to each event within it (represented by
books) he randomly assigns a number from 0 to 1. This number will quantify the likelihood of
each event occurring; by doing so Investire creates his probability measure and Finis’
Playground of Randomness, which is the Probability Space that takes into consideration the
sample space, the sigma algebra, and the probability measure Investire created and defined on
his measurable space, will be more understandable. And the next step to execute will be
discovered in the next part of this chapter.
1. Sample Space
An experiment is any procedure that can be infinitely repeated and has a well-defined set of
possible outcomes3.
The set of all possible outcomes of an experiment is called the sample space.
Definition: A sample space, 𝛺 = {𝜔𝑖 : 𝑖 ∈ 𝐼} is the set of all possible results of a random
experiment. I being a set of indices.
3
Events
9
The sample space is: Ω = {1,2,3,4,5,6} There are 6 possible outcomes: Numbers from 1, to 6.
Example 1.2: Suppose our random experience is rolling a dice and getting either odd or even.
The sample space is: Ω = {{1,3,5}, {2,4,6}} There are 2 possible outcomes: the odd and the
even numbers.
Example 1.3: Suppose our random experience is to take a stock randomly from the list of stocks
in the Tunis Stock Exchange.
The sample space is: Ω = {Adwya , Aetech, ⋯ , UBCI, UIB }. There are around 82 possible
outcomes: the number of stocks of all listed companies in Tunisia.
Example 1.4: Suppose our random experience is throwing a coin two times.
Ω = {Boy , Girl}
Every subset of Ω has the possibility to be picked or not, and |Ω| denotes the cardinality4
(number of elements) of the sample space Ω which means that the possible number of subsets
are 𝟐|𝛀| .
2. Sigma-algebra (Sigma-field)
Example 2.1: Ω = {𝛼, 𝛽, 𝛾}, then the power set of Ω has 23 = 8 elements, which are:
4
Cardinality = ‘How many elements are there’? In example (1.1) cardinality is 6, in example (1.2) it’s 2.
5
Sigma algebra F is a subset of the set containing all possible subsets of the sample space 𝛺
6
‘Closed under complementation’ means F is comprehensive; it contains a thing and its opposite.
7
‘Closed under union’ means that the union (combination) of any sets that exist in F, will be found in F
too.
10
{}8, {𝛼}, {𝛽}, {𝛾}, {𝛼, 𝛽}, {𝛼, 𝛾}, {𝛽, 𝛾}, {𝛼, 𝛽, 𝛾}
A σ-algebra on Ω can contain any subset of these 8 elements, as long as it satisfies the above
properties of a σ-algebra. The 3 following sigma-algebras are all σ-algebras on Ω:
ℱ1 = {∅, Ω, {𝛼}, ℱ2 = {∅, Ω, {𝛼, ℱ3 = {∅, Ω, {𝛼}, {𝛽}, {𝛾}, {𝛼, 𝛽}, {𝛼, 𝛾}, {𝛽, 𝛾}, {𝛼,
{𝛽, 𝛾}} 𝛽}, {𝛾}} 𝛽, 𝛾}}
The smallest sigma-algebra9 and the trivial sigma-algebra
{∅, 𝐴, 𝐴𝑐 , 𝛺}
Example 2.5: What is the sigma-algebra of throwing a dice and getting either odd or even?
Example 2.6: What is the sigma-algebra of throwing a dice and getting lesser or higher than 3?
Example 2.9: What is the sigma-algebra of throwing a dice and betting $4000 on 4 and $6000
on 5?
8
The empty set
9
Usually when we ask for the sigma-algebra, we are asking for the smallest one.
11
If A, B ∈ F, then 𝐴𝑐 and 𝐵𝑐 ∈ F which means (𝐴𝑐 ∪ 𝐵𝑐 ) ∈ F, implying (𝐴𝑐 ∪ 𝐵𝑐 )𝑐 ∈ F. And finally,
this leads to: 𝐴 ∩ 𝐵 ∈ F.
3. Measurable space
Definition: A measurable space is the space defined by the couple (𝛺 , F ) where 𝛺 is the sample
space and F is the sigma-algebra defined on 𝛺.
σ-algebra is a collection of measurable subsets (we can assign probabilities to the subsets).
Example 3.1: Let 𝛺 be the sample space of all listed companies, and let F be the smallest
sigma-algebra containing all the public information of all listed leasing companies.
Let’s Recap
The sample space Ω is the set of all possible outcomes of an experiment. It contains all the
possible results that could occur when we perform the experiment.
The sigma algebra F is a collection of subsets of the sample space that we consider to be
measurable or observable. We choose the sigma algebra to be a collection of subsets that
are relevant to our analysis and satisfy the three conditions.
By defining a sigma algebra, we can narrow our focus to a smaller collection of subsets to
have efficient analysis and more control over data.
The measurable space, the combination of the sample space and the sigma-algebra, then
comes in handy to provide a foundational structure for defining probabilities by defining the
scope of events for which we can assign probabilities (from 0 to 1). On the measurable space,
we will define our Probability measure P.
4. Probability measure
For any two disjoint subsets 𝐴𝑖 and 𝐴𝑗 in the sigma-algebra F, the probability of their
union is equal to the sum of their individual probabilities.
This allows us to break down complex events into simpler, disjoint events, and then
add up their probabilities to calculate the probability of the complex event.
10
This is read as « F maps to [0,1], i.e., for any subset in sigma algebra P assigns it to a value within [0,1]
12
Example 4.1: Let rolling the dice be a random experience. If the dice is fair, every event has the
same chance of occurrence. What is it? It is 1/6.
Example 4.2: Suppose we want to calculate the probability of rolling a six-sided die and getting
1, 2, or 3. We can break this event down into the disjoint events of rolling and getting 1, rolling
and getting 2, rolling and getting 3, and then we calculate the probability of their union:
P(rolling and getting 1, 2, or 3) = P(rolling and getting 1) + P(rolling and getting 2) + P(rolling and
getting 3)
Example 4.4: Show that for any events A and B ∈ F, 𝑃(𝐴 ∪ 𝐵)=P(𝐴)+P(𝐵)-P(𝐴 ∩ 𝐵).
Moreover, one has that A and B can be written as union of the following disjoint sets:
𝐴 = (𝐴 ∩ 𝐵𝑐 ) ∪ (𝐴 ∩ 𝐵)
5. Probability space
Definition: We call a probability space the triplet (Ω , F, P ) composed of the sample space 𝛺,
the sigma-algebra F, and the probability measure P, defined on the measurable space (𝛺 , F ).
The measurable space (Ω, ℱ) is the background structure that is needed to assign probabilities
using P function to measurable events.
13
Example 5.1: Let there be the probability space (Ω , F , P ) And G = {∅, 𝛺, {4,5}, {1,2,3,6}}
At first the book remained silent, its pages still unmoving. Investire’s
heart sank, but then, as if enchanted by his plea the pages came to life with
shining letters “Go to the village of Probare11”. And so Investire followed the
rules.
11
The word from which “Probabilitas” (the origin of Probability) is derived. Probare means in Latin “to
test” or “to prove”.
14
As Investire drew closer to the village of Probare, a buzzing sound filled the air around
him. It echoed in his ears “We know not your books nor your spell; Speak our language and in
magic you’ll dwell. We map your books to our dictionary’s embrace, speak our language, unlock
the secrets of this place” … And he kept moving forward.
The brave boy heeded the old lady’s sage advice. He reached the bridge, and just as she
foretold, he selected one empty box from the pile and crossed the bridge following the arrow,
and not looking back… And just like that the bridge mapped his books to the numbers
Probare’s people could understand.
With the boxes in his hands, Investire didn’t know what to do next, so he began to make his
way to the village’s exit, yearning to return to his trusty spell book. But as he approached the
exit door, it remained shut bearing a message that read “You shall not depart unless you
demonstrate your understanding of the value of these boxes gifted by our bridge.”. “What do
you want from me?” Investire shouted at the door; “Give these boxes back their veil of
uncertainty but quantify it. Show us the likelihood of your friend choosing books akin to ours.
Then upon the sandy ground illustrate your words.”.
Investire recalled the moment when his spell book had instructed him “[…] to each book
featuring on the map, assign a number from 0 to 1…”. He devised a clever plan: he took the
boxes put a veil on them and thought he fooled the door by saying “I predict that Finis will
choose a book like the one in this box, and that likelihood shall be 0.5”; Repeating this for each
box he intended to take home. Little did he know he provided the correct response; The door
had sought what was called in Probare the CDF. To illustrate his point, as asked from him, he
noticed to his right a large bell nearby, and with a stick he traced a bell-shaped curve in the
sand, confidently exclaiming, “This is what I mean!”. Regardless of how accurate Investire’s
answers were, he gave what seemed to be the correct responses. With that the door swung
open, granting Investire his freedom once more.
15
Takeaway message: The probability world doesn’t know the events or your outcomes of
interest, it doesn’t speak your language. You need to speak the language of this world _Village
of Probare_, that is speak in numbers rather than words and in the names, you gave the sets in
your sigma algebra. To do so you need to resort to the bridge _Random variables_. Random
variables are functions but serve as a bridge linking the real world to the world of mathematical
models. Let’s call our bridge X. Just like the bridge in Investire’s story, Random variables will
map elements from your sample space to the set of real numbers, as you follow the arrow (𝑋 ∶
𝛺 ⟶ R). A function, X(x), is a relevant random variable for you if and only if the books in the
box (or the set between the brackets) also exists in your sigma-algebra; that is the random
variable X is measurable on your sigma algebra F. Any bridge, or random variable, is
measurable for a certain sigma algebra, which is the generated-sigma-algebra for that random
variable; It is the categorization the bridge generated.
At this point, although the data became understandable and Investire felt less lost in the
Playground of Randomness _Probability Space_, it is still not meaningful. The veil of
uncertainty Investire put back was the Probability measure of that random variable P(X<=x)
the RV takes on a value less than or equal to a specified value x (0.5 Investire assigned). This
veil along with the box make up a function F(X) which is the Cumulative Distribution Function,
CDF12. When Investire was asked to illustrate what he said, he was asked to provide information
about the distribution of the probabilities for different values of the RV, and this curve is called
the PDF13 and is given by the function f(x) which is nothing but the derivative of the CDF.
1. Random variable
X is a function that maps an event from the sample space Ω to a value and it is measurable with
respect to the sigma-algebra. X assigns a real number to each outcome ω in the sample space.
12
Use the CDF to determine the probability that a random observation that is taken from the population
will be less than or equal to a certain value.
13
used to define the random variable's probability coming within a distinct range of values, as opposed to
taking on any one value.
14
You read this: X is a function that maps elements from the sample space Ω to the set of real numbers
ℝ
15
You read this: For all x in the set of real numbers, the set of 𝜛 in Ω such that x(𝜛) is less than or equal
to x belongs to the sigma-algebra F
16
For any real number x, the set of outcomes in the sample space Ω for which X(ω) is less than or
equal to x is an event in the sigma-algebra ℱ. This condition is equivalent to saying that X is
measurable with respect to the sigma-algebra ℱ.
Example 1.1:
Consider the following experiment: flipping a fair coin twice. The sample space is Ω = {HH, HT,
TH, TT}, where HH represents two heads, HT represents a head followed by a tail, and so on.
Let F be the sigma-algebra generated by the events {HH}, {HT, TH}, and {TT}. That is, ℱ = {∅, Ω,
{HH}, {HT, TH}, {TT}, {HH, HT, TH}, {HT, TH, TT} }.
Let X be the random variable that counts the number of heads obtained when flipping the coin
twice. That is, X(HH) = 2, X(HT) = X(TH) = 1, and X(TT) = 0.
If x = 1, then {ω ∈ Ω : X(ω) ≤ 1} = {HT, TH, TT} ∈ ℱ, since X(HT) = X(TH) =1, X(TT) = 0.
1 𝑖𝑓 𝜔 ∈ {6}
𝑋(𝜔) = {
0 𝑖𝑓 𝜔 ∈ {1,2,3,4,5}
Is X a random variable?
{𝜔 ∈ Ω ∶ 𝑋(𝜔) = 1} = {6 } ∉ 𝐺
1 𝑖𝑓 𝜔 ∈ {5}
𝑌(𝜔) = {
0 𝑖𝑓 𝜔 ∈ {1,2,3,4,6}
Is Y a random variable?
{𝜔 ∈ Ω ∶ 𝑌(𝜔) = 1} = {5 } ∈ 𝐹
{𝜔 ∈ Ω ∶ 𝑌(𝜔) = 0} = {1,2,3,4,6} ∈ 𝐹
Y is a random variable.
17
2. Generated sigma-algebra
Definition: Let X be a real function defined on 𝛺. The smallest sigma-algebra F that allows X
to become a random variable on the measurable space (𝛺 , F ) is called sigma-algebra
generated by X. We note it: F = 𝜎(𝑋)
Example 2.1: Let the random experience be rolling a fair dice. Let X be the function that gives
1 if the outcome is even and 0 otherwise.
1 si 𝜔 ∈ {2,4,6}
𝑋(𝜛) = {
0 si 𝜔 ∈ {1,3,5}
Example 2.2: Let the random experience be rolling a fair dice. Let Y be the function that give 1
if the outcome is higher or equal than 4 and 0 otherwise.
Is Y a random variable under the measurable space (𝛺 , F ) defined in the previous example ?
Since
1 𝑠𝑖 ϖ ∈ {4,5,6} ∉ F
𝑌(𝜛) = {
0 𝑠𝑖 ϖ ∈ {1,2,3} ∉ F
Example 2.3: Let the random experience be rolling a fair dice. Let Z be the function that gives
1 if the outcome is 6 or 1 and 0 otherwise.
1 𝑠𝑖 ϖ ∈ {1,6}
𝑍(𝜛) = {
0 𝑠𝑖 ϖ ∈ {2,3,4,5}
18
Example 2.4:
X |X| Y
ω1 0 0 0
ω2 0 0 0
-
ω3 1 0
1
ω4 1 1 1
ω5 1 1 1
ω6 2 2 1
-
ω7 2 2
2
3. Cumulative distribution
19
4. Density function
𝜆𝑘
𝑓𝑋 (𝑘) = 𝑒 −𝜆 𝑘 = 0,1,2, …
𝑘!
Python Time !
20
from sympy import FiniteSet
21
Stochastic processes, filtrations, and stopping times.
Think of a random experiment like a single test you take, such as your driver's license test.
It's a one-time event, and you can't predict the outcome in advance.
Now, envision a stochastic process as a series of events that evolves over time, much like
your favorite TV show. In shows like "Choufli Hal," there are many episodes, and you never
quite know what will happen in the next one (at least if you’re watching it for the first time and
didn’t obsess over it already). A stochastic process involves a collection of random variables
that change and evolve over time, creating a dynamic story.
Investire opened the Tome and began to read. He quickly noticed that not only he ignored
the next book he would be reading, but he also ignored what the next chapter of the tome he
was reading would be telling him: Like the books in his library, chapters are also events in the
Tome, just like the library the book is also a sample space, and just like he organized his library
into categories of books, the author organized the chapters into sets and that represented a
sigma-algebra.
The only difference is that as he continued to read, the chapters’ outcome differed, while
the books didn’t; That is, Finis picked a book once, it’s a one-time thing, however the reading
process, evolved over time: The reading process was dynamic, picking a book was not! So, it is
not exactly a sigma-algebra.
22
Investire noticed another difference: as he discovered what each chapter hid, he
discovered a new organization of the story unveiled to him by the author, but this doesn’t mean
he forgot the previous story in the previous chapter. That is as he read each page, discovered
each event, and finished each chapter he gained more information about the story without
ever losing the past information; Investire was accumulating knowledge over time, as the
reading process continued. Just as he uncovered the plots of the story through the book’s
pages, a gradual accumulation of information about the story unfolded. Investire paused his
reading to reflect on what he had noticed and to take a break.
Takeaway message: Investire had uncovered the enchanting world of stochastic processes,
filtrations, and stopping times through the pages of the Tome. He realized that, just as reading
a book was a process that evolved over time while concealing some future information, every
process with uncertain outcomes that evolves over time (or space or any other index) was a
stochastic process.
Chapters in a book were like events in this process, and the information he gathered while
reading represented filtrations. (You can also think of Filtrations like sigma-algebras for random
experiments).
The moment when Investire paused reading his book is called a stopping time. Stopping times
are those moments or specific points in time when you pause to assess the events that have
occurred up to that moment. It’s as if you’re deciding when to reflect on the story’s progress
and what might happen next. So, what might happen next with Investire?
But before we proceed, let’s recall this piece of information: Despite its randomness, a
stochastic process can follow a specific pattern that we may notice. This pattern helps us
recognize what kind of stochastic process we are dealing with (categorize the process) and thus
approximate the future outcome. In summary, “stochastic process” serves as the broad term
under which we find specific types of stochastic processes that we will explore later.
1. Stochastic processes
Python Time !
23
import numpy as np
import matplotlib.pyplot as plt
def random_walk(num_steps) :
# Generate random steps (+1 or -1) for the given number of steps
steps = np.random.choice ( [-1, 1], size = num_steps )
return path
2. Filtrations
Example 2.1: Suppose you would like to model the WTI price through a stochastic process X.
The monthly price of WTI is given by this table:
24
Find the filtration 𝔽 = {Ft ∶ 𝑡 ∈ 𝑇} generated by the stochastic process 𝑋 = {𝑋𝑡 ∶ 𝑡 ∈ T} ?
F0 = {∅, Ω}
Example 2.2: Suppose you would like to model the GME price through a stochastic process Y.
The monthly price of GME is given by this table:
G 0 = {∅, Ω}
G 1 = 𝜎({𝜔1 , 𝜔2 , 𝜔3 }, 𝜔4 })
Example 2.3: Suppose you would like to model the SFBT price through a stochastic process V.
The monthly price of GME is given by this table:
Z 0 = {∅, Ω}
Z 1 = 𝜎({𝜔1 , 𝜔2 }, {𝜔3 , 𝜔4 })
25
Z = 𝜎({𝜔1 }, {𝜔2 }, {𝜔3 }, {𝜔4 })
2
Python Time !
Automated Filtrations with Python: Will try to do the WTI price previously seen
example with python:
import pandas as pd
import itertools
26
# Look at the sets in the previous filtration
for prev_set in prev_filtration:
if len(prev_set) == 1:
# If the set has only one element, carry it forward as is
new_filtration.append(prev_set)
else:
# If the set has multiple elements, we need to see if they still
have
the same value
# Create a dictionary to group states with the same value at time
t
value_groups = {}
for state in prev_set:
value_at_t = df.at[state, df.columns[t]]
if value_at_t in value_groups:
value_groups[value_at_t].add(state)
else:
value_groups[value_at_t] = {state}
# Each group of states with the same value forms a new set
in
the filtration
for group in value_groups.values():
new_filtration.append(group)
return formatted_filtrations
27
Definition : A stochastic process 𝑋 = {𝑋𝑡 ∶ 𝑡 ∈ T} is said to be adapted to the
filtration 𝔽 = {Ft ∶ 𝑡 ∈ 𝑇} if :
∀𝑡 ∈ 𝑇, F𝑡 = 𝜎(𝑋𝑠 ∶ 𝑠 ≤ 𝑡 ∈ T)
Example 2.4: Let us take the examples above. Is the stochastic process X of WTI adapted to
the filtration G generated by GME?
Definition : We call the probability filtered space the quartet (Ω , F , F, P) where Ω is the sample
set, F is the sigma-algebra on Ω , 𝔽 is the filtration on (Ω , F ) and P is a probability measure
on (Ω , F )
3. Stopping time
We can show that the above definition could be rewritten as follows in the finite space:
A stopping time is a stochastic process defined by a stopping rule that indicates a certain event
or behaviour of interest.
Example 3.1: Moving houses if your income reached a certain amount. (a stopping time)
28
Example 3.7: Let us take the example of WTI prices addressed previously.
{𝜔 ∈ Ω ∶ 𝜏(𝜔) = 0} = ∅ ∈ 𝐹0
{𝜔 ∈ Ω ∶ 𝜏(𝜔) = 1} = {𝜔1 , 𝜔2 } ∈ 𝐹1
{𝜔 ∈ Ω ∶ 𝜏(𝜔) = 2} = {𝜔3 } ∈ 𝐹2
{𝜔 ∈ Ω ∶ 𝜏(𝜔) = 3} = {𝜔4 } ∈ 𝐹3
• Let 𝛿 a random variable modelling this situation: the first time we buy WTI with the assurance
to make money later.
{𝜔 ∈ Ω ∶ 𝛿(𝜔) = 0} = {𝜔1 , 𝜔2 } ∉ 𝐹0
• How can we make 𝛿 a stopping time? By changing the definition to “the first time we sell WTI
with the assurance to make money.
Homework: Let 𝜏1 and 𝜏2 be two stopping times under a filtration F. Show that min(𝜏1 , 𝜏2 ) and
max(𝜏1 , 𝜏2 ) are stopping times.
Example 3.8:
• Filtration F:
𝐹1 = 𝜎({𝜔1 , 𝜔2 }, {𝜔3 , 𝜔4 })
29
Exam problem
Suppose you would like to model the stock price of BIAT through the stochastic process X. You
build a scenario analysis for the process X and you come up with the following scenarios:
Assuming the 5 scenarios have the same probability, find the bellow conditional expectations:
• 𝐸[𝑌2 /𝐹1 ]
• 𝐸[𝑌3 /𝐹2 ]
• 𝐸[𝑌4 /𝐹3 ]
• 𝐸[𝑌1 /𝐹2 ]
Let 𝜏 be the random variable defining the event ”The purchase of BIAT stock when the price hits
93 for the first time” . Is 𝜏 a stopping time?
Python Time !
Stopping Time Made Simple: We'll leverage the existing code for WTI price and aim to
determine the stopping time using Python.
def find_stopping_times_auto(df):
# Initialize stopping times for each w
stopping_times = {w: None for w in df.index}
# Initialize a dictionary to hold the stopping times by time index
stopping_times_by_t = {t: [] for t in range(len(df.columns))}
# Iterate over the dataframe to find the stopping times
for w in df.index:
for t in range(0, len(df.columns)):
# Check if the price is greater than or equal to 70 and stopping
time is not already set
if df.at[w, f'X{t}'] >= 70 and not stopping_times[w]:
# Set the stopping time for path w
stopping_times[w] = t
# Add the path to the stopping time list for time t
stopping_times_by_t[t].append(w)
break # No need to check further times for this path
30
# Convert the dictionary to a list of dictionaries for each time t
formatted_stopping_times = [{f'T{t}': stopping_times_by_t[t]} for t
in stopping_times_by_t]
return formatted_stopping_times
# Now, let's define a function that checks whether each stopping time is
included in the corresponding filtration.
return is_stopping_time
print(is_stopping_time)
Discover the captivating world of finance through Python programming. Run the code
and witness the enchantment of what programming can unfold!
31
II. Conditional Expectation
Prediction?
It’s all about whether you are makig a guess or a smart guess. When it comes to making
predictions, accuracy is our goal. While luck plays a role, knowledge is equally crucial. In this
context, "condition" means what you already know, and with knowledge factored in, your
guess becomes a smart guess.
[…] Investire finished reading the tome; it recounted the tale of Theseus,
punished by the King of Crete for a crime. Theseus faced a deadly choice: to
kill the Minotaur or be killed by it. With the aid of the king’s daughter,
Ariadne, who had fallen deeply in love with him, Theseus was equipped with
a sword and a ball of thread. Using the thread, Theseus retraced his steps
through the labyrinth, to escape the monstrous Minotaur.
Investire rushed to his spell-book. Upon opening it, a voice echoed, “It is not about the
length or strength of your thread; first and foremost, ask yourself if this is the right thread to
help you escape.” Investire turned the page and read, “Maximize your knowledge, refine your
categorization, and let it accumulate over the sands of time. With that, you will draw closer
to the accuracy you crave, step by step.” The young boy attempted to turn the next page, but
the book suddenly closed, leaving him in thoughtful silence.
Investire pondered, "In the next 100 days, I want to predict the chance of Finis randomly
selecting a fiction book for me. Maybe with the knowledge I possess, I can make a wiser guess.
The length of my thread doesn't matter, so what does?" Inspired by Finis when he tested the
32
accuracy of the spell book in finding the future value of the apple, Investire decided to analyze
Finis's past choices and observe his habits to enhance his understanding of his selection
process, each passing day. Soon, a pattern emerged: Finis often gifted him a fiction book every
Saturday and Wednesday. Excitedly, Investire exclaimed, "By considering the day of the week,
I can make an informed estimate about the likelihood of receiving a fiction book! That's my
thread – the days of the week." As he pronounced these words, the book unveiled the next
page to him with a list of instructions.
Since the outcome is likely to vary with time, Investire needed a bigger tool kit of random
variables. Returning to Probare, he gathered various boxes and veils as instructed by his spell
book. Standing before three tables, he declared, "I want to predict the likelihood of Finis
choosing a fiction book similar to this one in the box, tomorrow, based on what I know up until
Friday (Filtration till t= Friday)."
On the first table, there was a switch and a box. Investire placed a fiction book inside,
creating a random variable. If the box held a fiction book, he flicked the switch on (=1),
signifying its genre is indeed fiction. Otherwise, he left it off (=0). Considering what he knew,
he assigned the probability that Finis might select that book.
On the second table, Investire placed the value of him receiving a fiction book for a specific
outcome in particular day. He adjusted it according to the probability of that specific day being
chosen.
Magically, a number appeared on the third table, 𝐸[𝑋/G ] indicating his more informed
prediction.
Amazed, Investire observed the results. As he gazed at the number that appeared, the spell
book opened once again and said, “From village to village, the art of minimizing uncertainty
with the thread of knowledge remains the same at its core, though it bears different names in
different places.”
Takeaway message:
When Investire considered the record of book selections and observed Finis’ choices in the
following days, he expanded his filtration. In fact, if you compute the same expectation under
different filtrations (that is, your expectation is conditional on more information each time),
the results will differ. The more knowledge you accumulate, the more your expectation varies
and tends towards accuracy.
The pattern Investire noticed regarding Finis’ book selections formed a stochastic process,
where each day’s choice represented a random variable. Investire needed to know what
information to factor in, as the spell-book warned him that many before him computed
conditional expectations erroneously by overestimating the relevance of their information. In
his case, the day of the week was relevant.
33
The instructions given by the book, are as follows:
Table (3)
The result
𝐸[𝑋/G ]
The book's statement about conditional expectation changing names from one village to
another refers to how it is used in various disciplines: in geometry, it is projection; in
econometrics, it is regression; in industrial engineering, it is the solution to a partial
differential equation; and it also pertains to simulation.
1. Conditional Probability
Definition: Let (Ω , F , P) be a finite probability space. For all 𝐵 ∈ F with a positive probability,
the conditional probability given B is defined as:
𝑃(𝐴 ∩ 𝐵)
𝑃(𝐴/𝐵) =
𝑃(𝐵)
For any 𝐴 ∈ F
Example: Let us take the random experiment of rolling a dice. Suppose the dice is well balanced.
Example 1.1:
34
W X0(w) X1(w) X2(w) X3(w) P
w1 60 70 75 80 1/8
w2 60 70 70 80 2/8
w3 60 60 75 70 3/8
w4 60 60 60 65 2/8
2. Conditional Expectation
Definition: Let X and Y two discrete random variables defined on the probability space
(Ω , F , P) . Let G ⊆F the sigma-algebra generated by Y with finite partition
{𝐴1 , ⋯ , 𝐴𝑛 }. The conditional expectation of X knowing G is given by:
𝑛
𝐼𝐴 (𝜔)
𝐸[𝑋/G ] = ∑ 𝑖 ∑ 𝑋(𝜃)𝑃(𝜃)
𝑃(𝐴𝑖 )
𝑖=1 𝜃∈𝐴𝑖
1 𝑖𝑓 𝜔 ∈ 𝐴
Where I is an indicator function, i.e. 𝐼𝐴 = {
0 𝑖𝑓 𝜔 ∉ 𝐴
Example 2.1:
F 0 = {∅, Ω}
F 1 = 𝜎({𝜔1 , 𝜔2 }, {𝜔3 , 𝜔4 })
o 𝐸[𝑋3 /F 2 ]
35
1
𝑖𝑓𝜔 𝜖 𝐴1 , × [𝑋3 (𝜔1 )𝑃1 + 𝑋3 (𝜔2 )𝑃2 ] 𝐴1 ∈ { 𝜔1 , 𝜔2 }
𝑃(𝐴1 )
𝐸[𝑋3 /F 2 ] = , 𝑤𝑖𝑡ℎ {𝐴2 ∈ { 𝜔3 }
𝑖𝑓𝜔 𝜖 𝐴2 , 𝑋3 (𝜔3 )
𝐴3 ∈ { 𝜔4 }
{ 𝑖𝑓𝜔 𝜖 𝐴3 , 𝑋3 (𝜔4 )
1 1 2
3⁄ × [80 × ⁄8 + 75 × ⁄8] , 𝑖𝑓𝜔 𝜖 𝐴1
8 𝟕𝟔, 𝟔𝟔 , 𝒊𝒇𝝎 𝝐 𝑨𝟏
1 3
= 3⁄ × 70 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴2 = { 𝟕𝟎, 𝒊𝒇𝝎 𝝐 𝑨𝟐
8
1 2 𝟔𝟓 , 𝒊𝒇𝝎 𝝐 𝑨𝟑
{ 2⁄ × 65 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴3
8
o 𝐸[𝑋3 /F 1 ]
1
𝑖𝑓𝜔 𝜖 𝐴1 , × [𝑋3 (𝜔1 )𝑃1 + 𝑋3 (𝜔2 )𝑃2 ]
𝑃(𝐴1 ) 𝐴 ∈ { 𝜔1 , 𝜔2 }
𝐸[𝑋3 /F 1 ] = , 𝑤𝑖𝑡ℎ { 1
1 𝐴2 ∈ {𝜔3 , 𝜔4 }
𝑖𝑓𝜔 𝜖 𝐴2 , × [𝑋3 (𝜔3 )𝑃1 + 𝑋3 (𝜔4 )𝑃4 ]
{ 𝑃(𝐴2 )
1 1 2
3⁄ × [80 × ⁄8 + 75 × ⁄8] , 𝑖𝑓𝜔 𝜖 𝐴1
𝟕𝟔, 𝟔𝟔 , 𝒊𝒇𝝎 𝝐 𝑨𝟏
8
={ 1 = {
3 2 𝟔𝟖, 𝒊𝒇𝝎 𝝐 𝑨𝟐
5⁄ × [70 × ⁄8 + 65 × ⁄8] , 𝑖𝑓𝜔 𝜖 𝐴2
8
o 𝐸[𝑋2 /F 1 ]
1
𝑖𝑓𝜔 𝜖 𝐴1 , × [𝑋2 (𝜔1 )𝑃1 + 𝑋2 (𝜔2 )𝑃2 ]
𝑃(𝐴1 ) 𝐴 ∈ { 𝜔1 , 𝜔2 }
]
𝐸[𝑋2 /F 1 = , 𝑤𝑖𝑡ℎ { 1
1 𝐴2 ∈ {𝜔3 , 𝜔4 }
𝑖𝑓𝜔 𝜖 𝐴2 , × [𝑋2 (𝜔3 )𝑃1 + 𝑋2 (𝜔4 )𝑃4 ]
{ 𝑃(𝐴2 )
1 1 2
3⁄ × [75 × ⁄8 + 75 × ⁄8] , 𝑖𝑓𝜔 𝜖 𝐴1
𝟕𝟓, 𝒊𝒇𝝎 𝝐 𝑨𝟏
8
={ 1 = {
3 2 𝟔𝟔, 𝒊𝒇𝝎 𝝐 𝑨𝟐
5⁄ × [70 × ⁄8 + 60 × ⁄8] , 𝑖𝑓𝜔 𝜖 𝐴2
8
o 𝐸[𝑋2 /F 3 ]
36
1 1
1⁄ × 75 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴1
8
1 2 𝟕𝟓, 𝒊𝒇𝝎 𝝐 𝑨𝟏
2⁄ × 75 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴2
𝟕𝟓, 𝒊𝒇𝝎 𝝐 𝑨𝟐
8
= 1 = { = 𝑿𝟐 (𝝎)
3 𝟕𝟎, 𝒊𝒇𝝎 𝝐 𝑨𝟑
3⁄ × 70 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴3
8 𝟔𝟎, 𝒊𝒇𝝎 𝝐 𝑨𝟒
1 2
{ 2⁄ × 60 × ⁄8 , 𝑖𝑓𝜔 𝜖 𝐴4
8
o 𝐸[𝑋3 /F 0 ] = 𝑬(𝑿𝟑 )
o 𝐸[𝑋3 /F 3 ] = 𝑿3 (Same proof as 𝐸[𝑋2 /F 3 ] )
Example 2.2:
F 0 = {∅, Ω}
o 𝐸[𝑋2 /F 1 ]
1
𝑖𝑓𝜔 𝜖 𝐴1 , × [𝑋2 (𝜔1 )𝑃1 ]
𝑃(𝐴1 )
𝐴1 ∈ { 𝜔1 }
1
𝐸[𝑋2 /F 1 ] = 𝑖𝑓𝜔 𝜖 𝐴2 , × [+𝑋2 (𝜔2 )𝑃2 + 𝑋2 (𝜔3 )𝑃3 ] , 𝑤𝑖𝑡ℎ {𝐴2 ∈ {𝜔2 , 𝜔4 }
𝑃(𝐴2 )
𝐴2 ∈ {𝜔4 }
1
𝑖𝑓𝜔 𝜖 𝐴3 , × [𝑋2 (𝜔4 )𝑃4 ]
{ 𝑃(𝐴3 )
1
1⁄ × [66 × 1⁄4] , 𝑖𝑓𝜔 𝜖 𝐴1
4 𝟔𝟔, 𝒊𝒇𝝎 𝝐 𝑨𝟏
1
= 2⁄ × [64 × 1⁄4 + 63 × 1⁄4] , 𝑖𝑓𝜔 𝜖 𝐴2 = { 𝟔𝟑. 𝟓, 𝒊𝒇𝝎 𝝐 𝑨𝟐
4
1 𝟔𝟐, 𝒊𝒇𝝎 𝝐 𝑨𝟑
1⁄ × [62 × 1⁄4] , 𝑖𝑓𝜔 𝜖 𝐴3
{ 4
o 𝐸[𝑋2 /F 2 ]
37
𝑖𝑓𝜔 𝜖 𝐴1 , 𝑋2 (𝜔1 ) 𝐴1 ∈ {𝜔1 }
𝑖𝑓𝜔 𝜖 𝐴3 , 𝑋2 (𝜔2 ) 𝐴2 ∈ {𝜔2 }
𝐸[𝑋2 /F 2 ] = , 𝑤𝑖𝑡ℎ {
𝑖𝑓𝜔 𝜖 𝐴3 , 𝑋2 (𝜔3 ) 𝐴3 ∈ {𝜔3 }
{ 𝑖𝑓𝜔 𝜖 𝐴4 , 𝑋2 (𝜔4 ) 𝐴4 ∈ {𝜔4 }
1 1
1⁄ × 66 × ⁄4 , 𝑖𝑓𝜔 𝜖 𝐴1
4
1 1 𝟔𝟔, 𝒊𝒇𝝎 𝝐 𝑨𝟏
1⁄ × 64 × ⁄4 , 𝑖𝑓𝜔 𝜖 𝐴2
𝟔𝟒, 𝒊𝒇𝝎 𝝐 𝑨𝟐
4
= 1 = { = 𝑿𝟐 (𝝎)
1 𝟔𝟑, 𝒊𝒇𝝎 𝝐 𝑨𝟑
1⁄ × 63 × ⁄4 , 𝑖𝑓𝜔 𝜖 𝐴3
4 𝟔𝟐, 𝒊𝒇𝝎 𝝐 𝑨𝟒
1 1
{ 1⁄ × 62 × ⁄4 , 𝑖𝑓𝜔 𝜖 𝐴4
4
Takeaway message: Based on the available information (filtration), our expectations can vary
significantly. For instance, the insights accessible to a broker, asset manager, or individual
investor differ greatly. A broker has in-depth knowledge of who is buying and selling, which is
considerably more substantial than the information an individual investor possesses. This
broader understanding allows a broker to form a distinct perspective on the expected
conditional return, contrasting markedly from that of a typical investor.
From a geometric point of view, the conditional expectation of a random variable X defined on
(Ω , F ) can be interpreted as the projection of X in the Hilbert space 𝐿2 (F ).
The Hilbert space 𝐿2 (F ) consists of square-integrable random variables with respect to the
probability measure on the sigma-algebra F.
It provides a natural framework for studying random variables, their conditional expectations,
and defining orthogonal projection.
The expected value 𝔼[(X - 𝔼(X| F ))] provides the average distance between X and its
conditional expectation over all possible outcomes.
38
The squared average distance 𝐸[𝑋 − 𝐸(𝑋|F )]2 between X and its conditional expectation in
𝐿2 (F) quantifies the discrepancy between the two.
Squaring the difference ensures that the distance is always positive, which is a desirable
property when measuring distances. It also penalizes larger deviations more heavily, which is
often useful in statistical applications and it is consistent with the properties of the Hilbert
space 𝐿2 (F).
X
X -
𝐸(𝑋|F )
𝐿2 (F)
𝐸(𝑋|F )
39
III. Martingales
Investire, Mart, Gale, and the Wise Man
"Oh, sir," Investire exclaimed, his eyes filled with awe, "your wisdom is truly inspiring! I dream
of becoming like you, immersing myself in books, and striving to create the most magnificent
library ever known. But I often question if I'm following the right path." The old man said, "In
life," he began, "you accumulate knowledge, devour the words of countless authors, and
absorb the wisdom of those who visited before us. This vast reservoir of experiences expands
your sigma algebra. When your predictions align with reality, people may call it wisdom,
expertise, or even a well-functioning model. The labels matter not; what's important is the
understanding you gain. However, my dear son, remember this: Sometimes, life rewards
intelligence and knowledge; at other times, it upholds its most equitable trait. Life, my boy, is
a martingale, but it possesses a twist, nevertheless." Investire's curiosity piqued, he asked,
"Mart and Gale? Who are they?" The elderly man smiled mysteriously. "Son, you must depart
now and return with the fairest game from the village of Probare. Only then shall I unveil the
secrets of Mart, Gale, and the twist that life holds." Investire nodded and headed to Probare.
[…] Entering Probare this time was easier for Investire, for
he was by then familiar with the door and the bridge. He
approached the door seeking guidance and whispered,
"Would you please tell me where to find your fairest game,
to play with Mart and Gale?" The door answered, " Ah, it
has been a while since you last graced us with your
presence,” The voice murmured “Yes, Mart and Gale are
over there, playing and waiting for a new one to join.” Investire said “How can I join their
mysterious game?", the door answered “To partake in their game, you must gather apples,
sweet red ones. Look beside me, and you shall find what you seek. But heed my words, dear
traveler, for Mart and Gale possess riddles as deep as a black hole and as sweet as the apples
you will play with. Approach with caution and let not their playful jests diminish your resolve”.
Investire collected the apples, and approached Mart and Gale, two funny old men who were
arm-wrestling. Taking a deep breath, he decided to join in, and they welcomed him
immediately. At first it was Mart and Gale who were arm-wrestling and then Investire knew it
will be his turn. During the arm-wrestling rounds, Investire closely watched Gale's every move,
16 The concept of martingale in probability theory was introduced by Paul Lévy in 1934, though he did
not name it. The term "martingale" was introduced later by Ville (1939), who also extended the definition
to continuous martingales. Much of the original development of the theory was done by Joseph Leo Doob
among others.
40
trying to discern a pattern or a clue that would
give him an edge. After several rounds, it was
his turn and Mart was supposed to help him
and to update the score. Mart said, “Young one,
your moment has arrived. Speak of what you
know, unveil the number of apples you dare to
risk, and I shall inscribe the score of our game,
as you play. Know this: I stand as your ally, yet
the true adversary you face is Gale, not me.” So
Investire approached Mart and shared his
observations and how sometimes Gale decides to simply let the other win. Investire hoped by
sharing this knowledge with Mart he will predict who was going to win and get an insight about
how much apples to risk. However, every time, Investire shared his observations Mart says
“Noted” and burst into laughs. And the outcome was never revealed, not via Investire’s keen
eyes, nor Mart’s estimations and help; Investire won some, and lost a lot of apples. And the
game became a cycle of occasional hope, and increasing disappointment, so Investire decided
to stop and leave Probare.
Returning to the village of Capitalis, Investire went to Mr. Ville. As he recounted his
adventures in Probare, Mr. Ville listened intently then he said "Mart is indeed a funny guy. No
matter the secrets you share, no matter the depth of your knowledge, he shrouds himself in a
veil of forgetfulness. Why, you ask? For in this game you played, the current value of each
round should be equal to and only to itself so that knowledge of yesterday or the uncertainties
of tomorrow have no do in who wins and who loses; and that is the essence of Fairness. This
doesn’t mean knowledge is of no value; the trivial record he meticulously maintains was
expanding your knowledge, your Filtration over time. I know, you may feel deceived because
although there were only two possible outcomes, either you win or Gale wins, and despite
these very small and finite possibilities you couldn’t predict what shall happen until it
happens. This, my child is a Martingale game.” Investire looked at him and added “But Mr. Ville
this loss costed me not only feeling fool and naive, but also the precious apples I was given by
the door of Probare!” The wise man said “What I admire about Mart and Gale is that they test
your patience. You should’ve known that if you were patient enough, and risk averse enough,
that is regardless of how many apples you lose, you risk the double of it in the next round, at a
certain point in time you would undoubtedly win a huge sum and offset all the previous
losses. My son, Mart and Gale teach you to never give up!” Investire stopped speechless then
asked, “And what’s the twist about life and Martingales?” “Life can be a martingale, a fair game
where we all beg for luck because nothing else matters, so you simply embrace the now
without the burden of the past or the uncertainty of the future: You cross your fingers, and you
never give up. But don’t let that make you unsure of the importance of your thread of
knowledge for that life has a multitude of stochastic processes and each process is specific,
sometimes yesterday matters, sometimes it doesn’t, sometimes a pattern will repeat itself
sometimes it won’t… Go by the Botanical Lake of Capitalis, observe it closely, my child, for
within its ripples lies another secret of embracing life's unpredictable journey.”
Takeaway message
In this journey Investire learned about Martingales, a specific type of stochastic processes. In
this game, Mart represented the guard of fairness while Gale embodied the randomness of
41
stochastic processes. When Mr. Ville said, “the current value of each round should be equal to
and only to itself” and explained how the thread of knowledge (conditional expectation) won’t
make your predictions more precise, he meant that 𝑬[𝑴𝒕 /F𝐬 ] = 𝑴𝒔 ; and when he
acknowledged that the possible events were small and finite he meant that 𝑬[|𝑴𝒕 |] <
∞ ∀ 𝒕 ≥ 𝟎, and when he said that he shouldn’t underestimate the value of knowledge, he
insisted on the importance of expanding your filtration for that your martingale is adapted to
F. And those are the properties of a Martingale process. So, to check whether you are playing
with Mart and Gale or not, check whether these properties are satisfied or not.
1. Introduction
Martingales are a concept that comes from the world of games and gambling. Imagine
you're playing a game with money, and at different points in time, you have a certain amount
of cash (let's call it 𝑀𝑛 ). You also have some information about the game up to that point 𝐹𝑛 .
Now, here's the cool part: If the way your money changes over time follows a simple rule,
where, on average, the money you'll have in the next round is just what you have now, given
the information you know, then we call this sequence of money a martingale. This rule makes
the game seem fair.
For instance, think of flipping a fair coin. Each time you flip, if you win, you get some money
added, and if you lose, you lose some money. If the coin is fair, your total money over time will
behave like a martingale.
However, if the game isn't fair – maybe the coin is more likely to land on one side – then your
money might not follow this rule anymore. It gets a bit trickier.
Mathematically, martingales are sequences that have some neat properties, especially when it
comes to how they change over time. In this course, we're going to explore these properties
and look at different examples to see how they can be used to understand things better using
math.
2. Martingale Properties
i. 𝐸[|𝑀𝑡 |] < ∞ ∀ 𝑡 ≥ 0
ii. M is adapted to the filtration F, meaning that 𝑀𝑡 is F𝑡 - measurable ∀ 𝑡 ≥ 0
iii. 𝐸[𝑀𝑡 /Fs ] = 𝑀𝑠 ∀ 0 ≤ 𝑠 ≤ 𝑡
This property implies that the expected value of the random variable 𝑀𝑡 (the value of the
martingale at time t) is finite for all time periods t. It means that, on average, the martingale
42
does not exhibit extreme swings or reach infinite values, ensuring that the gambler's expected
gain or loss remains bounded over time.
This means that the value of the martingale at any time t only depends on the information that
was available up to time t. In other words, the martingale does not take into account any future
information.
In gambling, this means that you cannot use the martingale betting strategy to predict the
outcome of a future bet. The martingale betting strategy only takes into account the past bets,
and it cannot predict what will happen in the future.
In the context of gambling, this property represents the core principle of a martingale strategy.
It states that the conditional expectation of the martingale's future value 𝑀𝑡 given all available
information up to a prior time 𝐹𝑠 is equal to its current value at that prior time 𝑀𝑠 . This property
implies that the martingale strategy is fair and unbiased, as the expected future value is the
same as the current value, given the available information.
𝐸[𝑀𝑡 ] = 𝐸[𝑀0 ] ∀ 𝑡 ≥ 0
Example 2.1: Flip a coin: you get 10 dinars if head, you get nothing if tail.
Example 2.2: Let X be a finite random variable on the filtered probability space (Ω , F , F, P).
Let M be the stochastic process such as:
𝑀𝑡 = 𝐸(𝑋/F 𝑡 )
To prove that 𝑀 is a martingale we need to check that all the three properties stand, otherwise
we provide a counter example to prove that is not a martingale.
i. 𝐸[|𝑀𝑡 |] < ∞ ?
→ So 𝐸[|𝐸[𝑋/F 𝑡 ]|] ≤ ∞
43
= 𝐸[𝑋/F 𝑠 ] = 𝑀𝑠 ∀ 𝑠, 𝑡 ≥ 0 𝑤𝑖𝑡ℎ 𝑡 > 𝑠
So 𝑀 is a Martingale.
Example 2.3:
70 , 𝑖𝑓𝜔 𝜖 𝐴1 𝐴1 ∈ { 𝜔1 }
70, 𝑖𝑓𝜔 𝜖 𝐴2 𝐴2 ∈ { 𝜔2 }
𝐸[𝑋3 /F 2 ] = , 𝑤𝑖𝑡ℎ
50 , 𝑖𝑓𝜔 𝜖 𝐴3 𝐴3 ∈ { 𝜔3 }
{ 30 , 𝑖𝑓𝜔 𝜖 𝐴4 { 𝐴4 ∈ { 𝜔4 }
So 𝐸[𝑋3 /F 2 ] = 𝑋3 ≠ 𝑋2
To prove that X is a martingale we need to go case by case for each one of three properties:
i. 𝑬[|𝑿𝒕 |] < ∞ , ∀ 𝒕 ≥ 𝟎
1 1 1 1
✓ 𝐸(𝑋0 ) = 4 × 50 + 4 × 50 + 4 × 50 + 4 × 50 = 50 < ∞
1 1 1 1
✓ 𝐸(𝑋1 ) = × 60 + × 60 + × 40 + × 40 = 50 < ∞
4 4 4 4
✓ 𝐸(𝑋2 ) = 50 < ∞
✓ 𝐸(𝑋3 ) = 50 < ∞
44
F0 = {∅, Ω}
F1 = 𝜎({𝜔1 , 𝜔2 }, {𝜔3 , 𝜔4 })
✓ 𝔽 = {Ft ∶ 𝒕 ∈ 𝑻} generated by X:
F2 = 𝜎({𝜔1 }, {𝜔2 }, {𝜔3 }, {𝜔4 })
{F 3 = 𝜎({𝜔1 }, {𝜔2 }, {𝜔3 }, {𝜔4 })
iii. 𝑬[𝑿𝒕 /F 𝒔 ] = 𝑿𝒔 , ∀ 𝟎 ≤ 𝒔 ≤ 𝒕
✓ 𝐸[𝑋0 /F 0 ] = 𝐸(𝑋0 ) = 50 = 𝑋0
1 1 1
(1/(2) ) × [60 × 4 + 60 × 4], 𝑖𝑓𝜔 𝜖 𝐴1 𝐴 ∈ {𝜔1 , 𝜔2 }
✓ 𝐸[𝑋1 /F 1 ] = { , 𝑤𝑖𝑡ℎ { 1
1 1
(1/(2) ) × [40 × 4 + 40 ×
1
], 𝑖𝑓𝜔 𝜖 𝐴2 𝐴2 ∈ {𝜔3 , 𝜔4 }
4
60, 𝑖𝑓𝜔 𝜖 𝐴1
={ = 𝑋1
40, 𝑖𝑓𝜔 𝜖 𝐴2
1 1 1
(1/(2) ) × [70 × 4 + 50 × 4], 𝑖𝑓𝜔 𝜖 𝐴1 𝐴 ∈ {𝜔1 , 𝜔2 }
✓ 𝐸[𝑋2 /F 1 ] = { , 𝑤𝑖𝑡ℎ { 1
1
(1/( ) ) × [50 ×
1
+ 30 ×
1
], 𝑖𝑓𝜔 𝜖 𝐴2 𝐴2 ∈ {𝜔3 , 𝜔4 }
2 4 4
60, 𝑖𝑓𝜔 𝜖 𝐴1
={ = 𝑋1
40, 𝑖𝑓𝜔 𝜖 𝐴2
1 1 1
(1/(2) ) × [70 × 4 + 50 × 4], 𝑖𝑓𝜔 𝜖 𝐴1 𝐴 ∈ {𝜔1 , 𝜔2 }
✓ 𝐸[𝑋3 /F 1 ] = { , 𝑤𝑖𝑡ℎ { 1
1
(1/( ) ) ×
1
[50 × + 30 ×
1
], 𝑖𝑓𝜔 𝜖 𝐴2 𝐴2 ∈ {𝜔3 , 𝜔4 }
2 4 4
60, 𝑖𝑓𝜔 𝜖 𝐴1
={ = 𝑋1
40, 𝑖𝑓𝜔 𝜖 𝐴2
45
70, 𝑖𝑓𝜔 𝜖 𝐴1 𝐴1 ∈ {𝜔1 }
50, 𝑖𝑓𝜔 𝜖 𝐴2 𝐴2 ∈ {𝜔2 }
✓ 𝐸[𝑋3 /F 2 ] = { , 𝑤𝑖𝑡ℎ = 𝑋2
50, 𝑖𝑓𝜔 𝜖 𝐴3 𝐴3 ∈ {𝜔3 }
30, 𝑖𝑓𝜔 𝜖 𝐴4 {𝐴4 ∈ {𝜔4 }
✓ 𝐸[𝑋3 /F 3 ] = 𝑋3
The 3rd property checks for every one of the cases above.
Example 2.4:
• Is X a Martingale ?
85, 𝑖𝑓 𝜔 ∈ 𝐴1 𝐴1 ∈ {𝜔1 }
85, 𝑖𝑓 𝜔 ∈ 𝐴2 𝐴 ∈ {𝜔2 }
𝐸[𝑋3 / 𝐹2 ] = { , 𝑤𝑖𝑡ℎ { 2
75, 𝑖𝑓 𝜔 ∈ 𝐴3 𝐴3 ∈ {𝜔3 }
55, 𝑖𝑓 𝜔 ∈ 𝐴4 𝐴4 ∈ {𝜔4 }
So 𝐸[𝑋3/F 2] = 𝑋3 ≠ 𝑋2
46
To prove that X is a martingale we need to go case by case for each one of three properties:
i. 𝑬[|𝑿𝒕 |] < ∞ , ∀ 𝒕 ≥ 𝟎
1 1 1 2
✓ 𝐸(𝑋0 ) = 4 × 75 + 8 × 75 + 8 × 75 + 4 × 75 = 75 < ∞
1 1 1 2
✓ 𝐸(𝑋1 ) = 4 × 80 + 8 × 80 + 8 × 60 + 4 × 60 = 67.5 < ∞
1 1 1 2
✓ 𝐸(𝑋2 ) = × 85 + × 75 + × 75 + × 55 = 67.5 < ∞
4 8 8 4
F0 = {∅, Ω}
F1 = 𝜎({𝜔1 , 𝜔2 }, {𝜔3 , 𝜔4 })
✓ 𝔽 = {Ft ∶ 𝒕 ∈ 𝑻} generated by X:
F2 = 𝜎({𝜔1 }, {𝜔2 }, {𝜔3 }, {𝜔4 })
{F 3 = 𝜎({𝜔1 }, {𝜔2 }, {𝜔3 }, {𝜔4 })
iii. 𝑬[𝑿𝒕 /F 𝒔 ] = 𝑿𝒔 , ∀ 𝟎 ≤ 𝒔 ≤ 𝒕
𝐸[𝑋0 /F 0 ] = 𝐸(𝑋0 ) = 75 = 𝑋0
3. Additional Exercises
Solution:
47
2) Let 𝑋𝑖 be a sequence of identically distributed random variables with common distribution
𝑎 𝑤𝑖𝑡ℎ 𝑝𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑝1
𝑋𝑖 = {
−𝑏 𝑤𝑖𝑡ℎ 𝑝𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑝2 = 1 − 𝑝1
where 0 ≤ a,b. Let 𝑆𝑛 = ∑𝑛𝑖=1 𝑋𝑖
Solution:
Property 1:
We need to ensure that the expected value of the sum of 𝑆𝑛 is finite for any time t≥0.
Since each 𝑋𝑖 takes values a or -b, and 𝑝1 and 𝑝2 are probabilities, |a| and |b| must be finite.
Property 3:
48
Python Time !
import numpy as np
import matplotlib.pyplot as plt
def coin_flip() :
return np.random.choice ( ['heads', 'tails'] )
49
# Initial wealth and number of flips
initial_wealth = 10
num_flips = 100
num_simulations = 100
# Plotting
plt.figure ( figsize = (14, 7) )
Discover the captivating world of finance through Python programming. Run the code
and witness the enchantment of what programming can unfold!
50
IV. Brownian Motion
Investire by the Botanical Lake
While Investire marveled at his creation, the ripples transformed, shaping into an arrow on the
water's surface, as if guiding him somewhere. Hesitant, Investire stood up and followed the
direction indicated by the arrow. It led him to a massive apple tree near the lake. Investire
exclaimed, "Were you the one guiding me to touch the water?" In response, an apple fell from
the tree and landed on his head. Investire, perplexed, muttered, "Oh, Capitalis must be driving
me mad, talking to doors and trees."
To his astonishment, the apple spoke, "You're the one who determines the value of apples! Tell
me my worth, and I'll reveal why you're here." Investire, surprised, replied, "It was Finis, not
me, and I don't have my book to answer your question." The apple retorted, "But you can read
what was written on the water's surface, and I cannot. Drop me into the lake, and Iet me sink
in despair." Investire released the apple into the water, creating a larger ripple. This time, no
arrows appeared; instead, a number emerged. He hurried back to the apple tree and inquired,
"What does this number signify?" Another apple fell, hitting his head, and replied, "That
represents part of our future value, but not all of it."
Investire grabbed a handful of apples before any more could fall on his head and made his way
back to his library. He felt that he had taken yet another step toward unraveling the mysteries
of uncertainty.
Takeaway message
When Investire reached the lake, it was very serene, and just as the surface of water starts at
a calm place so does the Brownian Motion (𝑾𝟎 = 𝟎) and that is your origin too! The ripples
change over time, in a random way, just like random variables in a stochastic process. As
Investire was ordered to touch the surface of the water, he was creating new ripples, yet they
17
Remember that the Brownian motion, before it was explained formally by A. Einstein, was first
observed by Robert Brown the Botanist.
51
weren’t perfectly harmonious, in fact they differed and were independent of each other and
that is the independence of increments (the random variables 𝑊𝑡 − 𝑊𝑠 and 𝑊𝑙 − 𝑊𝑘 are
independent (independence of increments). Yet most ripples seemed to hover around a similar
size, echoing the principles of a normal distribution.
Exactly like the ripples Investire created with his fingers on the surface of the water,
randomness creates future values in the realm of Finance and in our fate as well. This pattern
we observe is still uncertain yet more tamable than absolute uncertainty and we can use it to
minimize doubt, that is the case of this specific stochastic process, the Brownian Motion.
The number that was shown on the water every time Investire drops the apple, is indeed part
of the future value of the apple. Why “part”, you ask? The result of the Brownian Motion is
incorporated into a pricing model to understand the market behavior of the asset_ we meant
apple; a pricing model like the one you are familiar with, the one and only: Black-Scholes-
Merton model.
Introduction
Brownian motion was introduced by the botanist Robert Brown. Its mathematics was
developed primarily by Norbert Wiener. That is why many times we symbolize the Brownian
process by the letter W.
Let 𝑋𝑡 = 𝑊𝑡+𝑠 − 𝑊𝑠
i. Initial condition:
𝑋0 = 𝑊0+𝑠 − 𝑊𝑠 = 0 → 𝑿𝟎 = 𝟎
𝐶𝑜𝑣(𝑋𝑡 − 𝑋𝑧 ; 𝑋𝑘 − 𝑋𝑙 )
→ 𝑿𝒕 − 𝑿𝒛 ; 𝑿𝒌 − 𝑿𝒍 are independent.
= 𝑉𝑎𝑟(𝑊𝑇 − 𝑊𝑍 ) = 𝑇 − 𝑍 = 𝑡 + 𝑠 − 𝑧 − 𝑠 = 𝑡 − 𝑧
→ 𝑿𝒕 − 𝑿𝒛 ~ 𝑵(𝟎, 𝒕 − 𝒛)
iv. Continuity
𝑬[|𝑾𝒕 |] < ∞ , ∀ 𝒕 ∈ 𝑻 ?
i. 𝑬[|𝑾𝒕 |] < ∞ ?
+∞ +∞ 1 1 𝑧2 +∞ 1 1 𝑧2
𝐸[|𝑊𝑡 |] = ∫ |𝑧|𝑓(𝑧)𝑑𝑧 = ∫ |𝑧| 𝑒−2 𝑡 𝑑𝑧 = 2 ∫ 𝑧 𝑒−2 𝑡 𝑑𝑧
−∞ −∞ √2𝜋𝑡 0 √2𝜋𝑡
1 𝑧2
+∞
√𝑡 − √2𝑡 √2𝑡
= [− 2𝑒 2 𝑡 ] =0+ = <∞
√2𝜋 0 √𝜋 √𝜋
53
iii. 𝑬[𝑾𝒕 /F 𝒔 ] = 𝑾𝒔 , ∀ 𝟎 ≤ 𝒔 ≤ 𝒕 ?
𝐸[𝑊𝑡 /F 𝑠 ] = 𝐸[𝑊𝑡 + 𝑊𝑠 − 𝑊𝑠 /F 𝑠 ]
= 𝑊𝑠 = 𝑊𝑠
The 3rd property of a Martingale is checked.
Example 1.3 : Let Z be a random variable that follows a standard normal distribution (0,1). Let
the stochastic process X defined by:
𝑋𝑡 = √𝑡𝑍 ∀ 𝑡 ≥ 0
Is X a Brownian motion?
𝑋𝑡 − 𝑋𝑠 ~ 𝑁(0, 𝑡 − 𝑠) ?
𝑋𝑡 = √𝑡𝑍~ 𝑁(0, 𝑡)
𝑋𝑠 = √𝑠𝑍~ 𝑁(0, 𝑠)
Then 𝑋𝑡 − 𝑋𝑠 ~ 𝑁
Example 1.4: Let X be the stochastic process that model the Brent price. X is a set of random
variables defined by:
𝑋𝑡 = 𝜎𝑊𝑡 ∀𝑡 ∈ 𝑇
Is X a martingale?
To prove that X is a martingale we need to go case by case for each one of three properties of
a martingale:
54
i. 𝑬[|𝑿𝒕 |] < ∞ , ∀ 𝒕 ∈ 𝑻 ?
iii. 𝑬[𝑿𝒕 /F 𝒔 ] = 𝑿𝒔 , ∀ 𝟎 ≤ 𝒔 ≤ 𝒕 ?
= 𝜎𝑊𝑠 = 𝑋𝑠
The 3rd property of a Martingale is checked.
Homework: Let {𝑊𝑡 : 𝑡 ≥ 0} a standard Brownian motion. Are the following examples Brownian
motions ? Provide a proof or a counter example.
{−𝑊𝑡 : 𝑡 ≥ 0}
Solution:
{−𝑊𝑡 : 𝑡 ≥ 0}
Answer:
55
−𝑊𝑡 − (−𝑊𝑠 ) = −(𝑊𝑡 −𝑊𝑠 )
W is a Brownian motion so (𝑊𝑡 −𝑊𝑠 )~𝑁(0, 𝑡 − 𝑠) , 𝑊𝑡 ~𝑁(0, 𝑡) and 𝑊𝑠 ~𝑁(0, 𝑠)
𝐸(−(𝑊𝑡 −𝑊𝑠 )) = 𝐸(−𝑊𝑡 ) + 𝐸(𝑊𝑠 ) = −𝐸(𝑊𝑡 )+𝐸(𝑊𝑠 ) = 0
𝑉𝑎𝑟(−(𝑊𝑡 −𝑊𝑠 )) = (−1)2 𝑉𝑎𝑟(𝑊𝑡 −𝑊𝑠 ) = 𝑉𝑎𝑟(𝑊𝑡 −𝑊𝑠 ) = 𝑡 − 𝑠
→ −𝑾𝒕 − (−𝑾𝒔 ) = −(𝑾𝒕 −𝑾𝒔 ) ~𝑵(𝟎, 𝒕 − 𝒔)
iv. ∀𝜔 ∈ Ω 𝑡 ⟼ 𝑊𝑡 (𝜔) is continuous −𝑊𝑡 = −(1) × 𝑊𝑡 so ∀𝜔 ∈ Ω 𝑡 ⟼ −𝑊𝑡 (𝜔) is
continuous.
Answer:
• 𝑋0 = 𝑐𝑊 0 = 𝑐𝑊0 = 0 → 𝑋0 = 0
𝑐2
= 𝐶𝑜𝑣[(𝑐𝑊 𝑡 − 𝑐𝑊 𝑠 ) ; (𝑐𝑊 𝑘 − 𝑐𝑊 𝑙 )]
𝑐2 𝑐2 𝑐2 𝑐2
𝑡 𝑠 𝑘 𝑙
= 𝑐 2 . 𝐶𝑜𝑣[(𝑊 𝑡 − 𝑊 𝑠 ) ; (𝑊 𝑘 − 𝑊 𝑙 )] let = 𝑇, = 𝑆, = 𝐾 𝑎𝑛𝑑 =𝐿
𝑐2 𝑐2 𝑐2 𝑐2
𝑐2 𝑐2 𝑐2 𝑐2
→ 𝑋𝑡 − 𝑋𝑠 ; 𝑋𝑘 − 𝑋𝑙 are independent.
= 𝑐𝐸(𝑊𝑇 − 𝑊𝑆 ) = 0
𝑡 𝑠
𝑉𝑎𝑟(𝑋𝑡 − 𝑋𝑠 ) = 𝑉𝑎𝑟(𝑐𝑊 𝑡 − 𝑐𝑊 𝑠 ) )] , W is a Brownian Motion so 𝑊 𝑡 − 𝑊 𝑠 ~𝑁(0, − )
𝑐2 𝑐2 𝑐2 𝑐2 𝑐2 𝑐2
𝑡 𝑠
= 𝑉𝑎𝑟 (𝑐(𝑊 𝑡 − 𝑊 𝑠 )) = 𝑐 2 𝑉𝑎𝑟 (𝑊 𝑡 − 𝑊 𝑠 ) = 𝑐 2 (𝑐 2 − 𝑐 2 ) = 𝑡 − 𝑠
𝑐2 𝑐2 𝑐2 𝑐2
→ 𝑋𝑡 − 𝑋𝑠 ~ 𝑁(0, 𝑡 − 𝑠)
56
• 𝑋𝑡 = 𝑐𝑊 𝑡 and c a scalar, the product of a continuous function with a constant is also
𝑐2
continuous so 𝑋𝑡 is continuous .
𝑊0 =0 & ̃
𝑊0 =0
i. ̃0 →
𝑋0 = 𝜌𝑊0 + √1 − 𝜌2 𝑊 𝑿𝟎 = 𝟎.
ii. ∀ 0 < 𝑘 < 𝑙 < 𝑠 < 𝑡, we need to show that 𝑋𝑡 − 𝑋𝑠 and 𝑋𝑙 − 𝑋𝑘 are independent:
𝐶𝑜𝑣[𝑋𝑡 − 𝑋𝑠 ; 𝑋𝑙 − 𝑋𝑘 ]
̃𝑡 − 𝜌𝑊𝑠 − √1 − 𝜌2 𝑊
= 𝐶𝑜𝑣[(𝜌𝑊𝑡 + √1 − 𝜌2 𝑊 ̃𝑠 ); (𝜌𝑊𝑙 + √1 − 𝜌2 𝑊
̃𝑙 − 𝜌𝑊𝑘 −
̃𝑘 )]
√1 − 𝜌2 𝑊
̃𝑡 − 𝑊
= 𝐶𝑜𝑣[ 𝜌(𝑊𝑡 − 𝑊𝑠 ) + √1 − 𝜌2 (𝑊 ̃𝑠 ) ; 𝜌(𝑊𝑙 − 𝑊𝑘 ) + √1 − 𝜌2 (𝑊
̃𝑙 − 𝑊
̃𝑘 )]
̃𝑙 − 𝑊
= 𝜌2 𝐶𝑜𝑣[𝑊𝑡 − 𝑊𝑠 ; 𝑊𝑙 − 𝑊𝑘 ] + 𝜌√1 − 𝜌2 𝐶𝑜𝑣[𝑊𝑡 − 𝑊𝑠 ; 𝑊 ̃𝑘 ]
̃𝑡 − 𝑊
+𝜌√1 − 𝜌2 𝐶𝑜𝑣[𝑊 ̃𝑠 ; 𝑊𝑙 − 𝑊𝑘 ] + (1 − 𝜌2 )𝐶𝑜𝑣[𝑊
̃𝑡 − 𝑊
̃𝑠 ; 𝑊
̃𝑙 − 𝑊
̃𝑘 ]
=0
equal to 0.
𝑊 is a Brownian motion so 𝑊𝑡 − 𝑊𝑠 ; 𝑊𝑙 − 𝑊𝑘 are independent so 𝐶𝑜𝑣[𝑊𝑡 − 𝑊𝑠 ; 𝑊𝑙 −
𝑊𝑘 ] = 0
̃ is a Brownian motion so 𝑊
𝑊 ̃𝑡 − 𝑊
̃𝑠 ; 𝑊
̃𝑙 − 𝑊
̃𝑘 are independent so 𝐶𝑜𝑣[𝑊
̃𝑡 − 𝑊
̃𝑠 ; 𝑊
̃𝑙 −
̃𝑘 ] = 0
𝑊
̃𝑡 − 𝑊
We have, 𝑋𝑡 − 𝑋𝑠 = 𝜌(𝑊𝑡 − 𝑊𝑠 ) + √1 − 𝜌2 (𝑊 ̃𝑠 )
𝜌2 )(𝑡 − 𝑠))
57
→ So 𝑋𝑡 − 𝑋𝑠 ~ 𝑁
o Var[𝑋𝑡 − 𝑋𝑠 ] = 𝑡 − 𝑠 ?
̃𝑡 − 𝑊
= 𝑉𝑎𝑟[ 𝜌(𝑊𝑡 − 𝑊𝑠 ) + √1 − 𝜌2 (𝑊 ̃𝑠 )]
̃𝑡 − 𝑊
= 𝑉𝑎𝑟[ 𝜌(𝑊𝑡 − 𝑊𝑠 )] + 𝑉𝑎𝑟[√1 − 𝜌2 (𝑊 ̃𝑠 )] + 2. 𝐶𝑜𝑣[[ 𝜌(𝑊𝑡 − 𝑊𝑠 ); √1 − 𝜌2 (𝑊
̃𝑡 − 𝑊
̃𝑠 )]
̃𝑡 − 𝑊
= 𝜌2 𝑉𝑎𝑟( 𝑊𝑡 − 𝑊𝑠 ) + (1 − 𝜌2 )𝑉𝑎𝑟(𝑊 ̃𝑠 ) + 2. 𝜌. √1 − 𝜌2 . 𝐶𝑜𝑣[ (𝑊𝑡 − 𝑊𝑠 ); (𝑊
̃𝑡 − 𝑊
̃𝑠 )]
= 𝜌2 (𝑡 − 𝑠) + (1 − 𝜌2 )(𝑡 − 𝑠) − 0 = 𝑡 − 𝑠
→ 𝑉𝑎𝑟[𝑋𝑡 − 𝑋𝑠 ] = 𝑡 − 𝑠
̃𝑡 − 𝑊
NB: 𝐶𝑜𝑣[ (𝑊𝑡 − 𝑊𝑠 ); (𝑊 ̃𝑠 ) = 𝐶𝑜𝑣(𝑊𝑡 ; 𝑊
̃𝑡 ) − 𝐶𝑜𝑣(𝑊𝑡 ; 𝑊
̃𝑠 ) − 𝐶𝑜𝑣(𝑊𝑠 ; 𝑊
̃𝑡 ) + 𝐶𝑜𝑣(𝑊𝑠 ; 𝑊
̃𝑠 ) = 0
̃ are two independent Brownian motions.
because 𝑊 and 𝑊
o 𝐸[𝑋𝑡 − 𝑋𝑠 ] = 0?
̃𝑡 − 𝑊
𝐸[𝑋𝑡 − 𝑋𝑠 ] = 𝜌𝐸[𝑊𝑡 − 𝑊𝑠 ] + √1 − 𝜌2 𝐸[𝑊 ̃𝑠 ] = 0
→ So 𝑿𝒕 − 𝑿𝒔 ~ 𝑵(𝟎, 𝒕 − 𝒔)
𝜌 𝑖𝑠 𝑎 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
iv. ̃𝑡 (𝜔) are continuous →
∀𝜔 ∈ Ω 𝑡 ⟼ 𝑊𝑡 (𝜔) and 𝑊 so 𝑋𝑡 = 𝜌𝑊𝑡 +
̃𝑡 is continuous.
√1 − 𝜌2 𝑊
→ ∀𝝎 ∈ 𝛀 𝒕 ⟼ 𝑿𝒕 (𝝎) is continuous.
Example 1.6 : Let W be a Brownian motion. Show that 𝐶𝑜𝑣 [𝑊𝑡 ; 𝑊𝑠 ] = min(s; t)
Solution:
Without lost of generality, let 0 < s < t
𝐶𝑜𝑣 [𝑊𝑡 ; 𝑊𝑠 ]
=𝐶𝑜𝑣 [𝑊𝑡 − 𝑊𝑠 + 𝑊𝑠 ; 𝑊𝑠 ]
=𝐶𝑜𝑣 [𝑊𝑡 − 𝑊𝑠 ; 𝑊𝑠 ] + 𝐶𝑜𝑣 [𝑊𝑠 ; 𝑊𝑠 ]
=𝐶𝑜𝑣 [𝑊𝑡 − 𝑊𝑠 ; 𝑊𝑠 − 𝑊0 ] + 𝑉𝑎𝑟[𝑊𝑠 ]
=0+s (the increment of W are independent)
= min(s,t) since s < t
Python Time !
58
import numpy as np
import matplotlib.pyplot as plt
# Set the parameters for the simulation
mu = 0.05 # drift coefficient
sigma = 0.2 # diffusion coefficient
S0 = 100 # initial stock value
T = 1.0 # time horizon
N = 252 # number of steps (trading days in a year)
dt = T/N # time step
t = np.linspace(0, T, N) # time array
# Function to simulate one path of Geometric Brownian Motion
def simulate_gbm(S0, mu, sigma, dt, N):
S = np.zeros(N)
S[0] = S0
for i in range(1, N):
Z = np.random.standard_normal()
S[i] = S[i-1] * np.exp((mu - 0.5 * sigma**2) * dt + sigma *
np.sqrt(dt) * Z)
return S
for _ in range(num_paths):
S = simulate_gbm(S0, mu, sigma, dt, N)
plt.plot(t, S)
59
V. Stochastic Calculus
When the dawn broke, the library turned into a ballroom, crowded with people, and
filled with music. Investire stood on the first floor, contemplating his empire of books, and
admiring how people are moving harmoniously and dancing on the floor. The more he
observed the dancers, the more puzzled he got and once again Investire found himself
wandering in the Playground of Randomness:
As the dancers moved from one place to another, Investire didn’t know the direction they were
heading in. He quickly realized he was in front of a stochastic process that reminded him of the
time he read the tome and how you can escape randomness with a thread of knowledge.
However, this process felt different because more dancers were joining the rest and
Investire knew for sure they were doing the Valse dance at that time; so, the moves were
expected to a certain extent. The young boy said “I know where they are, what they’re doing
but I don’t know where they are going. This has an element of certainty and chaos at the same
time”. Investire raised his head to the ceiling thinking about this puzzle. And, when he looked
back at the dancers, they were all over the place, and under no circumstances was he able to
guess what he saw. Investire thought, “I raised my head, and when I looked back down, I was
lost. I would've never guessed the next change that was about to happen because, again, at the
core of the puzzle lies fluctuations and randomness, of where the dancers were heading to.”
As he was trying to find what certainty mixed with chaos resulted in, the musicians
changed the melody, and the dancers started to move vigorously as if they were jumping. A
very vibrant and energetic atmosphere reigned in the library. The dance was still the same
process, but somehow more intense. Investire found himself focused on where they were
heading more than the overall dance. In other words, when the dancers were almost jumping,
the moves of the Valse were almost insignificant compared to where they were dancing. It was
18
“The Origin of the Sun”, or “Nippon” is the name that was given to Japan in the medieval times that
reflects its location to the east of China. Here we want you to always relate dancing, as a stochastic process,
to the Japanese mathematician Kiyoshi Ito.
60
as if the regular elements no longer mattered as much as chaos because what Investire cared
about then were the jumps.
Investire almost completely disregarded the fact that the dancers were doing the Valse
and observed them in their chaotic nature. Yet even then, within chaos lay order; some dancers
jumping in ecstasy seemed to do so smoothly and harmoniously, as if they danced together
and their chaos also "co-varied together."
Investire pondered, "What about the dancers who aren't as skilled or struggle to move
smoothly together? How important are they in the dance?" So, he observed the overall scene
and quickly understood that regardless of whether they coordinated or not, every dancer and
every dance influenced one another. If one dancer saw another heading in a particular
direction, they would adjust their own moves to avoid collisions.
Takeaway Message:
The dance was indeed a stochastic process, but more specifically an Ito process. This process
_or dance or (𝑿𝒕 )_ was defined on the same initial probability filtered space ((Ω , F , F, P))
Investire came up with in his library. And Investire wasn’t mistaken with his observation;
predicting where the dance will lead in the upcoming moments included and required knowing
where they are now (𝑿𝟎 ), along with the regular change suggested by the usual movements
𝒕
of the Valse dance (∫𝟎 𝑲𝒔 𝒅𝒔 ), and with the random surprises of where the dancers would
𝒕
decide to go (∫𝟎 𝑯𝒔 𝒅𝑾𝒔 ). The fact that just upon turning his head and then looking back again,
the outcome of the dance (this Ito process) was very unpredictable, captures the complexities
of the randomness of this process. To deal with it we have to (1) consider it over an
infinitesimally small-time interval and (2) to admit that we cannot predict the rate of change
because this process is inherently influenced by random fluctuations. Once (1) and (2) are
understood, we can solve this problem using the differential form of the process 𝒅𝑿𝒕 =
𝒅𝒇
𝑲𝒕 𝒅𝒕 + 𝑯𝒕 𝒅𝑾𝒕 re-differentiating it again gives us Ito’s Lemma: 𝒅𝒇(𝑿𝒕 , 𝒕) = 𝒅𝒙 (𝑿𝒕 , 𝒕)𝒅𝑿𝒕 +
𝒅𝒇 𝟏 𝝏𝟐 𝒇
(𝑿𝒕 , 𝒕)𝒅𝒕 + (𝑿𝒕 , 𝒕)𝒅〈𝑿〉𝒕 . When the music changed, the dancers were still dancing, so
𝒅𝒕 𝟐 𝝏𝒙𝟐
we were still in front of an Ito process. But Investire cared less about the regular element of
𝒕
the process (∫𝟎 𝑲𝒔 𝒅𝒔 ), and focused on the chaotic element of it that seemed to varied
significantly. And that’s how the Ito Process became a quadratic variation 〈𝑋〉𝑡 =
𝑡
∫0 𝐻𝑠 2 𝑑𝑠 ∀ 𝑡 ∈ 𝑇 that can also be written in its differential form for the same reasons.
When Investire felt that within all that jumping and chaos there was a taste of synchronization
between the dances, he noticed that two Ito processes, taken into consideration at the same
time can display smoothness and that covariation in chaos is exactly the Quadratic Covariation:
𝑡
〈𝑋, 𝑌〉𝑡 = ∫0 𝜌𝐻𝑡 𝐿𝑡 𝑑𝑠 ∀𝑡 ∈ 𝑇 which again can be written in its differential form. But what
about the other dancers and the other dances? In fact the idea of how one dancer heading to
one location influenced the reluctance of another to go to the same place depicts how dancers
61
or random variables affect one another and the Multiplication Theorem translates this
relationship between random variables.
1. Ito Process
𝑑𝑋𝑡 = 𝐾𝑡 𝑋𝑡 𝑑𝑡 + 𝐻𝑡 𝑋𝑡 𝑑𝑊𝑡
2. Quadratic variation
𝑑〈𝑋〉𝑡 = 𝜎2 𝑑𝑡 ∀ 𝑡 ∈ 𝑇
𝑑𝑋𝑡 = 𝐾𝑡 𝑋𝑡 𝑑𝑡 + 𝐻𝑡 𝑋𝑡 𝑑𝑊𝑡
2
𝑑〈𝑋〉𝑡 = (𝐻𝑡 𝑋𝑡 ) 𝑑𝑡 ∀ 𝑡 ∈ 𝑇
62
Example 2.3: Cox–Ingersoll–Ross model:
𝑑〈𝑋〉𝑡 = 𝜎2 𝑟𝑡 𝑑𝑡 ∀ 𝑡 ∈ 𝑇
3. Itô’s Lemma
Example 3.1: Let the stock price of Tesla be following a geometric Brownian motion:
Compute 𝑑𝑓(𝑆𝑡 , 𝑡)
𝑑𝑓 𝑑𝑓 1 𝜕2𝑓
𝑑𝑓(𝑆𝑡 , 𝑡) = (𝑆𝑡 , 𝑡)𝑑𝑆𝑡 + (𝑆𝑡 , 𝑡)𝑑𝑡 + (𝑆 , 𝑡)𝑑〈𝑆〉𝑡
𝑑𝑥 𝑑𝑡 2 𝜕𝑥 2 𝑡
1 1 1
𝑑𝑓(𝑆𝑡 , 𝑡) = 𝑑𝑆 + 0 + (− 2 ) 𝑑〈𝑆〉𝑡
𝑆𝑡 𝑡 2 𝑆𝑡
1 1 1
𝑑𝑓(𝑆𝑡 , 𝑡) = (𝜇𝑆𝑡 𝑑𝑡 + 𝜎𝑆𝑡 𝑑𝑊𝑡 ) + (− 2 ) (𝜎²𝑆𝑡2 𝑑𝑡)
𝑆𝑡 2 𝑆𝑡
1
𝑑𝑓(𝑆𝑡 , 𝑡) = (𝜇𝑑𝑡 + 𝜎𝑑𝑊𝑡 ) − 𝜎 2 𝑑𝑡
2
1
𝑑𝑓(𝑆𝑡 , 𝑡) = ( 𝜇 − 𝜎 2 )𝑑𝑡 + 𝜎𝑑𝑊𝑡
2
1
𝑑𝑙𝑜𝑔(𝑆𝑡 ) = ( 𝜇 − 𝜎 2 )𝑑𝑡 + 𝜎𝑑𝑊𝑡
2
𝑡 𝑡
1
∫ 𝑑𝑙𝑜𝑔(𝑆𝑡 ) = ∫ ( 𝜇 − 𝜎 2 )𝑑𝑡 + 𝜎𝑑𝑊𝑡
0 0 2
𝑡
1
𝑙𝑜𝑔(𝑆𝑡 ) − 𝑙𝑜𝑔(𝑆0 ) = ∫ ( 𝜇 − 𝜎 2 )𝑑𝑡 + 𝜎𝑑𝑊𝑡
0 2
63
1
𝑙𝑜𝑔(𝑆𝑡 ) − 𝑙𝑜𝑔(𝑆0 ) = ( 𝜇 − 𝜎 2 )𝑡 + 𝜎𝑊𝑡
2
1
𝑆𝑡 = 𝑆0 exp (( 𝜇 − 𝜎 2 )𝑡 + 𝜎𝑊𝑡 )
2
Now you can compute the value of a call option that has a payoff:
𝐶𝑡 = max (𝑆𝑡 − K, 0)
𝐶0 = 𝐸[exp (−𝑟𝑡)𝐶𝑡 /F 0 ]
Answer:
𝜎2
And we know 𝑆𝑇 = 𝑆0 𝑒 (( 𝜇− 2 )𝑇+𝜎𝑊𝑇 )
So
𝐶0 = 𝑒 −𝑟𝑇 𝐸[max(𝑆𝑇 − K, 0)] = 𝑒 −𝑟𝑇 𝐸[(𝑆𝑇 − K)1{𝑆𝑇 >𝐾} ]
Part 𝚰𝚰:
𝜎2
(( 𝜇− 2 )𝑇+𝜎𝑊𝑇 )
𝑃[𝑆𝑇 > 𝐾] = 𝑃 [𝑆0 𝑒 > 𝐾]
1
= 𝑃 [ ( 𝜇 − 𝜎 2 )𝑇 + 𝜎𝑊𝑇 > ln(𝐾/𝑆0 )]
2
1
ln(𝐾/𝑆0 ) − (𝜇 − 2 𝜎 2 ) 𝑇 𝑊𝑇
= 𝑃 [ (𝑊𝑇 ≥ ] we know that 𝑊𝑇 ~𝑁(0, 𝑇) 𝑠𝑜 ~𝑁(0,1)
𝜎 √𝑇
1 1
ln(𝐾/𝑆0 ) − (𝜇 − 2 𝜎 2 ) 𝑇 ln(𝐾/𝑆0 ) − (𝜇 − 2 𝜎 2 ) 𝑇
= 𝑃 [ (𝑍 ≥ ] let α =
𝜎√𝑇 𝜎√𝑇
64
So
1
ln(𝑆0 /𝐾)+(𝜇− 𝜎 2 )𝑇
−𝑟𝑇 2
𝚰𝚰 = −𝑒 𝐾.𝑃[ (𝑍 < −α] with −α = 𝜎 √𝑇
Part 𝚰
𝜎2
So we need to find out when 𝑆𝑇 = 𝑆0 𝑒 (( 𝜇− 2 )𝑇+𝜎𝑊𝑇 ) > 𝐾 ?
𝜎2 1
𝑆0 𝑒 (( 𝜇− 2 )𝑇+𝜎𝑊𝑇 ) ≥ 𝐾 → (𝜇 − 𝜎 2 ) 𝑇 + 𝜎𝑊𝑇 ≥ ln(𝐾/𝑆0 ) → 𝑊𝑇
2
1
ln(𝐾/𝑆0 ) − (𝜇 − 2 𝜎 2 ) 𝑇
≥
𝜎
𝜎2
−𝑟𝑇 +∞ ( 𝜇− 2 )𝑇+𝜎𝑤
𝚰=𝑒 𝑆0 ∫−∞ 𝑒 𝑓(𝑤) 1{𝑊>α√𝑇} 𝑑𝑤 → 𝚰=
1
+∞ − 𝜎 2 𝑇+𝜎𝑊
𝑒 −(𝑟−𝜇)𝑇 𝑆0 ∫α 𝑒 2 𝑓(𝑤)𝑑𝑤
1 1 𝑤2
with 𝑓(𝑤) = 𝑒−2 𝑇
√2𝜋𝑇
+∞ 2 +∞
1 1 2 𝑇+𝜎𝑊−1 𝑊 1 1 2 𝑇 2 −2𝜎𝑇𝑊+ 𝑊 2 )
∫ 𝑒 − 2𝜎 2 𝑇 𝑑𝑤 = ∫ 𝑒 − 2𝑇(𝜎 𝑑𝑤
α√𝑇 √2𝜋𝑇 α√𝑇 √2𝜋𝑇
+∞
1 1 2
=∫ 𝑒 − 2𝑇(𝑊−𝜎𝑇) 𝑑𝑤
α√𝑇 √2𝜋𝑇
Let 𝑊 ′ = (𝑊 − 𝜎𝑇)/ √𝑇
So
+∞
1 − 1(𝑊′)2
∫ 𝑒 2 𝑑𝑊 ′ = 𝑃[ (𝑍 ≥ α′ ] = 𝑃[ (𝑍 < −α′ ]
α′ √2𝜋
65
𝑆 1
ln( 0 )+(𝑟+ 𝜎 2 )𝑇
Part 𝚰 becomes 𝚰 = 𝑒 −(𝑟−𝑟)𝑇 𝑆0 . 𝑃[ (𝑍 < −α′ ] = 𝑆0 . 𝑃[ (𝑍 < −α′ ] with −α′ = 𝐾
𝜎 √𝑇
2
=
𝑑1
𝑓(𝑥) = 𝑥 2
Compute 𝑑𝑓(𝑆𝑡 , 𝑡)
𝑑𝑓 𝑑𝑓 1 𝜕2𝑓
𝑑𝑓(𝑆𝑡 , 𝑡) = (𝑆𝑡 , 𝑡)𝑑𝑆𝑡 + (𝑆𝑡 , 𝑡)𝑑𝑡 + (𝑆 , 𝑡)𝑑〈𝑆〉𝑡
𝑑𝑥 𝑑𝑡 2 𝜕𝑥 2 𝑡
1
𝑑𝑓(𝑆𝑡 , 𝑡) = 2𝑆𝑡 𝑑𝑆𝑡 + 0 + (2)𝑑〈𝑆〉𝑡
2
Example 3.3:
𝑓(𝑥) = 𝑥 2
1
𝑑𝑓(𝑊𝑡 ) = 2 𝑊𝑡 𝑑𝑊𝑡 + × 2𝑑𝑡 = 2 𝑊𝑡 𝑑𝑊𝑡 + 𝑑𝑡
2
𝑡 𝑡
∫ 𝑑𝑊𝑡2 = ∫ 2 𝑊𝑡 𝑑𝑊𝑡 + 𝑑𝑡
0 0
𝑡 𝑡
𝑊𝑡2 − 𝑊02 = 2 ∫ 2 𝑊𝑡 𝑑𝑊𝑡 + ∫ 𝑑𝑡
0 0
𝑡
𝑊𝑡2 = 2 ∫ 2 𝑊𝑡 𝑑𝑊𝑡 + 𝑡
0
66
𝑡
1
∫ 𝑊𝑡 𝑑𝑊𝑡 = (𝑊𝑡2 − 𝑡)
0 2
4. Quadratic covariation
5. Multiplication theorem
Example 5.1: Let S be the stock price of Microsoft (MSFT) in US dollars. S is given by:
Write the Stochastic Differential Equation (SDE) of the process Y that gives the stock price of
MSFT in EUR.
𝑌𝑡 = 𝑋𝑡 × 𝑆𝑡
𝑑𝑌𝑡 = 𝑎𝑌𝑡 𝑑𝑡 + 𝑏𝑌𝑡 𝑑𝑊𝑡 which can be solved as geometric Brownian Motion
Example 5.2:
67
Let the oil price given by:
Write the SDE of the process Y that gives the discounted value of the oil price.
𝑌𝑡 = 𝛽𝑡 𝑋𝑡
𝑑𝑌𝑡 = 𝑑𝛽𝑡 𝑋𝑡
We have:
𝑑𝛽𝑡
o 𝛽𝑡 = 𝑒 −𝑟𝑡 so = −𝑟𝑒 −𝑟𝑡 = −𝑟𝛽𝑡
𝑑𝑡
o 𝑑〈𝛽, 𝑋〉𝑡 = 0 × 𝜎𝑋𝑡 𝑑𝑡 = 0 because there is no Brownian motion with respect to 𝛽 (it is not
stochastic it is just a function of time).
So
6. Itô Isometry
𝑻 𝟐 𝑻
𝑬 [(∫ 𝑯𝒔 𝒅𝑾𝒔 ) ] = 𝑬 [∫ 𝑯𝒔 𝟐 𝒅𝒔]
𝟎 𝟎
Exam Problem:
Use your stochastic calculus skills to price a chooser option. A chooser option is an option
contract that allows the holder to decide whether it is a call or put prior to the expiration
date. The payoff of a chooser option is the following:
𝑃𝐶𝑡 = max (𝐾 − 𝑋𝑡 , 𝑋𝑡 − 𝐾)
dX 𝑡 = rX 𝑡 dt + σdW𝑡
68
Find the value of the chooser option at time 0. Show the details of your calculations.
Exam problem:
You are providing consultancy to a client about exotic derivatives. The client has expressed
discomfort with the unpredictability of returns associated with European call options and
would prefer a predetermined payout if their prediction were correct.
In response, you propose a cash-or- nothing binary call option, which offers the buyer a
predetermined payout if the stock price exceeds the strike price at the end of the contract.
Let K be the strike price and L the amount will be paid by the binary option. In other words, if
the stock price exceeds K at maturity, the payoff of the call is L.
Assuming the stock price follows the following Stock Differential Equation (SDE)
v. Solve the SDE above and find the distribution of the stochastic process of 𝑋𝑇
vi. Write the cash-or-nothing European binary call option payoff equation.
vii. Find the value of the European binary call option at time 0 that is maturity at time T
with a strike k and binary cash L. Show the details of your calculations.
viii. Use the payoff table to find the put call parity in the case of cash-or- nothing options.
Draw the graph of both payoffs (call and put).
ix. Use the put call parity to find the value of cash-or-nothing binary put option at time 0.
69
The Spell book summarizes Processes
Takeaway message
[…] As he opened the spell book it said loud and clearly: "Investire, you've embarked on a busy
and adventurous journey. Remember this: whether it's the twist in the next chapter of the book,
the ripples on the surface of the lake, or the dancers gracefully moving in the Valse, you've been
equipped with various tools to foresee the future value of your books. The next book you read
will help you navigate the uncertain terrain of randomness. Don't confine yourself to applying
knowledge only to its source; don't limit Brownian motion to ripples or martingales solely to the
game. Think beyond boundaries, and remember, you possess tools, not rules. Your creativity
knows no bounds; these are instruments, not constraints. Before you close me, share some of
the books in your library with the guests.” Investire said smiling “I didn’t know that my spell
book will admit that sharing is caring!”; the book replied “It's not just sharing; lending reveals
the true worth of people. It shows you whose friendship is reliable and whose is not. Also even
lending can be monetized and risky".
70
VI. Credit Risk Modeling
Credit risk modeling stands as a pivotal aspect of modern financial analysis, offering tools to
assess the likelihood of a borrower defaulting on a debt obligation. It encompasses a range of
methodologies, with structural models and reduced form models being two principal
approaches.
Structural models, rooted in the principles of corporate finance and options pricing theory,
approach credit risk by analyzing a company's capital structure. They posit that default occurs
when a firm's liabilities exceed its assets. These models view a company's equity as a call option
on its assets, thereby integrating the volatility of the assets and the level of debt into the
assessment. This approach allows for a dynamic evaluation of default risk, considering both
current financial states and potential future scenarios. The Merton model is a classic example
of this approach, offering insights into how market value of equity and debt levels interplay in
determining credit risk.
Reduced form models, on the other hand, take an empirical approach. Rather than focusing on
the balance sheet dynamics, these models assess default risk based on observable market data
and historical default rates. They treat default as a random process, often independent of the
firm's economic fundamentals, and focus on modeling the intensity of default. This method
allows for the incorporation of various market-driven factors and credit spreads, thus providing
a different perspective on credit risk.
Both structural and reduced form models offer valuable insights and are used extensively in
financial institutions for risk assessment, portfolio management, pricing of credit-sensitive
instruments, and for regulatory compliance purposes. Their integration offers a comprehensive
understanding of credit risk, addressing different aspects and scenarios of default risk in the
complex financial landscape.
While structured credit models are essentially used for trend predictions and forecasting,
reduced form models are more used in calibration and asset pricing.
1. Structural models
Structural credit models in finance represent a crucial component in understanding credit risk.
These models are built on the foundation of analyzing the financial structure and health of a
company to assess its creditworthiness. At the heart of structural credit models lies the concept
that a firm's likelihood of default is intrinsically linked to its assets' value compared to its
liabilities. When a company's liabilities surpass its assets, the risk of default becomes
significantly higher.
These models draw heavily from the principles of corporate finance and option pricing theory,
viewing a company's equity as a call option on its assets. This perspective allows for a more
nuanced assessment of default risk, factoring in the volatility of the company's assets and the
level of its debt obligations. By incorporating these elements, structural credit models provide
a dynamic framework for analyzing the default risk, considering both the firm's current financial
state and potential future scenarios.
71
In practice, these models are instrumental for investors, risk managers, and financial analysts.
They offer vital insights into the health of various debt instruments, guide investment decisions,
shape risk management strategies, and support regulatory compliance. As financial markets
evolve, the importance and complexity of structural credit models continue to grow, making
them an essential tool in the arsenal of modern finance professionals.
a. Merton (1974)
The Merton model, introduced in 1974 by economist Robert C. Merton, is a seminal framework
in the field of structured credit models. This pioneering approach revolutionized the
understanding of credit risk by applying concepts from option pricing theory to corporate debt
analysis. At its core, the Merton model posits that a company's equity can be treated as a call
option on its assets, with the strike price equivalent to the debt's face value that must be repaid
at maturity.
In the Merton model, default risk is linked to the financial health of a company. It occurs when
the value of a firm's assets falls below the repayment threshold of its liabilities at the time of
debt maturity. This approach incorporates the volatility of the company's assets and the level
of its debt, providing a dynamic method to assess the probability of default. The model's
strength lies in its ability to translate market information, such as stock prices and their
volatility, into an estimate of credit risk.
As a pioneering structural model, the Merton model has had a profound impact on both
theoretical and practical aspects of finance. It laid the groundwork for the development of
more sophisticated credit risk models and remains a cornerstone in the analysis of corporate
default risk. Its principles are extensively used by financial institutions, investors, and analysts
for risk assessment, pricing of credit-sensitive securities, and for strategic corporate finance
decisions.
Let:
𝑩: bond price
𝑉: a firm’s value
𝑫: a firm’s debt
𝑉−𝐷 𝑖𝑓 𝑉 > 𝐷
𝑆={ |
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝐷 𝑖𝑓 𝑉 > 𝐷
𝐵={ |
𝑉 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝑆𝑡 = 𝑚𝑎𝑥(𝑉𝑡 − 𝐷, 0)
𝐵𝑡 = 𝑉𝑡 − 𝑚𝑎𝑥(𝑉𝑡 − 𝐷, 0) = 𝐷 − 𝑚𝑎𝑥(𝐷 − 𝑉𝑡 , 0)
72
Let’s Assume 𝑉 = {𝑉𝑡 ∶ 𝑡 ∈ T} the stochastic process that defines the value of the firm and
defined on the filtered space (Ω , F , 𝔽) where 𝔽 = {Ft ∶ 𝑡 ∈ 𝑇} the information coming from
the public market. We assume that 𝑉 follows the stochastic differential equation:
1
𝑉𝑡 = 𝑉0 exp (( 𝜇 − 𝜎 2 )𝑡 + 𝜎𝑊𝑡 )
2
Default Probability:
1
𝐷𝑃 = 𝑃𝑡 (𝑉𝑇 < 𝐷) = 𝑃𝑡 (𝑉0 exp (( 𝜇 − 𝜎 2 )(𝑇 − 𝑡) + 𝜎(𝑊𝑇 − 𝑊𝑡 ) < 𝐷)
2
Let 𝑡 = 0
1
𝐷𝑃 = 𝑃0 (𝑉0 exp (( 𝜇 − 𝜎 2 )𝑇 + 𝜎𝑊𝑇 < 𝐷)
2
1
ln(𝐷/𝑉0 )−(𝜇− 𝜎 2 )𝑇 𝑊𝑇
2
𝐷𝑃 = 𝑃0 (𝑊𝑇 < ) we know that 𝑊𝑇 ~𝑁(0, 𝑇) 𝑠𝑜 ~𝑁(0,1)
𝜎 √𝑇
1
ln(𝐷/𝑉0 ) − (𝜇 − 2 𝜎 2 ) 𝑇
let α =
𝜎√𝑇
𝐷𝑃 = 𝑃0 (𝑍 < α) = Φ(α)
In contrast to the Merton model, where default can only occur at debt maturity, the Black and
Cox model allows for the possibility of default occurring at any time prior to maturity if the
value of the firm's assets falls below a certain threshold. This threshold is typically set at a level
where the firm's assets are just sufficient to cover the promised debt payments, taking into
account both interest and principal. This approach introduces a more dynamic and realistic
view of default, acknowledging that firms may choose to default strategically when it's
financially beneficial or unavoidable, rather than solely due to an inability to pay at maturity.
The Black and Cox model extends the application of option pricing theory to corporate debt,
considering both the timing and probability of default. This model has been influential in
shaping the understanding of credit risk, especially in high-yield debt markets. It provides a
more nuanced framework for evaluating the risk and pricing of corporate bonds, loans, and
other credit instruments. Its influence is seen in both academic research and practical
applications, particularly in the realm of risk management and structured finance.
73
Let’s Assume 𝑉 = {𝑉𝑡 ∶ 𝑡 ∈ T} the stochastic process that defines the value of the firm and
defined on the filtered space (Ω , F , 𝔽) where 𝔽 = {Ft ∶ 𝑡 ∈ 𝑇} the information coming from
the public market. We assume that 𝑉 follows the stochastic differential equation:
Default Probability:
Reduced form models represent a fundamental approach in the realm of credit risk modeling,
contrasting with the balance-sheet-oriented structural models. These models, emerging in the
late 20th century, offer a distinct perspective by focusing on the empirical aspects of default
risk, rather than deriving risk from a firm's financial structure.
Central to reduced form models is the treatment of default as an exogenously driven, random
process, rather than as a deterministic outcome based on a company's asset and liability
structure. This approach considers default to be an unexpected event, influenced by a variety
of market factors and economic conditions, rather than solely by the firm's financial health. As
such, reduced form models incorporate a wide array of market-driven data, including credit
spreads, interest rates, and macroeconomic indicators, to assess the likelihood of default.
One of the key strengths of reduced form models is their flexibility and adaptability in capturing
the complexities and nuances of real-world credit markets. These models are particularly adept
at modeling the default risk of instruments where detailed balance sheet information is not
readily available or where market sentiment and external factors play a significant role.
In practice, reduced form models are extensively used in the pricing and risk assessment of
fixed-income securities, credit derivatives, and other credit-sensitive financial instruments.
Their empirical nature allows for the calibration of models to current market conditions,
making them invaluable tools for financial analysts, portfolio managers, and risk management
professionals in navigating the ever-evolving landscape of credit risk.
a. Poisson
𝑁 ~ 𝑃(𝜆) is a random variable said to have a Poisson distribution, with parameter 𝜆 > 0 , if it
has a probability mass function given by:
𝑒 −𝜆 𝜆𝑛
𝑃(𝑁 = 𝑛) =
𝑛!
𝑆𝑃 = 𝑃(𝑁 = 0) = 𝑒 −𝜆
Default Probability:
𝐷𝑃 = 1 − 𝑆𝑃 = 1 − 𝑒 −𝜆
𝑒 −𝜆𝑡 𝜆𝑡 𝑛
𝑃(𝑁 = 𝑛) =
𝑛!
𝑆𝑃 = 𝑃(𝑁 = 0) = 𝑒 −𝜆𝑡
Default Probability:
𝐷𝑃 = 1 − 𝑆𝑃 = 1 − 𝑒 −𝜆𝑡
𝐵(0, 𝑇) = 𝑁𝑒 −𝑟𝑇
𝑖𝑓 𝑛𝑜 𝑑𝑒𝑓𝑎𝑢𝑙𝑡
𝐵̃(0, 𝑇) = {𝐵(0, 𝑇) |
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Example 1:
Let 𝜆𝑠 = 𝑠
𝑇 𝑇
∫ 𝜆𝑠 𝑑𝑠 = ∫ 𝑠 𝑑𝑠 = 1⁄2 𝑡 2
0 0
Example 2:
Let:
Find 𝜆 𝑇
𝑇 𝑇
∫0 𝑑(𝑒 𝜅𝑡 𝜆𝑡 ) = ∫0 𝑒 𝜅𝑡 (𝜅𝜆̅ 𝑑𝑡)
75
𝑒 𝜅𝑡 𝜆 𝑇 − 𝜆0 = [𝜆̅ 𝑒 𝜅𝑡 ]𝑇0
𝑒 𝜅𝑡 𝜆 𝑇 − 𝜆0 = 𝜆̅ 𝑒 𝜅𝑇 − 𝜆̅
𝜆 𝑇 = (𝜆0 − 𝜆̅ )𝑒 −𝜅𝑇 + 𝜆̅
c. 𝝀 is stochastic
N is a counting process that is doubly stochastic (Cox process).
Example:
Vasicek:
Python Time !
76
import numpy as np
from scipy.stats import norm
return option_price
(call_price, put_price)
77
VII. Interest rate Modeling
Interest rate modeling is a critical aspect of financial mathematics, playing a vital role in the
pricing and risk management of fixed-income securities, derivatives, and various other financial
instruments. At its core, interest rate modeling involves developing mathematical frameworks
to understand, predict, and simulate the movements of interest rates over time. These models
are essential for accurately valuing financial products, managing interest rate risk, and
formulating effective investment strategies.
The complexity of interest rate modeling arises from the dynamic nature of interest rates,
which are influenced by a multitude of economic factors, including monetary policy, inflation
expectations, and market sentiment. Models must capture not only the current level of rates
but also their volatility and the structure of rate changes across different maturities, known as
the term structure of interest rates.
Historically, several foundational models have been developed, each with its own approach to
addressing these complexities. These include the Vasicek model, the Cox-Ingersoll-Ross (CIR)
model, and the Heath-Jarrow-Morton (HJM) framework, among others. Each model offers
unique insights and tools for dissecting the behavior of interest rates, catering to different
aspects of financial markets and instruments.
Interest rate models are indispensable in the modern financial landscape. They are employed
by banks, investment firms, and insurance companies for tasks such as pricing bonds and
interest rate derivatives, managing asset and liability portfolios, and assessing the overall
interest rate exposure of financial institutions. As financial markets evolve and interest rate
environments change, the development and refinement of these models continue to be a
significant area of research and innovation in financial engineering and risk management.
Short rate models hold a prominent position in the field of financial mathematics, specifically
in the realm of interest rate modeling. These models focus on the dynamic behavior of the
short-term interest rate, a key financial variable that influences a wide array of economic
activities and financial instruments. The 'short rate' refers to the instantaneous interest rate at
which financial institutions can borrow or lend funds for a very short duration, typically
overnight. Understanding and modeling this rate is crucial for valuing various financial
products, particularly those in the fixed-income and derivatives markets.
Short rate models aim to describe the future evolution of interest rates using stochastic
processes, which capture the random nature of interest rate movements. These models are
characterized by their simplicity and tractability, making them a popular choice for pricing
interest rate derivatives, such as bond options, interest rate swaps, and caps and floors.
Key models in this category include the Vasicek model, the Cox-Ingersoll-Ross (CIR) model, and
the Hull-White model, each differing in how they capture the volatility and mean-reversion
78
characteristics of interest rates. The Vasicek model, for example, is known for its mean-
reverting feature, where interest rates tend to move towards a long-term average over time.
The CIR model extends this by incorporating a volatility component that varies with the level
of the short rate, while the Hull-White model offers further flexibility in fitting the current term
structure of interest rates.
Short rate models are essential tools in the arsenal of financial analysts and risk managers. They
provide a framework for assessing the impact of interest rate changes on portfolios, pricing
complex financial instruments, and managing interest rate risk in an uncertain and ever-
evolving financial landscape.
Vasicek
The Vasicek model, introduced in 1977 by economist Oldrich Vasicek, is a pioneering short rate
model in the field of financial mathematics and interest rate modeling. It represents a
foundational approach to modeling the dynamics of interest rates, particularly focusing on the
short-term interest rate, which is a crucial component in the valuation of fixed-income
securities and interest rate derivatives.
At its core, the Vasicek model is characterized by its simplicity and elegance. It describes the
evolution of interest rates using a stochastic process known as mean reversion. This concept
suggests that interest rates tend to revert towards a long-term average level over time, a
behavior observed in many financial markets. The model is mathematically expressed through
a mean-reverting Ornstein-Uhlenbeck process, which combines elements of randomness with
a tendency to move towards an equilibrium level.
One of the key features of the Vasicek model is its ability to capture the risk structure of interest
rates and predict future movements based on current levels. It incorporates parameters that
represent the long-term mean interest rate, the speed of mean reversion, and the volatility of
interest rate movements. These parameters can be calibrated to fit market data, making the
model adaptable to different market conditions.
Despite its relative simplicity, the Vasicek model has had a profound impact on the field of
finance. It provides a framework for pricing various interest rate-sensitive financial
instruments, including bonds, caps, floors, and swaptions. Its influence extends beyond
theoretical finance, as it is widely used by banks, investment firms, and risk managers for
practical applications such as risk assessment, portfolio optimization, and strategic financial
planning. Over time, while more complex models have been developed, the Vasicek model
remains a cornerstone in the study and application of interest rate modeling.
i. 𝑟𝑡 :
𝑒 𝜅𝑡 (𝑑𝑟𝑡 + 𝜅𝑟𝑡 𝑑𝑡) = 𝑒 𝜅𝑡 (𝜅𝜃𝑑𝑡 + 𝜎𝑑𝑊𝑡 )
79
𝑇 𝑇
∫ 𝑑(𝑒 𝑟𝑡 ) = ∫ 𝑒 𝜅𝑡 (𝜅𝜃𝑑𝑡 + 𝜎𝑑𝑊𝑡 )
𝜅𝑡
0 0
𝑇
𝑒 −𝜅𝑡 (𝑒 𝜅𝑡 𝑟𝑡 − 𝑟0 ) = 𝑒 −𝜅𝑡 (𝜃𝑒 𝜅𝑡 − 𝜃 + ∫ 𝑒 𝜅𝑡 𝜎𝑑𝑊𝑡 )
0
𝑇
𝑟𝑡 = (𝑟0 − 𝜃)𝑒 −𝜅𝑡 + 𝜃 + ∫ 𝑒 −𝜅(𝑇−𝑡) 𝜎𝑑𝑊𝑡 )
0
ii. 𝐸[𝑟𝑡 ]:
𝑇
𝐸[𝑟𝑡 ] = (𝑟0 − 𝜃)𝑒−𝜅𝑡 + 𝜃 + 𝐸 [∫ 𝑒−𝜅(𝑇−𝑡) 𝜎𝑑𝑊𝑠 )]
⏟0
0
iii. 𝑉[𝑟𝑡 ]:
𝑇
𝑉[𝑟𝑡 ] = ∫ 𝑒−𝜅(𝑇−𝑡) 𝜎𝑑𝑊𝑠 )
0
𝑇 2 𝑇 2
𝑉[𝑟𝑡 ] = 𝐸 [(∫ 𝑒−𝜅(𝑇−𝑡) 𝜎𝑑𝑊 𝑠 )) ] − 𝐸 [∫ 𝑒−𝜅(𝑇−𝑡) 𝜎𝑑𝑊 𝑠 )]
0 ⏟ 0
0
𝑢𝑠𝑖𝑛𝑔 𝐼𝑡ô 𝐼𝑠𝑜𝑚𝑒𝑡𝑟𝑦 :
𝑇
𝑉[𝑟𝑡 ] = 𝐸 [∫ 𝑒−2𝜅(𝑇−𝑡) 𝜎2 𝑑𝑠]
0
𝑇
𝑉[𝑟𝑡 ] = ∫ 𝑒−2𝜅(𝑇−𝑡) 𝜎2 𝑑𝑡
0
𝑇
−2𝜅𝑇
𝑉[𝑟𝑡 ] = 𝜎2 𝑒 ∫ 𝑒2𝜅𝑡 𝑑𝑡
0
−2𝜅𝑇
𝜎2 𝑒
𝑉[𝑟𝑡 ] = [𝑒2𝜅𝑇 − 1]
2𝜅
𝜎2
𝑉[𝑟𝑡 ] = [1 − 𝑒−2𝜅𝑇 ]
2𝜅
80
Takeaway Message from DAPT: Dynamic Asset Pricing Theory is More than a Subject.
If you are breathing and living, you are destined to be dynamic. This dynamism,
coupled with the concept of time, implies uncertainties in life. Understand that every
aspect of your life is influenced by probability and stochastic processes: from having a
friend choosing you a book like Investire, to picking a major like a TBSer, to dancing like
a Party freak, to selecting a life partner like a desperate romantic, everything has an
inherent element of uncertainty within it that is influenced by the rules you've learned
from this book.
sSo, don't view Dynamic Asset Pricing Theory (DAPT) as a subject you will be tested on.
DAPT does teach you how to navigate the uncertainties in your financial journey, that’s
for sure. But most of all it is a mindset.
When it comes to making money, you will be confronted with uncertainty as well, and
you have been given magical and effective tools to minimize this uncertainty as much
as possible, whether you are unsure about interest rates, credit risk, stock
fluctuations…
Minimizing uncertainty and risk is a must and you must do that because we don’t play
with finances and money, you need it for survival and self-actualization and many other
incentives you will choose for yourself. But once you gain the money and survive,
remember to return to your life, take it easy, be comfortable with uncertainty, feel your
way through it, live with it, and remember life’s surprises are inevitable and “the
highest probability amounts not to certainty” and that is alright.
As this course concludes, prepare yourself for challenges that Finance might throw your
way; rest assured, we've prepared you well for this battle. Be adventurous, go make
money, and face life's surprises with an open mind and an open heart. Stay resilient,
stay adaptable, and embrace the unpredictability that makes life exciting.
Yours,
Nour Coussaini
81
References
Aldrich, J., 1997. R. A. Fisher And The Making Of Maximum Likelihood 1912 – 1922. Statistical
Science, 12(3), p. 162]176.
Artus, 1987. Structure Par Terme Des Taux D'interet:Théorie Et Estimation Dans Le cas Français.
s.l.:Cahiers Economiques Et Monétaires, Banque De France, n°27.
Bekdache & Baum, 1994. Comparing Alternative Models of The Term Structure Interest Rates.
Boston College, Issue 271.
Black, F., 1976. The pricing of commodity contracts. Journal of Financial Economics, Volume 3,
pp. 167-179.
Black, F. & Cox, J., 1976. Valuing Corporate Securities : Some Effects of Bond Identure
Provisions. Journal of Finance, 31(2), pp. 351-367.
Black, F., Derman, E. & Toy, W., 1990. A One-Factor Model of Interest Rates and Its Application
to Treasury Bond Options. Financial Analysts Journal, pp. 24-32.
Black, F. & Scholes, M., 1973. The Pricing of Options and Corporate Liabilities. Journal of
Political Economy, 81(3), pp. 637-654.
Bollerslev, T., 1990. Modelling the coherence in short-run nominal exchange rates: a
multivariate generalized arch model. The Review of Economics and Statistics, p. 498–505.
Box, G. & Jenskins, G., 1970. Time Series Analysis : Forecasting and Control. s.l.:Holden-Day.
Brace, A., Gatarek, D. & Musiela, M., 1997. The Market Model of Interest Rate Dynamics..
Mathematical Finance, Volume 7, pp. 127-155.
Christophe Lunven, T. K. D. G. K. A. I., 29 février 2012. Estimation D'une Structure Par Terme
Des Taux D'intérêt Sur Données Françaises, s.l.: Banque De France.
Cox, J., Ingersoll, J. & Ross, S., 1981. A Re-examination of Traditional Hypotheses about the Term
Structure of Interest Rates. s.l.:The Journal of Finance.
Cox, J., Ingersoll, J. & Ross, S., 1985. A Theory of the Term Structure of Interest Rates.
Econometrica, 53(2), pp. 385-408.
Cox, J. J. I. A. S. R., 1981. A Re-examination Of Traditional Hypotheses About The Term Structure
Of Interest Rates. s.l.:The Journal Of Finance.
Culbertson.J.M., 1957. The Term Structure Of Interest Rate. s.l.:The Quarterly Journal Of
Economics (1963) 77 (1): 166-174.
82
Dickey, D. & Fuller, W., 1979. Distribution of the Estimators for Autoregressive Time Series with
a Unit Root. Journal of the American Statistical Association, Issue 74, pp. 427-431.
Engle, R. F., 1982. Autoregressive conditional heteroscedasticity with estimates of the variance
of United Kingdom inflation. Econometrica: Journal of the Econometric Society, p. 987–1007.
Fisher.R, 1922. “On the Mathematical Foundations Of Theoretical Statistics, s.l.: Philosophica
lTransactions Of The Royal Society.
Heath, D., Jarrow, R. & Morton, A., 1992. Bond Pricing and the Term Structure of Interest Rates
: a new Methodology for Contingent Claims Valuation. Volume 60, pp. 77-105.
Herrala, N., 2004. Vasicek Interest Rate : Parameter Estimation,Evolution of the Short-term
Interest Rate, s.l.: Banque Mondiale.
Heston, S., 1993. Closed-Form Solution of Options with Stochastic Volatility, with Application
to Bond and Currency Options. Review of Financial Studies, Volume 6, pp. 327-343.
Hicks, J., 1939. Value and capital: An Inquiry Into Some Fundamental Principles of Economic
Theory. s.l.:Clarendon Press,Oxford.
Hull, J. & White, A., 1987. The Pricing of Options with Stochastic Volatility. Journal of Finance,
42(2), pp. 281-300.
Hull, J. & White, A., 1990. Pricing Interest Rate Derivative Securities. The Review of Financial
Studies, pp. 573-592.
James, J. & Webber, N., 2004. Interest Rate Modelling. s.l.:Financial Engineering.
Keynes, J., 1936. The General Theory of Employment, Interest and Money. Royaume-Uni: Edited
in 1949 by Macmillan, London.
Keynes, J., 1936. The General Theory Of Employment, Interest And Money. Royaume-Uni:
Edited In 1949 By Macmillan, London.
Langetieg.C, 1980. A Multivariate Model Of The Term Structure. The Journal Of Finance,
Volume 35, pp. 71-97.
Langetieg, C., 1980. A Multivariate Model of the Term Structure. The Journal of Finance,
Volume 35, pp. 71-97.
Lutz, F., 1940. The structure of interest rate. s.l.:Quarterly Journal of Economics.
Merton, R., 1974. On the Pricing of Corporate Debt : The Risk Structure of Interest Rates.
Journal of Finance, Issue 29, pp. 449-470.
Miskin, F., 2004. Monnaie, Banque Et Marchés Financiers. 10 ed. s.l.:Person Education France.
83
Modigliani, F., 1966. Innovations in Interest Rate Policy. s.l.:The American Economic Review.
Modigliani, F. A. S., 1966. Innovations In Interest Rate Policy. s.l.:The American Economic
Review.
O'Kane, D., 2008. Modelling Single-Name and Multi-Name Credit Derivatives. s.l.:Wiley & Sons.
Piazzesi, M., 2003. A no-arbitrage vector autoregression of term structure dynamics with
macroeconomic and latent variables. Journal of Monetary Economics, Volume 50, p. 745–787.
Piazzesi, M., 2003. A No-Arbitrage Vector Autoregression Of Term Structure Dynamics With
Macroeconomic And Latent Variables. Journal Of Monetary Economics, Volume 50, p. 745–787.
Priaulet, P., 2003. Modèles De La courbe Des Taux D'intérêt,Cours De l'ENSAE, s.l.: MASE
Université Paris IX Dauphine.
Richard, N., 1978. A Continuous Time Equilibrium Model Of Forward Prices And Futures Prices
In A Multigood Economy. s.l.:Journal Of Financial Economics.
Uctum, G. P. E. R., 2001. Anticipations,Primes De Risque Et Stucture Par Terme Des Taux
D’intérêtt:Une Analyse Des Comprtements D'experts. s.l.:Banque De France.
Vasicek, O., 1977. An Equilibrium Characterization of the Term Structure. Journal of Financial
Economics, Volume 5, p. 177–188.
Veral R.J., E. P., 1999. Analytic And Bootstrap Estimates Of Prediction Errors In Claim Reserving.
Insurance : Mathematics And Economics.
Zekri Mounir, B. S. Y., 2005-2006. Cours Marchés Financiers Et Evaluations Des Actifs;A Theory
Of Term Structure Of Interset Rate. s.l.:Institution Supérieur De Gestion De Tunis.
Zeytum.S, G., 2007. A Comparative Study Of The Vasicek And The CIR Model Of The Short Rate.
Berichte Des Fraunhofer ITWM, Nr. 124, p. 2.
84
Appendix
I. Math Review
Derivatives :
𝑑 𝑥𝑛
• = 𝑛𝑥 𝑛−1 (Power Rule)
𝑑𝑥
𝑑 𝑒𝑥
• = 𝑒𝑥
𝑑𝑥
𝑑 ln (𝑥) 1
• =𝑥
𝑑𝑥
𝑑 sin 𝑥
• = cos 𝑥
𝑑𝑥
𝑑 cos 𝑥
• = − sin 𝑥
𝑑𝑥
𝑑 𝑓 𝑓 ′ .𝑔−𝑓.𝑔′
• =
𝑑𝑥 𝑔 𝑔²
𝑑
• (𝑓. 𝑔) = 𝑓 ′ . 𝑔 + 𝑓. 𝑔′
𝑑𝑥
𝑑
• 𝑓(𝑔(𝑥)) = 𝑓 ′ (𝑔(𝑥)). 𝑔′(𝑥)
𝑑𝑥
Integration:
• ∫ 𝑘 𝑑𝑥 = 𝑘𝑥 + 𝐶 where k is a constant
𝑥 𝑛+1
• ∫ 𝑥 𝑛 𝑑𝑥 = +𝐶 if n ≠ -1
𝑛+1
𝑑𝑢 𝑢𝑛+1
• ∫ 𝑢𝑛 𝑑𝑥 = ∫ 𝑢𝑛 𝑑𝑢 = ∫ +𝐶
𝑑𝑥 𝑛+1
1
• ∫ 𝑥 𝑑𝑥 = ln(𝑥) + 𝐶
𝑑𝑢/𝑑𝑥 1
• ∫ 𝑑𝑥 = ∫ 𝑢 𝑑𝑢 = ln(𝑢) + 𝐶
𝑢
• ∫ 𝑘 𝑓(𝑥) 𝑑𝑥 = 𝑘 ∫ 𝑓(𝑥)𝑑𝑥
• ∫(𝑓(𝑥) ± 𝑔(𝑥)) 𝑑𝑥 = ∫ 𝑓(𝑥) 𝑑𝑥 ± ∫ 𝑔(𝑥)𝑑𝑥
• ∫ 𝑒 𝑥 𝑑𝑥 = 𝑒 𝑥 + 𝐶
Integration by substitution:
85
Probability and Statistics:
• A ⊆ B ⟹ P(A) ≤ P(B).
• P(A ∩ B) ≤ min (P(A) , P(B)).
• P(A ∪ B) ≤ P(A) + P(B).
• P(Ω – A) = 1 − P(A) = P(Ā)
• Law of Total Probability: If 𝐴1 , 𝐴2 , … . , 𝐴𝑘 are a set of disjoint events such that
⋃𝑘𝑖=1 𝐴𝑖 = Ω then ∑𝑘𝑖=1 𝑃(𝐴𝑖 ) = 1
• Chain Rule:
• Let 𝐴1 , 𝐴2 , … . , 𝐴𝑘 be events, 𝑃(𝐴𝑖 ) > 0. Then the chain rule states that:
• 𝑃(𝐴1 ∩ 𝐴2 ∩ 𝐴3 ∩ 𝐴4 ) = 𝑃(𝐴1 ∩ 𝐴2 ∩ 𝐴3 ) 𝑃(𝐴4 | 𝐴1 ∩ 𝐴2 ∩ 𝐴3 )
= 𝑃(𝐴1 ∩ 𝐴2 ) 𝑃(𝐴3 | 𝐴1 ∩ 𝐴2 ) 𝑃(𝐴4 | 𝐴1 ∩ 𝐴2 ∩ 𝐴3 )
= 𝑃(𝐴1 ) 𝑃(𝐴2 |𝐴1 ) 𝑃 𝑃(𝐴3 | 𝐴1 ∩ 𝐴2 ) 𝑃(𝐴4 | 𝐴1 ∩ 𝐴2 ∩ 𝐴3 )
• Independence: Two events are called independent if:
𝑃(𝐴 ∩ 𝐵) = 𝑃(𝐴)𝑃(𝐵) or equivalently,
𝑃(𝐴|𝐵) = 𝑃(𝐴)
𝐹𝑥 (𝑥) = 𝑃(𝑋 ≤ 𝑥)
The most common cumulative distribution functions (CDFs) and their formulas:
𝑥
• Uniform distribution: 𝐹(𝑥) = , where a and b are the minimum and maximum
𝑏−𝑎
values of the distribution.
1 𝑥−𝜇
1
• Normal distribution: 𝐹(𝑥) = √2 𝜋 𝜎 2
𝑒 −2 (𝜎
)²
where μ and σ are the mean and standard
deviation of the distribution.
• Exponential distribution: 𝐹(𝑥) = 1 − 𝑒 −𝜆𝑥 , where λ is the rate parameter of the
distribution.
86
𝜆𝑘 𝑒 −𝜆
• Poisson distribution: 𝐹(𝑥) = k is the number of occurrence and λ is the mean of
𝑘!
the distribution.
Expectation:
Variance:
87
For those who are unfamiliar with Python, here is a 1-hour course:
Introduction to python
Objectives:
I. Introduction to NumPy
What is NumPy?
Example:
import numpy as np
# Creating a 1D array
arr1 = np.array([1, 2, 3, 4, 5])
Basic Operations:
88
● Smaller arrays are automatically broadcasted to match the shape of the larger array.
Example:
# Element-wise operations
result = arr1 + arr2 # [11, 22, 33]
# Broadcasting
scalar = 5
result = arr1 + scalar # [6, 7, 8]
Element-wise Functions:
# Accessing elements
element = matrix[1, 2] # 6
# Slicing
row_slice = matrix[0, :] # [1, 2, 3]
column_slice = matrix[:, 1] # [2, 5, 8]
Further Resources:
89
Many helpful resources are provided on the NumPy website: http://www.numpy.org/
Objectives:
It provides the DataFrame and Series objects to work with structured data efficiently.
● Pandas supports reading various data formats: CSV, Excel, SQL, JSON, etc.
● Use functions like pd.read_csv(), pd.read_excel(), etc.
Inspecting Data:
● Explore the basic structure of data using methods like head(), tail(), info(), describe().
Example:
import pandas as pd
● Use functions like isnull(), notnull(), fillna() to deal with missing values.
● Drop missing values using dropna().
Data Transformation: Apply transformations like renaming columns, changing data
Example:
90
# Handling missing values
data.dropna() # Remove rows with missing values
data.fillna(0) # Fill missing values with zeros
# Data transformation
data.rename(columns={'old_name': 'new_name'}, inplace=True)
data['column'] = data['column'].astype(int)
data.drop_duplicates(inplace=True)
Selecting Columns and Rows: Use indexing and slicing to select specific rows and
columns.
Example:
# Selecting columns
column = data['column_name']
# Sorting data
sorted_data = data.sort_values('column_name')
summary statistics.
Grouping Data: Group data based on one or more columns using groupby().
Example:
# Aggregation
total_amount = data['amounts'].sum()
average_return = data['return'].mean()
# Grouping
91
grouped_data = data.groupby('category')['amount'].sum()
Additional resources:
http://pandas.pydata.org/
92
Data Visualization
Objectives:
● Create line plots, scatter plots, and bar plots using Matplotlib.
● Use plt.plot(), plt.scatter(), plt.bar().
Adding Labels and Titles: Label axes and add a title to the plot using plt.xlabel(),
plt.ylabel(),
and plt.title().
Example:
93
Example:
V. Financial Plots:
Importance of Financial Plots:
● Financial plots play a crucial role in understanding market trends, asset performance,
and investment decisions.
● They visually represent time series data, volatility, and relationships between
financial instruments.
Plotting Time Series Data:
● Use line plots to visualize stock prices, market indices, and other time-dependent
data.
● Highlight trends, patterns, and key events in the financial data.
94
Example:
plt.figure(figsize=(10, 6))
plt.plot(date_column, price_column, label='Stock Price')
plt.xlabel('Date')
plt.ylabel('Price')
plt.title('Stock Price Over Time')
plt.legend()
plt.show()
Candlestick Charts:
Example:
95
● Plotting volatility helps in understanding market risk.
● Moving averages (e.g., 20-day, 50-day) smooth out price data and reveal trends.
Example:
plt.figure(figsize=(10, 6))
# Plotting volatility
plt.plot(date_column, volatility_column, label='Volatility')
# Plotting moving averages
plt.plot(date_column, moving_average_20, label='20-day Moving
Average')
plt.plot(date_column, moving_average_50, label='50-day Moving
Average')
plt.xlabel('Date')
plt.ylabel('Value')
plt.title('Volatility and Moving Averages')
plt.legend()
plt.show()
Additional resources:
96
Financial Time Series
Objectives:
import pandas as pd
import pandas_datareader as pdr
from datetime import datetime
# Define the start and end dates for the data fetch
start_date = datetime(2020, 1, 1)
end_date = datetime(2021, 1, 1)
# Fetch stock data for 'AAPL' (Apple Inc.) from Yahoo Finance
stock_data = pdr.get_data_yahoo('AAPL', start=start_date,
end=end_date)
97
III. Summary Statistics:
Calculating Summary Statistics:
mean_price = stock_data['Close'].mean()
median_price = stock_data['Close'].median()
std_price = stock_data['Close'].std()
Examples:
data.diff().head()
Example:
Output:
98
V. Resampling and Rolling Statistics:
Resampling:
monthly_data = stock_data.resample('M').last()
print(monthly_data.head())
Rolling Statistics: It is a financial tradition to work with rolling statistics, often also
called financial indicators or financial studies. Rolling statistics involve calculating metrics like
the moving average and standard deviation over a rolling window of data points. A rolling
window is like a moving time frame that slides through your data, and at each position, you
calculate the statistic within that window. This is particularly useful for smoothing out noisy
data and identifying trends.
Rolling Statistics
Let's take an example of calculating a rolling 20-day moving average and standard deviation for
a stock's closing prices:
stock_data['Rolling Mean'] =
stock_data['Close'].rolling(window=20).mean()
stock_data['Rolling Std'] =
stock_data['Close'].rolling(window=20).std()
Here, we're calculating the rolling mean and standard deviation using the .rolling() function
with a window size of 20. This means that at each data point, the average and standard
deviation of the previous 20 days will be calculated. You can adjust the window size to suit your
analysis requirements.
Additional resources:
99
Stock Market Analysis with Pandas Python Programming
100
Introduction to R
II. Introduction to R
R is a powerful programming language that is widely used in data analysis and research. It
provides a wide range of statistical and graphical techniques, making it a popular choice for
data scientists and researchers. R is also an open-source language, which means that it is free
to use and can be modified by anyone. Additionally, R has a large and active community of
users who contribute to its development by creating packages and libraries that extend its
functionality. Overall, R is a versatile and powerful tool for data analysis and research.
R comes with a basic Graphical User Interface (GUI), which includes a console and a script
editor. However, many users find the basic GUI to be limited and prefer to use an integrated
development environment (IDE) like RStudio, which provides a more comprehensive and user-
friendly interface for working with R.
The RStudio IDE is split into four panes, and you can customize the content and layout to suit
your preferences.
• The code editor (top left): This is where you can write and edit R code.
• The console (bottom left): This is where you can execute R code and view the results.
• The help pages (top right): This is where you can access documentation and help files for R
functions and packages.
The environment stores the data frame, vectors, list and all the data type.
101
• The graphics viewer (bottom right): This is where you can view plots and other graphical
output
generated by R code.
Files: shows the working directories and the files in the working directories
Packages: you can install from packages, see your packages, see if there is update, and update
your packages.
The panes on the right have additional tabs to choose from.
You write R code in the built-in editor and execute it in the console; the shortcut “send code to
console” keystrokes are CTRL-ENTER or CTRL-R in Windows and on a Mac.
2. Working Directories:
A working directory is a file path on your computer that sets the default location of any files
you read into R or save out of R.
It is the default location where R will look for files you want to load and where it will put any
files you save.
In other words, a working directory is like a little flag somewhere on your computer that is tied
to a specific analysis project. If you ask R to import a dataset from a text file or save a data
frame as a text file, it will assume that the file is inside your working directory. When you open
an RStudio project, it will automatically set your working directory to the appropriate location.
You can check the file path of your working directory by looking at bar at the top of the Console
pane.
You can only have one working directory active at any given time, and the active working
directory is called your current working directory.
102
getwd() is used for finding the current working directory
setwd('/Users/nhy163/Documents/Alex/Teaching/first_project')
3. Packages
To install a package from CRAN you can use the install.packages() function. For example if you
want to install the remotes package enter the following code into the Console window of
RStudio (note: you will need a working internet connection to do this)
The dependencies = TRUE argument ensures that additional packages that are required will
also be installed.
It’s good practice to occasionally update your previously installed packages to get access to
new functionality and bug fixes. To update CRAN packages you can use the update.packages()
function (you will need a working internet connection for this)
update.packages(ask = FALSE)
The ask = FALSE argument avoids having to confirm every package download which can be a
pain if you have many packages installed.
Another method
RStudio provides a package installer to manage the downloads and installations of contributed
packages. You’ll find the package manager in the Packages tab on your chosen utility pane.
103
It lists only those packages that you currently have installed, along with their version numbers,
and you can use the checkboxes next to each package name to load it (instead of using library
at the R console prompt).
Below, I’ve just selected the box for the car package, which automatically executes the relevant
call to library in the console.
The figure also shows the Install and Update buttons for packages. To install a package, click
the Install button and enter the package you want in the field. RStudio will give you options as
you type, as shown for the ks package on the left of Figure B-7. Ensure “Install dependencies”
is checked in order to automatically install any additionally required packages.
To update packages, click the Update button to bring up the dialog box on the right of Figure
B-7; here you can choose to update either individual packages or all of them by clicking the
Select All button.
We can import data from various sources such as CSV files, Excel files, databases, or directly
from the web using packages such as quantmod.
The quantmod package is a popular package used for importing financial data into R. We can
use the read.csv() function to import data from CSV files, and the readxl package to import
data from Excel files.
104
read.csv() is a built-in function that help to import CSV file
To import data from a local file into R using the read.csv() function, you can follow these
steps:
1. Check your working directory to ensure that it is set to the location where you want to put
the CSV file.
2. Use the read.csv() function to upload the CSV file. Pass the file path as the first argument to
the function.
3. Set the header parameter to TRUE if your CSV file has a header row. This will treat the first
row as column names.
4. Set the sep parameter to specify the delimiter used in the CSV file. For comma-separated
values, use sep = ",".
5. The data will be imported into R and stored in an object with the name you specified.
6. You can use the object name to view the content of the imported data in the console.
7. Additionally, you can click on the object name in the environment pane of RStudio to open a
new window with the document's content.
getwd()
Data
Example:
105
f. Importing data from the web
Depending on the specific financial data you want to download; you may need to load relevant
packages.
For example, the "quantmod" package, Quantmod stands for quantitative financial modelling
framework provides functions for downloading stock data from multiple sources, including
Yahoo Finance and the Federal Reserve Economic Data (FRED)
install.packages("quantmod")
library(quantmod)
The head() function displays the first six rows of a data frame by default, or a specified number
of rows if you pass an argument to the function n=3.
getSymbols("AAPL")
head(AAPL,n=3)
## AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume
## 2003-01-02 0.5083427 0.5281666 0.5079888 0.5239188 45357200
## 2003-01-03 0.5239188 0.5285210 0.5164849 0.5274589 36863400
## 2003-01-06 0.5320605 0.5444505 0.5267507 0.5274589 97633200
## AAPL.Adjusted
## 2003-01-02 0.919821
## 2003-01-03 0.926036
## 2003-01-06 0.926036
We have open, high, low, close, volume and adjusted closing prices.
High and low are the highest and lowest prices of the trading day.
Open and close are the opening and the closing prices of the trading day.
Adjusted closing price is the closing price that adjusts for event after market closes such as
stock splits and dividend.
106
If you wish to only import at a certain date e.g.,. 2000-01-01 to 2015-09-25, we can restrict the
set the data to download.
getSymbols("AAPL", from='2000-01-01',to='2015-09-25')
## [1] "AAPL"
getSymbols("AAPL")
## [1] "AAPL"
AAPL <- first(AAPL,'3 years')
head(AAPL)
## AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume
## 2007-01-03 12.32714 12.36857 11.70000 11.97143 309579900
## 2007-01-04 12.00714 12.27857 11.97429 12.23714 211815100
## 2007-01-05 12.25286 12.31428 12.05714 12.15000 208685400
## 2007-01-08 12.28000 12.36143 12.18286 12.21000 199276700
## 2007-01-09 12.35000 13.28286 12.16429 13.22429 837324600
## 2007-01-10 13.53571 13.97143 13.35000 13.85714 738220000
## AAPL.Adjusted
## 2007-01-03 10.41635
## 2007-01-04 10.64755
## 2007-01-05 10.57173
## 2007-01-08 10.62393
## 2007-01-09 11.50647
## 2007-01-10 12.05711
We can also import three stocks at the same time by using a vector.
getSymbols(c("AAPL","GOOG"))
## [1] "AAPL" "GOOG"
Besides prices, very often we are interested in the trading volume. Moreover, we would like to
find volume over time: weekly, monthly, quarterly and yearly. We can use apply and sum to
calculate the rolling sum of volume to each distinct period.
WeekVoYa<- apply.weekly(Vo(AAPL),sum)
# sum from Monday to Friday
MonthVoYa <- apply.monthly(Vo(AAPL),sum)
# sum to month
QuarterVoYa <- apply.quarterly(Vo(AAPL),sum)
# sum to quarter
YearVoYa <- apply.yearly(Vo(AAPL),sum)
# sum to year
In some case, we are interested in average than the sum. Then we can use apply and mean.
Below we calculate the weekly average volume of AAPL.
WeekAveVoClYa<- apply.weekly(Vo(AAPL),mean)
5. Manipulating Data
A vector is a basic data structure that contains elements of the same data type.
107
There are six types of atomic vectors in R: logical, integer, double, complex, character, and raw.
A vector can be created using the c() function, which combines elements of the same data type
into a vector.
The array() function takes vectors as input and uses the values in the dim parameter to create
an array. An array can store only one data type.
We can use the + operator to perform element-wise operations and broadcasting on vectors in
R.
The matrix() function is used to create matrices in R. We can use indexing and slicing to access
elements and subsets of the matrix.
The apply() function in R is used to apply a function to margins of an array or matrix. It returns
a vector, array, or list of values obtained by applying a function to margins of an array or
matrix.It is primarily used to avoid explicit uses of loop constructs.
Example:
One dimension array is created by passing a vector of values to the array() function.
Two dimension array is created by passing a vector of values and specifying the dimensions
using the dim parameter.
To add two vectors element-wise or to add a scalar value to a vector we can use the +
operator
# Creating vectors
arr1 <- c(1, 2, 3)
arr2 <- c(10, 20, 30)
# Element-wise operations
result <- arr1 + arr2 # [11, 22, 33]
# Broadcasting
scalar <- 5
result <- arr1 + scalar # [6, 7, 8]
# Creating a matrix
matrix <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), nrow = 3, ncol = 3)
# Accessing elements
element <- matrix[2, 3] # 8
# Slicing
108
row_slice <- matrix[1, ] # [1, 4, 7]
column_slice <- matrix[, 2] # [4, 5, 6]
We pass the matrix as the first argument, the margin as the second argument (1 for rows and
2 for columns), and the function to apply as the third argument
The apply() function can be used with functions like sum(), mean(), min(), max(), sd(), var() …
It is an essential step in the data analysis process, as it helps to identify any issues or anomalies
in the data that may affect the analysis results.
Some common functions used for inspecting data in R include head(), tail(), str(), summary(),
and View(). The head() and tail() functions display the first or last few rows of the data,
respectively.
The str() function displays the structure of the data, including the data type of each variable.
The summary() function provides summary statistics of the data, such as mean, median, and
quartiles. The View() function opens an interactive data viewer that allows us to explore the
data in a spreadsheet-like interface.
109
Other packages such as dplyr, ggplot2, and tidyr can also be used for data manipulation and
visualization. By inspecting the data, we can identify any issues or anomalies in the data and
take appropriate actions to clean and preprocess the data before performing analysis.
6. Visualizing data
data(airquality)
a. Bar plot
There are two types of bar plots- horizontal and vertical which represent data points as
horizontal or vertical bars of certain lengths proportional to the value of the data item.
They are generally used for continuous and categorical variable plotting.
By setting the horiz parameter to true and false, we can get horizontal and vertical bar plots
respectively.
110
b. Histogram
A histogram is like a bar chart as it uses bars of varying height to represent data distribution.
However, in a histogram values are grouped into consecutive intervals called bins.
In a Histogram, continuous values are grouped and displayed in these bins whose size can be
varied.
xlab ="Temperature(Fahrenheit)",
freq = TRUE)
c. Box Plot
The statistical summary of the given data is presented graphically using a boxplot. A boxplot
depicts information like the minimum and maximum data point, the median value, first and
third quartile, and interquartile range.
111
boxplot(airquality$Wind, main = "Average wind speed
\ at La Guardia Airport",
xlab = "Miles per hour", ylab = "Wind",
col = "orange", border = "brown",
horizontal = TRUE, notch = TRUE)
d. Scatter Plot
A scatter plot is composed of many points on a Cartesian plane. Each point denotes the value
taken by two parameters and helps us easily identify the relationship between them.
plot(airquality$Ozone, airquality$Month,
main ="Scatterplot Example",
xlab ="Ozone Concentration in parts per billion",
ylab =" Month of observation ", pch = 19)
112