This slide set is a work in progress and is embedded in my Principles of Finance course, which is also a work in progress, that I teach to computer scientists and engineers
http://financefortechies.weebly.com/
2. Learning
Objec-ves
¨ Models
¤ A
mathema-cal
or
physical
representa-on
of
a
hypothesis,
theory,
or
law
¤ Simplifica-on
of
reality
for
decision
making
and
design
¨ Models
for
dynamical
systems
n Determinis-c,
Stochas(c,
Complex
¨ Security
price
and
return
rate
models
¨ Review
of
probability
and
sta-s-cs
2
3. A
Financial
Game
¨ Would
you
play
a
financial
game
with
¤ a
90%
probability
of
gaining
$200
and
¤ a
10%
probability
of
losing
$100
?
¨ Alterna-vely,
would
you
take
$20
with
certainty
?
¨ In
probability
and
sta(s(cs,
you
studied
decision
making
with
uncertainty
¤ But
it
was
actually
decision
making
with
risk
!
¤ Expected
value:
$200
·∙
.90
-‐
$100
·∙
.1
=
$170
¤ What
does
that
calcula-on
really
mean?
Is
it
ra-onal
to
play
this
financial
game?
¤ I
would
guess
that
most
of
you
would
take
the
$20
,
why
?
3
4. Ques-ons
¨ Your
common
sense
likely
tells
you
that
too
much
uncertainty
and
risk
remain
in
the
game
¤ How
many
-mes
can
I
play
the
game?
¤ What’s
the
dura-on
of
the
game?
¤ Are
there
any
other
alterna-ve
games?
¤ Any
opportunity
cost
?
¤ How
much
money
do
I
have?
¤ Is
there
any
risk
of
not
geng
paid?
¤ Does
‘probability’
(expected
value)
even
apply
to
a
single
game?
¤ Other
?
¨ Actually
there’s
a
difference
between
risk
and
uncertainty,
but
we’ll
explore
that
in
a
later
chapter
4
5. Review
Of
Probability
¨ Random
Variable
¤ Can
take
on
different
values
unlike
determinis(c
variables
¤ Values
come
from
experiments,
measurements,
random
processes
n Say
x
is
a
random
variable
with
a
-me
sequence
of
values
xi
produced
by
a
random
process,
X
¤ Random
does
not
necessarily
mean
that
there
is
no
underlying
structure
n The
structure
is
defined
by
a
probability
distribu-on
characterized
by
parameters
and
sta(s(cs
5
Random
process
X
Random
variable
x
Random
sequence
xi
6. Review
Of
Probability
¨ Expected
Value
¤ The
expected
value
of
a
random
variable,
x,
is
the
weighted
value
of
m
possible
values
or
outcomes
¤ Example
¤ This
calculate
implies
that
each
outcome,
xi,
is
independent
of
the
other
m-‐1
outcomes
n Thus
no
condi-onal
dependencies
between
the
m
outcomes
n How
do
we
determine
Pr[xi]
?
6
[ ] [ ] i
m
1i
i xxPrxE ⋅= ∑=
[ ] [ ] 170$100$1.200$90.xxPrxE i
2
1i
i =⋅−⋅=⋅= ∑=
8. Review
Of
Probability
¨ Law
of
Large
Numbers
(LLN)
¤ If
x
is
an
independent
and
iden-cally
distributed
random
variable
(IID),
the
sum
sn/n
converges
to
the
expected
value
of
x,
A,
as
n
approaches
infinity
¨ Variance:
Average
squared
error
from
the
mean
¨ Standard
Devia-on
8
x
n
1
n
s
x...xxxs
n
1i
i
n
n21
n
1i
in
∑
∑
=
=
⋅=
+++=≡
[ ] [ ] [ ]( ) 222
BxExExVar ≡−=
[ ] AnsE
A
n
s
E
n
As
n
n
⋅→
→⎥⎦
⎤
⎢⎣
⎡
∞→
[ ] [ ] BxVarxSD ≡=
9. Review
Of
Probability
¨ Independent
random
variables:
No
condi-onal
dependence
¨ If
y
is
a
lagged
sequence
of
x,
then
¨ Linear
(Pearson)
correla-on,
ρ,
is
a
measure
of
linear
dependence
and
is
commonly
used
for
ellip(cally
distributed
random
variables,
x
and
y
¨ Ellip-cally
distributed
random
variables
include
Gaussian,
t-‐distribu-on,
Cauchy,
Laplace,
Logis-cs,
etc.
¨ Otherwise
non-‐correla-on
does
not
imply
independence
¨ Checks
for
independence
of
an
ellip-c
random
variable
x
start
with
checking
auto-‐correla-on
of
x,
and
its
square,
x2,
or
its
de-‐trended
square
(x-‐E(x))2
9
]Pr[x]x,...,x,x|Pr[x i02i-‐1i-‐i =
[ ] [ ]( ) [ ]( )[ ]
yx DSDS
yEyxExE
yx,ρ
⋅
−⋅−
=
Pr[x]y]|Pr[x =
10. Game
Model
¨ Let’s
develop
a
‘stochas-c
model’
for
the
financial
game
¨ Say
that
your
wealth
at
-me
i
or
ti
is
Si
¤ Integer
periods,
i,
and
discrete
-me,
ti
¨ You
play
the
game
between
-me
i-‐1
and
-me
i
over
-me
Δt
=
ti
–
ti-‐1
¨ Your
gain
or
loss
(return
or
change
in
wealth)
is
ΔSi
for
that
ith
game
¨ Your
ini-al
wealth
is
S0
at
-me
i
=
0
or
t0=0.0
¨ The
implica-on
is
that
the
original
game
is
played
only
once
10
ΔS
SS i1i-‐i +=
101 S
SS Δ+=
i-‐1
ti-‐1
Si-‐1
ΔSi
i
ti
Si
11. Game
Model
¨ You
can
also
compute
the
variance,
Var,
and
standard
devia-on,
SD,
of
the
game
11
[ ] [ ] [ ]( )
[ ] $908,100
ΔSSD
$
8,10028,900-‐
1,00036,000
$1700.10$100)(0.90$200
ΔSEΔSEΔSVar
2
222
22
==
=+=
−⋅−+⋅=
−=
-‐100
200
Outcome
Frequency
12. Game
Model
¨ Now
say
that
you
could
play
the
financial
game
a
number
of
-mes,
n
¨ In
each
game
the
probabili-es
and
payoffs
for
the
game
remain
the
same,
thus
the
wealth
increments,
ΔSi,
are
independent
and
iden(cally
distributed
(IID)
¨ The
variance
is
also
finite,
its
8,100
$2,
thus
ΔS
is
IID/FV
¨ One
of
the
most
important
sta-s-cal
principles
is
that
sums
of
IID/
FV
random
variables,
e.g.,
ΔS
approach
normal
distribu-on
as
n
becomes
large
(Central
Limit
Theorem)
12
∑=
+=+=
+++=
n
1i
i00n
n210n
ΔSSΔS
SS
ΔS...ΔSΔSSS
[ ]
[ ]
[ ]
[ ]
[ ] BnΔSDS
BnΔSVar
AnΔSE
Bn
,AnNΔS
BA,N
n
ΔS
n
ΔSSS
ΔS...ΔSΔSSS
2
2
2
0n
n210n
⋅→
⋅→
⋅→
⋅⋅→
→∞→
+=
+++=
13. Central
Limit
Theorem
13
0
200
400
600
800
1000
1200
1400
$13,000 $14,000 $15,000 $16,000 $17,000 $18,000 $19,000 $20,000
Frequency
Gain
Per
100
Game
Sequence
I
wrote
a
VB
program
that
ran
a
100
game
sequence
10,000
-mes.
I
computed
the
average
gain
per
game
sequence
and
ploled
a
histogram
of
the
sums.
The
observed
mean
sum
was
$17,002.
This
is
a
simula(on.
Would
you
play
the
game
a
100
-mes?
Would
you
play
it
one
-me?
14. Central
Limit
Theorem
14
0
200
400
600
800
1000
1200
1400
$130 $135 $140 $145 $150 $155 $160 $165 $170 $175 $180 $185 $190 $195 $200
Frequency
Average
Gain
Per
Game
I
modified
the
program
to
compute
the
average
gain
per
game
in
each
of
10,000
sequences
and
ploled
a
histogram
of
these
average
gains.
The
observed
mean
gain
was
$170.02.
15. Another
Game:
Coin
Flipping
¨ Now
lets
play
another
financial
game
:
coin
flipping.
¨ Say
you
gain
$10
on
heads
and
pay
$10
on
tails.
Is
each
flip
an
independent
event?
With
the
same
probabili-es?
And
has
finite
variance?
Yes,
its
IID/FV
¨ Coin
flipping
is
a
‘fair
game’
since
the
expected
return
for
each
player
(counter
party)
is
zero
–
neither
player
has
an
expected
advantage
¤ Coin
flipping
is
characterized
as
a
binomial
model
15
[ ] ( ) [ ] [ ] [ ]( )
[ ] ( ) [ ] $10$
100ΔSSD
100$.5$10.5$10ΔSE
$
100ΔSEΔSEΔSVar
$0.5$10.5$10ΔSE
22222
222
===⋅−+⋅=
=−==⋅−+⋅=
17. Another
Game:
Die
Rolling
¨ Using
a
single
die,
if
you
roll
a
6
then
you
receive
$110,
while
any
other
outcome
results
in
you
paying
$10
17
[ ] ( )
[ ] ( )
[ ] [ ] [ ]( )
[ ] $44.72$
2,000ΔSD
$
000,2100100,2ΔSEΔSEΔSar
$
100,2110$
6
1
$10-‐
6
5
ΔSE
10$110$
6
1
$10-‐
6
5
ΔSE
2
222
2222
==
=−=−=
=⋅+⋅=
=⋅+⋅=
S
V
18. 0
200
400
600
800
1000
1200
-‐$400 $0 $400 $800 $1,200 $1,600 $2,000 $2,400 $2,800
Frequency
Gain
Per
100
Roll
Sequence
Another
Game:
Die
Rolling
18
I
modified
the
program
and
ran
the
100
die
rolling
game
sequence
10,000
-mes.
I
computed
the
sums
for
the
100
rolls.
The
mean
was
$999.
19. ‘Rate
Game’
¨ Now
let’s
consider
a
game
defined
by
rates
of
gain
or
loss
(rates
of
return)
¤ 45%
chance
of
losing
1%
¤ 55%
chance
of
gaining
1.25%
¨ The
Central
Limit
Theorem
also
addresses
products
of
IID
/
FV
random
variables.
For
large
n,
the
future
value
factor,
fn,
approaches
a
log-‐normal
distribu-on
¨ If
f
is
lognormal,
what
does
that
imply
about
the
probability
distribu-on
of
r?
¤ Nothing
other
than
its
IID/FV
19
S
S
r1
S
SS
r
)r(1SS
1i-‐
i
i
1i-‐
1i-‐i
i
i1i-‐i
=+
−
=
+⋅=
( )...rrr...rrrrrr...rrr1S
)r(1....)r(1)r(1
S
)r(1f
fS)r(1S
S
3213231213210
n210
n
1i
inn0
n
1i
i0n
+⋅⋅++⋅+⋅+⋅+++++⋅=
+⋅⋅+⋅+⋅=
+=⋅=+⋅= ∏∏ ==
20. ‘Rate
Game’
¨ We
can
compute
the
mean,
a,
and
variance,
d2,
of
r
¨ We
can
also
compute
the
mean,
mode,
median,
and
variance
of
f
–
but
we
need
to
know
more
about
lognormal
distribu-ons,
so
let’s
delay
for
now
20
( ) rof
variance
ar
n
1
d
rof
value
mean
r
n
1
a
n
1i
2
i
2
n
1i
i
∑
∑
=
=
−⋅≡
⋅≡
NL~
)r(1f
n
1i
in ∏=
+=
21. ‘Rate
Game’:
Log
Normal
Distribu-on
21
I again modified the VB
program for a sequence of 50
rate games. I ran the
sequence 10,000 times. I
computed the accumulated
future value factor for each
sequence and plotted this
histogram. So there are
10,000 observations in the
histogram. The accumulated
mean future value factor for
50 games was 1.126.
22. Another
‘Rate
Game’
¨ Now
lets
play
the
same
rate
game
again
but
track
the
natural
log
of
your
wealth,
ln(S),
instead
of
your
wealth,
S
¨ Define
the
rate
of
return
for
natural
log
wealth,
vi,
instead
of
the
rate
of
return,
ri,
on
wealth
(r
is
the
simple
rate
of
return)
22
( ) ( )
( ) ( )
)rln(1
S
SS
1ln
S
S
ln
v
SlnSlnv
vSln
Sln
i
1i
1ii
1i
i
i
1iii
i1i-‐i
+=
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛ −
+=
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
=
−=
+=
−
−
−
−
i
i
v
1ii
1i
iv
1i
i
i
eSS
S
S
e
S
S
lnv
⋅=
=
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
=
−
−
−
( )
)eln(e
S SSln
==
1
S
S
r
1i-‐
i
i −=
23. Another
‘Rate
Game’
Con-nued
¨ So
the
equivalent
rate
game
which
tracks
the
natural
log
of
wealth,
ln(S),
is
¤ 45%
chance
of
losing
.995%
of
your
natural
log
wealth
=
ln(1-‐1%)
¤ 55%
chance
of
gaining
1.242%
of
your
natural
log
wealth
=
ln(1+1.25%)
¨ The
Central
Limit
Theorem
typically
addresses
sums
of
IID
/
FV
random
variables.
For
large
n,
the
sum
of
natural
log
rates,
sn,
approaches
a
normal
distribu-on
23
( ) ( )
( ) ( )
N~vs
vSln
Sln
v...vvSln
Sln
n
1i
in
n
1i
i0n
n210n
∑
∑
=
=
=
+=
++++=
24. Another
‘Rate
Game’
Con-nued
¨ The
mean,
u,
and
variance,
s2,
of
v
can
be
calculated
as
before
¨ So
v
is
normally
distributed
¨ The
normal
distribu-on
has
many
nice
quali-es
including
¤ Dependence
is
defined
by
linear
correla-on
¤ The
parameters
that
define
the
PDF
are
also
the
sta-s-cs
–
mean
and
variance
¤ The
sta-s-cs
are
scalable
24
[ ]2
su,N~v
( ) vof
variance
uv
n
1
s
vof
value
mean
v
n
1
u
n
1i
2
i
2
n
1i
i
∑
∑
=
=
−⋅≡
⋅≡
[ ]2
su,2222N~ ⋅⋅[ ]2
su,N~v
If
u
is
the
daily
mean
and
s2
is
the
daily
variance
of
natural
log
return
rate
v
Then
the
monthly
rate
of
return
is
also
normal
with
mean
22·∙u
and
variance
22·∙s2
This
is
not
true
for
a
lognormal
distributed
random
variable
25. Central
Limit
Theorem
25
( ) ( )
( ) )rln(1..)rln(1)rln(1Sln
)rln(1Sln
Sln
n210
n
1i
i0n
+++++++=
++= ∑=
The
sum
of
a
large
number
of
IID/FV
random
variables
is
approximately
normally
distributed
Sums
of
v
and
ln(1+r)
-‐
natural
log
rates
of
return
-‐
approach
normal
distribu-on
)r(1....)r(1)r(1
S
)r(1S
S
n210
n
1i
i0n
+⋅⋅+⋅+⋅=
+⋅= ∏=
The
product
of
a
large
number
of
IID/FV
random
variables
is
approximately
lognormally
distributed
Products
of
(1+r)
and
ev
-‐
future
value
factors
–
approach
lognormal
distribu-on
( ) [ ]
( ) [ ]2
i
2
n
1i
i
s
u,N~r1ln
sn
u,nN~r1ln
+
⋅⋅+∑=
[ ]2
n
1i
i sn
u,nNL~)r(1 ⋅⋅+∏=
The
same
parameters,
u
and
s2,define
the
lognormal
pdf
but
are
not
the
mean
and
variance
of
the
lognormal
distribu-on
27. SPX
Daily
Ln
Return
Rates
27
15,471
daily
natural
log
return
rates
from
1950
to
2011
28. SPX
Daily
Ln
Rate
Histogram
28
15,471
daily
natural
log
return
rates
from
1950
to
2011
Appears
to
be
‘somewhat
normal’,
but
is
leptokur-c
and
skewed
Mean:
Expected
value
Median:
50%
probable
value
Mode:
Highest
frequency
Again
the
CLT
says
that
large
sums
of
natural
log
daily
rates
approach
a
normal
distribu-on,
but
we’ve
made
no
comment
on
the
daily
rates
themselves
other
than
assume
that
they’re
IID/FV
29. Stock
Inves-ng
¨ The
stock
prices
and
returns
can
be
modeled
by
either
¤ Natural
log
stock
prices,
ln(S),
and
natural
log
rates
of
return,
v,
or
¤ Stock
prices,
S,
and
simple
rates
of
return,
r
¤ The
addi-ve
or
mul-plica-ve
central
limit
theorem
is
u-lized.
n
approaches
a
normal
distribu-on
(for
m
simula-ons)
n
approaches
a
lognormal
distribu-on
(for
m
simula-ons)
¤ The
distribu-on
of
v
and
r
is
not
yet
specified,
but
they
are
assumed
IID/FV
29
( ) ( )
( ) ( )
∏∑
∏∑
==
==
+=⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
=⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
+⋅=+=
+⋅=+=
n
1i
i
0
n
n
1i
i
0
n
n
1i
i0n
n
1i
i0n
i1i-‐ii1i-‐i
)r(1
S
S
v
S
S
ln
)r(1S
S
vSln
Sln
)r(1SS
vSln
Sln
∑=
n
1i
iv
∏=
+
n
1i
i)r(1
0
1
2
i-‐1
i
n-‐1
n
30. Standard
Price
Models
30
1i-‐
1i-‐i
i
i1i-‐i
S
SS
r
)r(1SS
−
=
+⋅=
[ ]2
n
1i
i sn
u,nNL~)r(1 ⋅⋅+∏=
If
r
is
IID/FV
and
n
-‐>
∞
If
v
is
IID/FV
and
n
-‐>
∞
[ ]2
n
1i
i sn
u,nN~v ⋅⋅∑=
( ) ( )
⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
=
+=
−1i
i
i
i1i-‐i
S
S
lnv
vSln
Sln
0
1
2
i-‐1
i
n-‐1
n
n·∙u
and
n·∙s2
are
PDF
parameters
but
not
sta-s-cs
n·∙u
and
n·∙s2
are
both
PDF
parameters
and
sta-s-cs
–
the
mean
and
the
variance
31. Standard
Price
Model
¨ Standard
finance
theory
assumes
v
and
r
are
IID/FV
and
use
the
addi-ve
and
mul-plica-ve
CLTs
and
resul-ng
normal
and
lognormal
pdfs
for
sums
and
products
¨ In
addi-on,
vi
and
ri
,
are
related
as
follows
¤ Thus
r
and
v
cannot
have
the
same
probability
distribu-on
¨ So
standard
finance
models
make
the
simplest
addi(onal
assump-on:
Natural
log
rates,
v,
are
normally
distributed
which
then
requires
that
simple
return
rates,
r,
are
lognormally
distributed
¨ However
some
finance
methods,
i.e.,
single
period
methods,
provide
useful
results
with
an
assump-on
that
simple
rates,
r,
are
normally
distributed,
but
this
assump-on
is
generally
inconsistent
with
the
standard
model
31
NL~)r(1f
N~
v
s
n
1i
in
n
1i
in ∏∑ ==
+==
iv
i e
)r(1 =+
[ ]
[ ] [ ]2s,uN
2
v
i
s,uNLe)r1(
s,uN~v
e
)r(1
2
i
==+
=+
32. Probability
Distribu-ons
Over
Time
32
-‐75% -‐50% -‐25% 0% 25% 50% 75% 100% 125% 150% 175% 200% 225% 250% 275% 300%
Natural
log
rates,
v,
are
assumed
normal.
The
mean
and
variance
of
a
normal
distribu-on
scale
linear
in
-me
The
future
value
factors
(1+r)
are
assumed
log
normally
distributed.
The
mean
and
variance
do
not
scale
linearly
in
-me.
33. Three
Alterna-ve
Models
¨ Relax
the
finite
variance
assump-on
¤ 4
parameter
family
of
distribu-ons
generated
by
a
‘Levy
stable’
process
¤ Variance
doesn’t
converge
as
n
increases
¨ Relax
the
IID
assump-on
¤ introduce
a
simple
condi-onally
dependent,
stochas-c
vola-lity
model
¤ GARCH
-me
series
¨ Use
power
law
frequency
distribu-on
¤ Very
common
distribu-on
in
nature
¤ Scale
invariant
33
Simulated
vola-lity
34. Essen-al
Concepts
¨ Systems
¤ Determinis-c:
includes
chao-c
¤ Stochas-c:
sta-onary
(IID/FV)
and
non-‐sta-onary
¤ Complex:
including
self
organized
cri-cality
and
complex
adap-ve
systems
¨ Standard
finance
models
assume
¤ Natural
log
rates,
v,
natural
log
prices,
ln(S),
natural
log
of
future
value
factors,
ln(1+r)
are
normally
distributed
¤ Simple
rates,
r,
future
value
factors,
ev
and
(1+r),
and
price,
S,
are
lognormally
distributed
¨ Actually
the
standard
model
doesn’t
fit
historical
data
with
any
sta-s-cal
confidence,
but
the
model
is
useful,
but
has
limita-ons
¤ Think
of
Newton’s
model
of
gravity
¨ Alterna-ve
models
that
do
fit
historical
data
beler
have
not
been
as
generally
useful
as
the
standard
model
in
a
variety
of
applica-ons
34
35. Addendum:
Links
&
Sta-s-cs
Nota-on
¨ Links
¤ Scien-fic
American
¤ A
Standard
Model
Skep-c
¤ Predic-on
Markets
¤ TradeKing
API
¨ Rate
nota-on
summary
35
Rate
Periodic
mean
Annual
mean
Periodic
standard
deviation
Annual
standard
deviation
Rate
pdf
a α
g γ
v u µ s σ Normal
d
=
SD(r)
=
SD(1+r)
r d δ Log
normal
36. Addendum:
More
Review
Of
Probability
¨ Random
number
generator
¤ Actually
genera-ng
a
IID/
FV
random
variable
¤ Again,
random
doesn’t
only
mean
IID/FV
random
¤ Excel
n rand()
uniform
between
0
and
1
n Normsinv(rand())
normally
distributed
~N[0,1]
n Norminv(rand(),µ, σ)
normally
distributed
~N[µ, σ]
¨ Importance
of
IID
/
FV
character
of
a
random
variable
¤ IID
-‐>
Law
of
large
numbers
-‐>
Expected
value
¤ IID
/
FV
-‐>
Probability
density
func-ons
for
random
variable
-‐>
Central
limit
theorem
-‐>
Normal
and
lognormal
distribu-ons
for
sums
and
products
of
random
variable
regardless
of
pdf
for
random
variable
itself
-‐>
Produced
by
a
sta-onary
random
process
36
37. Addendum:
Logarithms
and
the
CLT
37
)xln(xln
)yln()xln()yxln(
n
1i
i
n
1i
i ∑∏ ==
=⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
+=⋅
Natural
logs
are
usually
introduced
as
follows
The
rela-onship
is
generalized
as
follows
Specializing
for
standard
finance
( )
( ) ( ) [ ]
( ) [ ] [ ]
sn,unNL~e~r1
sn,unN~vr1ln
r1ln
r1x
2sn,unN
n
1i
i
2
n
1i
i
n
1i
i
n
1i
i
ii
2
⋅⋅+∴
⋅⋅=+=⎟⎟
⎠
⎞
⎜⎜
⎝
⎛
+
+=
⋅⋅
=
===
∏
∑∑∏