Week 2: Introduction To Discrete-Time Stochastic Processes: 15.455x Mathematical Methods of Quantitative Finance
Week 2: Introduction To Discrete-Time Stochastic Processes: 15.455x Mathematical Methods of Quantitative Finance
©2021 Mende 2
Time series models
we can add Random
§ A stochastic process is a time-dependent random variable
Tp var
§ Continuous time, S(t)
I§ Discrete time, S1, S2, S3, … St
§ Time series models sample the variable at uniform intervals
- Integer indices
- Equal spacing (weekdays?)
- Time zero origin
= x0 + x1 + x2 + · · · + xt
x t = St St 1
©2021 Mende 3
Time series models Discrete
Time series are used to model processes that evolve or are observed
discretely in time.
§ Ordered steps are identified with endpoints of time intervals.
§ Often defined, recursively, in terms of prior variables plus an "innovation."
§ The model is "solved" when we can describe or forecast the distribution
of values.
§ Cumulative income I1 + I2 + I3 + · · ·
<latexit sha1_base64="OswTBC+NlBH4YutZ9Ncz1WgbYis=">AAACFnicbVDLSgMxFL3j2/qqbt0ERRGEYaaIuhEENy4r2FZo65DJ3NFg5kFyRyxD/8C/8A/c6g+4E3fu/RDTqQtfB25yck4uNzlhrqQhz3t3Jianpmdm5+ZrC4tLyyv11cW2yQotsCUylemLkBtUMsUWSVJ4kWvkSaiwE96cjPzOLWojs/ScBjn2E36VylgKTlYK6tvNgNgRawYew8tSBz7bZTpo2LUnooxMdaRhUN/0XK8C+0v8L7J57EKFZlD/6EWZKBJMSShuTNf3cuqXXJMUCoe1XmEw5+KGX2HX0pQnaPpl9Z8h27JKxOJM20qJVer3jpInxgyS0N5MOF2b395I/M/rFhQf9kuZ5gVhKsaD4kIxytgoHBZJjYLUwBIutLRvZeKaay7IRljrVY0sj5MIY+MS3tlY/N8h/CXthuvvu42zPZiDddiAHfDhAI7hFJrQAgH38AhP8Ow8OC/O6zjACWe8wxr8gPP2CR9nn+4=</latexit>
Properties of not
yetobservedvalues
§ Daily stock price values Pt = P0 er1 +r2 +···+rt
§ Random walk
©2021 Mende 4
Random walk model Important
The random walk is the simplest of all time-series models
<latexit sha1_base64="Yl/a9NRjzB3kO2Sd8VM/ZO7cR18=">AAACD3icbVDLSgMxFL3j2/qqbl0YFEUQhpki6kYQ3Lis2FahLUMmc0eDmQfJHbGWLv0L/8Ct/oA78Qvc+yGmUxe+DuTm5Jx7SXLCXElDnvfujI1PTE5Nz8xW5uYXFpeqy/MtkxVaYFNkKtMXITeoZIpNkqTwItfIk1DheXh9PPTPb1AbmaUN6uXYTfhlKmMpOFkpqK6dBQ22dcjuAp/t2FqztSOijEx5bATVDc/1SrC/xP8iG0culKgH1Y9OlIkiwZSE4sa0fS+nbp9rkkLhoNIpDOZcXPNLbFua8gRNt19+ZMA2rRKxONN2pcRK9ftEnyfG9JLQdiacrsxvbyj+57ULig+6fZnmBWEqRhfFhWKUsWEqLJIaBameJVxoad/KxBXXXJDNrtIpB1keJxHGxiW8tbH4v0P4S1o1199za6e7MAOrsA7b4MM+HMEJ1KEJAu7hEZ7g2XlwXpzXUYBjzmiHFfgB5+0TmUac9g==</latexit>
A random walk is
S T = z1 + z2 + · · · + zT
11
112
the addition of 1 randomvariables
§ Each increment is an random IID variable
§ Independent and identically distributed 2 Zz 2 n are independent
§ No dependence on past history
§ Uniform time evolution
stationary
§ Universality
§ The essential features are independent of many step-level details
§ Easy to generalize for financial applications
§ Appears frequently in other contexts
§ Building block for more complex models
©2021 Mende 5
o Does not have memory of thepast
Random walk model
We can often express results in terms of "standard" random variables:
<latexit sha1_base64="bBMrogXceOgvlj5uiBqcmwuwPcI=">AAACVXicbZHPatwwEMa17p9s3bTZ9NrL0JAmvRh7CW0vgUAo9JhCdxNYuUbWjhMRyTbSOHRj/IR5glxDX6DX9lKtt4d00wGhj9/Mx4hPea2Vozi+HQSPHj95ujF8Fj7ffPFya7S9OXVVYyVOZKUre5YLh1qVOCFFGs9qi8LkGk/zy+Nl//QKrVNV+ZUWNaZGnJeqUFKQR9kIW24NfOpm1xml8PYQ4pDz8B78Nu5xAruHwKfC7nv2bm0GrrOW9rqVHzjhd2pBFdAB8RKB9rLRThzFfcFDkfwVO0cR6+skG/3g80o2BkuSWjg3S+Ka0lZYUlJjF/LGYS3kpTjHmZelMOjSto+jg11P5lBU1p+SoKf3Ha0wzi1M7ieNoAu33lvC//VmDRUf01aVdUNYytWiotFAFSyzhbmyKEkvvBDSKv9WkBfCCkn+B0LeG6EuzBwLF/mUfCzJeggPxXQcJe+j8ZcDNmSv2Ru2zxL2gR2xz+yETZhkN+wn+8V+D+6CYbC1CjAYrG72iv1TwfYfi5SzWg==</latexit>
§ Mean = 0 E[zt ] = 0
§ Variance = 1 E[zt2 ] = 1
§ Correlation = 0 for different times E[zt zt0 ] = 0 if t 6= t0
No autocorrelacio's
Examples:
I
zt = ±1, p = 1/2
§ Coin toss (+1 or –1 with equal probability) Discrete
1 zt2 /2
§ Gaussian random variable zt ⇠ N (0, 1), p(zt ) = p e
2⇡
Trick Whenwe'retalkingabout 2 random interested inthemean and
variables we're not goingto ask for the fukPDF only
we're variance
©2021 Mende 6
I haussian Gauss
Random walk model
Now consider a sum of these identical random variables.
§ What is the probability distribution of the sum?
§ In general, it can be a complicated (given by a convolution of the
individual distributions).
§ However, there is an especially simple result for the mean and the
variance of the sum.
<latexit sha1_base64="L4sEvWwc5J6GkeD8HdyupZ6Yc3w=">AAADKHicdVLdbtMwFHbCz0YYrOOWG4upWyekKokQ44JKkxASl0O03aQ6jVzXaa3lb/bJRBflVXgL3oBbuEfcoT0IJ+km2g2OHPv4+875fHLsSR4rA67707Lv3X/wcGPzkfN468nT7dbO1tBkhRZyILI406cTbmSsUjkABbE8zbXkySSWJ5OzdzV/ciG1UVnah0Uug4TPUhUpwQGhcMc6bH8K+3SPMnleqAt6GXr0Jc4+ziyeZmCabZ/2KDNFEpbQ86pxHyGgjDltylSCdUrjMJCfoXxfjVAvoHsYfwOgZlDL/d37war8CoGZPepSB6XrMeS6g3IHa3IIjP067gZhsYxg1Plf6Qdjn2k1m0PQ6NZa6/+ycj6Mm9L8a/4t7Fdr9CWC+1Xg9Ppha9ftuo3Ru4537ewedUljx2Hrik0zUSQyBRFzY0aem0NQcg1KxLJyWGFkzsUZn8kRuilPpAnK5oYr2kZkSqNM45cCbdDVjJInxiySCUYmHObmNleD/+JGBURvglKleQEyFcuDoiKmkNH6udCp0lJAvECHC62wVirmXHMB+Kgc1iTSPEqmMjJdbBS2xbvdhLvO0O96r7v+x1dkkzwnL0iHeOSQHJEP5JgMiLC+WN+s79YP+6v9y/69bKBtLVfyjKyZffUHJjD62w==</latexit>
⇥ ⇤
Var(ST ) = E[ST2 ] = E (z1 + z2 + . . . + zT ) 2
T
X X
=
t=1
E[zt2 ] +2
t<t0
E[zt zt0 ] = T
I crossproducts
0
§ The T-step random walk has a variance that grows linearly with T.
§ The standard deviation (its square root) grows as square root of T.
©2021 Mende 7
Random walk model
§ Summary
§ The elementary random walk model is constructed as a sum of IID
random variables
<latexit sha1_base64="Yl/a9NRjzB3kO2Sd8VM/ZO7cR18=">AAACD3icbVDLSgMxFL3j2/qqbl0YFEUQhpki6kYQ3Lis2FahLUMmc0eDmQfJHbGWLv0L/8Ct/oA78Qvc+yGmUxe+DuTm5Jx7SXLCXElDnvfujI1PTE5Nz8xW5uYXFpeqy/MtkxVaYFNkKtMXITeoZIpNkqTwItfIk1DheXh9PPTPb1AbmaUN6uXYTfhlKmMpOFkpqK6dBQ22dcjuAp/t2FqztSOijEx5bATVDc/1SrC/xP8iG0culKgH1Y9OlIkiwZSE4sa0fS+nbp9rkkLhoNIpDOZcXPNLbFua8gRNt19+ZMA2rRKxONN2pcRK9ftEnyfG9JLQdiacrsxvbyj+57ULig+6fZnmBWEqRhfFhWKUsWEqLJIaBameJVxoad/KxBXXXJDNrtIpB1keJxHGxiW8tbH4v0P4S1o1199za6e7MAOrsA7b4MM+HMEJ1KEJAu7hEZ7g2XlwXpzXUYBjzmiHFfgB5+0TmUac9g==</latexit>
S T = z1 + z2 + · · · + zT
©2021 Mende 8
conceptcheck
It does notdepend on the distribution onlyrelevantfactor T
Generalized random walk model
Let's generalize this model by introducing two constant parameters,
<latexit sha1_base64="D+W+CINJxuq+jvtQU7DQqLywxAc=">AAACBnicbVDLSgNBEOz1bXxFD168DAZBEJZdEfUiCF48KhgNZEOYnfTGwZndZaZXjNGv8A+86g94E//Cux/iZONBEwuarqnqZpqKcyUtBcGnNzE5NT0zOzdfWVhcWl6pri5e2qwwAusiU5lpxNyikinWSZLCRm6Q61jhVXxzMvCvbtFYmaUX1MuxpXk3lYkUnJzUrq6bNrEjFlnZ1Zzdu8cOi3TRrtYCPyjBxkn4Q2rHPpQ4a1e/ok4mCo0pCcWtbYZBTq0+NySFwsdKVFjMubjhXWw6mnKNttUv739kW07psCQzrlJipfp7o8+1tT0du0nN6dqOegPxP69ZUHLY6ss0LwhTMfwoKRSjjA3CYB1pUJDqOcKFke5WJq654YJcZJWoXGR5ojuYWJ/wzsUSjoYwTi53/XDf3z3fgznYgE3YhhAO4BhO4QzqIOABnuEFXr0n7817HwY44Q07rMEfeB/f/rabRQ==</latexit>
0
rt = zt + µ o create
0 a new
random variable
§ Random variable scaled by !
§ Constant additive piece µ
§ Independent steps in each time period
§ These two parameters will be measures of risk and return.
©2021 Mende 10
Generalized random walk model
Now consider the stochastic process generated by the sum <latexit sha1_base64="hk949HMv84XGjijuqKvil5nNPU4=">AAACKXicbVDLTtwwFL2B8hoenbLtxgKBkJCiZIR4LJCQ2HQJ0gyMNBkix7kBCztJ7ZtRR9F8C3/BH7Bt15W6o/0PPBkWLfRIvj4+517ZPkmppKUg+OnNzX9YWFxaXmmtrq1vfGx/WruyRWUE9kShCtNPuEUlc+yRJIX90iDXicLr5P586l+P0FhZ5F0alzjU/DaXmRScnBS3T/pxl+2yCL9WcsRMHLJ9VzuuRiotyDbHLjtlka10XNNpOLnpOolacXs78IMG7D0JX8n2mQ8NLuL27ygtRKUxJ6G4tYMwKGlYc0NSKJy0ospiycU9v8WBoznXaId188UJ23FKyrLCuJUTa9S/J2qurR3rxHVqTnf2rTcV/+cNKsqOh7XMy4owF7OLskoxKtg0L5ZKg4LU2BEujHRvZeKOGy7IpdqKmkFWZjrFzPqE31ws4dsQ3pOrjh8e+p3LA1iGz7AFexDCEZzBF7iAHgh4gCf4Dj+8R++X9zwLcM6b7bAJ/8D78wKBZKbH</latexit>
T
X
X T ⌘ r1 + r2 + . . . + rT = rt Boid a sum of
t=1 randomvariables
and again use the linearity of the expectation operator to find the mean and
variance of this sum:
<latexit sha1_base64="Q58AcytFB8RnvoMdelapmpaKs3c=">AAACP3icbVDdStxAGP2irT+rtau33gyVSqEQkkWqN4IggndV2NWFTQiTyRcdnEnCzBdxCftYvkVfoHirL9A78cbZbCn+9MAw5ztnDjNz0kpJS0Hw25ub//BxYXFpubOy+mntc3d99cyWtRE4EKUqzTDlFpUscECSFA4rg1ynCs/Tq8Opf36Nxsqy6NO4wljzi0LmUnByUtL92YkIb6g5moyGST9m2/vsn2CSMGbfX869dlZZSfa14ZL7rB/pOuluBX7Qgr0n4V+ydeBDi5Okex9lpag1FiQUt3YUBhXFDTckhcJJJ6otVlxc8QscOVpwjTZu2o9P2FenZCwvjVsFsVZ9mWi4tnasU3dSc7q0b72p+D9vVFO+FzeyqGrCQswuymvFqGTTFlkmDQpSY0e4MNK9lYlLbrgg13UnaoOsynWGufVdTa6W8G0J78lZzw9/+L3THViCTfgC3yCEXTiAYziBAQi4hTu4hwfvl/fHe5wVOOfNdtiAV/CengGjarEN</latexit>
El
§ Mean: E[XT ] = E[r1 ] + E[r2 ] + . . . + E[rT ] = T µ
<latexit sha1_base64="H85p1F2qRwMWyi8dW5pGlvPTaNQ=">AAADIXicbVLdbtMwFHbC3wiDddxyYzEVWqFWSYSACyZNoElcDintKjVp5LpOa81OIvsE0UZ5Dt6CN+AWXoAbhLjjQXCSDbaOIzn5/J3zfT458TwXXIPr/rDsGzdv3b6zc9e5t3v/wV5nf3ess0JRNqKZyNRkTjQTPGUj4CDYJFeMyLlgp/Ozt3X+9ANTmmdpAOucRZIsU55wSsBQ8b7lhmOiepM46OMnh9gJgX2E8rgKBUtg2jzr5CAIZREqvlxBf+a3IDLVoWNEW5o3fCl6PRV7A6Pp42fYYB8P8PkupIsMdEsHTUmtUFu23dpX86Ukhj8uW9NN7BndxrhdstnEwYVBVXcTXMicbv1F/1x0IeMSDr1qFvxtebqJYeZHxsbfqnsNT6srZeag0nBR3Dlwh24T+DrwzsHB0RA1cRJ3foeLjBaSpUAF0XrquTlEJVHAqWCVExaa5YSekSWbGpgSyXRUNr+2wl3DLHCSKbNSwA17WVESqfVazk2lJLDS27ma/F9uWkDyKip5mhfAUtoelBQCQ4bre4IXXDEKYm0AoYqbXjFdEUUomNvkhI0Q54lcsEQPzZjMWLztIVwHY3/ovRj675+jHfQIPUY95KGX6Ai9QydohKj1yfpifbW+2Z/t7/bPdoC21b7RQ3Ql7F9/AFxw+H8=</latexit>
h i
§ Variance: Var(XT ) = E (XT T µ)
2
⇣ Zeo ⌘2
= E (r1 µ) + (r2 µ) + · · · + (rT µ)
M
2
=T
o EGE eliminate the crossproduct
we still wave rid
of aTos deEs
©2021 Mende 11
cc
eExit Tu
For
Tu
rf
FATH cim Fu
o Fi us
Generalized random walk model
§ Summary
§ The generalized random walk model is constructed as a sum of IID
random variables
<latexit sha1_base64="wuUidEimqQEs0Z1rLWIuBaGQnFM=">AAACKnicbVDLSuRAFL3xNU776nHrphhRBgZC0ogOgiC4canQrQ2dNlQqN1pYlcSqG7EJ/S/zF/6BW926cCfzHVOdnsX4OFC3Tp1zL1V1klJJS0Hw7M3Mzs0vfFn82lpaXllda39bPrNFZQT2RKEK00+4RSVz7JEkhf3SINeJwvPk+mjin9+isbLIuzQqcaj5ZS4zKTg5KW7v9+Mu22YR3lTylpk4ZD9d7bgaqbQg2xy7bOuARbbScU0H4fii6zRqxe3NwA8asI8k/Ec2D31ocBK3X6O0EJXGnITi1g7CoKRhzQ1JoXDciiqLJRfX/BIHjuZcox3WzR/HbMspKcsK41ZOrFH/n6i5tnakE9epOV3Z995E/MwbVJT9GtYyLyvCXEwvyirFqGCTwFgqDQpSI0e4MNK9lYkrbrggF2sragZZmekUM+sT3rlYwvchfCRnHT/c9TunO7AIG/AdfkAIe3AIx3ACPRDwGx7gEZ68e+/Fe50GOONNd1iHN/D+/AXto6b1</latexit>
X T ⌘ r1 + r2 + . . . + rT
§ Each term has a scale and an offset, which can be used to model the
volatility and mean return of asset price dynamics
<latexit sha1_base64="D+W+CINJxuq+jvtQU7DQqLywxAc=">AAACBnicbVDLSgNBEOz1bXxFD168DAZBEJZdEfUiCF48KhgNZEOYnfTGwZndZaZXjNGv8A+86g94E//Cux/iZONBEwuarqnqZpqKcyUtBcGnNzE5NT0zOzdfWVhcWl6pri5e2qwwAusiU5lpxNyikinWSZLCRm6Q61jhVXxzMvCvbtFYmaUX1MuxpXk3lYkUnJzUrq6bNrEjFlnZ1Zzdu8cOi3TRrtYCPyjBxkn4Q2rHPpQ4a1e/ok4mCo0pCcWtbYZBTq0+NySFwsdKVFjMubjhXWw6mnKNttUv739kW07psCQzrlJipfp7o8+1tT0du0nN6dqOegPxP69ZUHLY6ss0LwhTMfwoKRSjjA3CYB1pUJDqOcKFke5WJq654YJcZJWoXGR5ojuYWJ/wzsUSjoYwTi53/XDf3z3fgznYgE3YhhAO4BhO4QzqIOABnuEFXr0n7817HwY44Q07rMEfeB/f/rabRQ==</latexit>
rt = zt + µ
©2021 Mende 12
Linear Time Series Models
©2021 Mende 13
Time series models
To capture causality and correlation across time, more complex models
can be built by combining elements of the random walk.
§ Example: MA(1) moving average model is not IID
r t ⌘ µ + zt + z t 1 2 is known timet
©2021 Mende 14
Time series models
Another way to model causal influences is to have past values of the
random variable itself on the right hand side of a recursive definition.
causalrelationship
R t = c 0 + c 1 Rt + · · · + c p Rt + zt , zt ⇠ IID(0, 1)
1 p
error 2c
we are creating randomwalk with ARLp
§ Example: the ARMA(p,q) model combines both of the above:
<latexit sha1_base64="jkmfBupGV2IUj+2aab98Pl2vi4A=">AAACYnicbZHBa9swGMVld1uztFvTwk4bQ7SsDMaMXcbaS6HQy45ZWdpCHIwsf05EJFuRPpemJv9ne9+9/0GpYu+wJfvA0vPv6WHzlGopLIbhg+dvvHj5arPzuru1/ebtTm93+9KWleEw4KUszXXKLEhRwAAFSrjWBphKJVyl0/Olf3UDxoqy+IVzDSPFxoXIBWfoUNIzFwnSw1PKk5B+cWtEL5Iav0YL9xbzrETbYN1i3WArxorROxeM4+5hPJtVLFtyPREuf7eeb5xZ68wWSe8gDMJm6LqI/oiDs4A00096v+Os5JWCArlk1g6jUOOoZgYFl7DoxpUFzfiUjWHoZMEU2FHddLOgnxzJaF4a9xRIG/p3ombK2rlK3UnFcGJXvSX8nzesMD8Z1aLQFULB2w/llaRY0mXRNBMGOMq5E4wb4f6V8gkzjKO7jm7cBKnOVQa5DRBuXS3Ragnr4vIoiL4HRz+/kQ55T/bJZxKRY3JGfpA+GRBO7smTt+l1vEf/nf+hLdD32p3skX/G//gMVru2Lg==</latexit>
§ Linear structure
§ Past observations determine likelihood of future outcomes
§ Coefficients to be determined
©2021 Mende 15
Time series models
The distribution of future outcomes can be determined using linearity,
recursion, and stationarity.
§ A time series process is stationary if the joint distribution of all of its constant distribution
values is invariant under time translation t ! t + s
§ It is weakly stationary if the first and second moments (i.e., means
and covariances) are invariant. All we need
To see how this works, let's solve for a special case in detail: AR(1)
<latexit sha1_base64="78K46cBNZNFjv1X9ixLDwjrBLZo=">AAACFnicbVDLThsxFL1Dgabh0cC2G6sIhIQYzUSoZYMUiQ3LEDUQKYlGHudOsLBnRvadqmGUP+Av+INu4QfYVey674fUmbCAwJHse3zOvbJ94lxJS0Hw11v6sLyy+rH2qb62vrH5ubG1fmGzwgjsikxlphdzi0qm2CVJCnu5Qa5jhZfx9enMv/yJxsos/UGTHIeaj1OZSMHJSVFjrxMR2zthIgrYgdtD1olKOgyn7jSwcqw5u3EdUWMn8IMK7C0Jn8lOy4cK7ajxbzDKRKExJaG4tf0wyGlYckNSKJzWB4XFnItrPsa+oynXaIdl9Z8p23XKiCWZcSslVqkvJ0qurZ3o2HVqTld20ZuJ73n9gpLjYSnTvCBMxfyipFCMMjYLh42kQUFq4ggXRrq3MnHFDRfkIqwPqkGWJ3qEifUJf7lYwsUQ3pKLph9+85vnR1CDL/AV9iGE79CCM2hDFwTcwm+4hwfvznv0/swDXPLmFbbhFbyn/6sen6g=</latexit>
R t = c 0 + c 1 Rt 1 + zt Demonstrate
Doesnot mean the outcomes arethe same
n means theyhave the same distribution
©2021 Mende 16
Rt = c0 + c1 Rt 1 + zt
=) E [Rt ] = c0 E [1] + c1 E [Rt 1 ] + E [zt ]so
= c0 + c1 E [Rt 1 ] <latexit sha1_base64="YWfmfsQwLl3I8zdj8d3UUgBX/Zw=">AAACB3icbZDNSgMxFIXv+G+tWt24cBMsihuHmSLqRhBEcKlibaEtJZPe0WDmh+SOWIZ5C9/Arb6AO/Ep3PsgplMX/h0I+TgnlyQnSJU05HnvzsTk1PTM7Nx8ZaG6uLRcW6lemSTTApsiUYluB9ygkjE2SZLCdqqRR4HCVnB7PMpbd6iNTOJLGqbYi/h1LEMpOFmrX1vrnuQXfSrY1iFjJee04xdFv1b3XK8U+wv+F9SPXCh11q99dAeJyCKMSShuTMf3UurlXJMUCotKNzOYcnHLr7FjMeYRml5efqBgm9YZsDDRdsXESvf7RM4jY4ZRYE9GnG7M72xk/pd1MgoPermM04wwFuOLwkwxStioDTaQGgWpoQUutLRvZeKGay7IdlbploMsDaMBhsYlvLe1+L9L+AtXDdffcxvnuzAH67AB2+DDPhzBKZxBEwQU8AhP8Ow8OC/O67jACWe8wyr8kPP2CaN3m54=</latexit>
c0
E [Rt ] = . Dromedio
1 c1
§ For convenience and clarity, let's swap out these parameters for two
new ones,
c0ze
<latexit sha1_base64="wHLrYY2g9ZpIRij9W/sVQKabBVI=">AAACIHicbZDNSsQwFIVv/Xf8G926CYriQks7iLoZENy4VHB0YDqUNL3VYNJ2klQcyryGb+EbuNUXcKW49EHMdFzo6IWQwzm5N8kX5YJr43lvzsTk1PTM7Nx8bWFxaXmlvrp4qbNCMWyxTGSqHVGNgqfYMtwIbOcKqYwEXkW3J8P86g6V5ll6Yfo5diW9TnnCGTXWCuteIAuy3SQkSBRlJQu9QenvsdAf7JKg1ytoTAJhx8WUNMnQD+ubnutVRf4K/1tsHrtQ1VlY/wzijBUSU8ME1brje7npllQZzgQOakGhMafsll5jx8qUStTdsvrZgGxZJyZJpuxKDancnx0llVr3ZWRPSmpu9Hg2NP/LOoVJjrolT/PCYMpGFyWFICYjQ0wk5gqZEX0rKFPcvpWwG2oRGQuzFlSNJE9kjIl2Dd5bLP44hL/isuH6B27jfB/mYB02YAd8OIRjOIUzaAGDB3iCZ3hxHp1X530EcMIZ7bAGv8r5+AJ1lqRU</latexit>
random
process
µ= , = c1
1 c1
©2021 Mende 17
µ I Ci
c ulita
Rt Co tart I tote Cc
1
Rt relax X Rtttoes
Rt u uh X
Time series models Alm Rs 1 tree
©2021 Mende 18
Explain autocov
⇥ ⇤
0 = Var[Rt ] = E (Rt µ)2
⇥ ⇤ ⇥ ⇤
=( )2 E (Rt 1 µ)2 + 2
E zt2
2 2
= 0 +
<latexit sha1_base64="WCl3pujqD6yYGA1Jr+3sUGO3rbk=">AAAB8XicbVDLSgNBEOyN7xg1evUyGARPy24Q9Rjw4jGiUSFZwuykNxky+2CmV4wh/oFX/QFv4gd590OcbDxoYsHQRVU33VNhpqQhz/t0SkvLK6tr6xvlzcrW9k51t3Jj0lwLbIlUpfou5AaVTLBFkhTeZRp5HCq8DYfnU//2HrWRaXJNowyDmPcTGUnByUpXj13qVmue6xVgi8T/IbWGCwWa3epXp5eKPMaEhOLGtH0vo2DMNUmhcFLu5AYzLoa8j21LEx6jCcbFqRN2aJUei1JtX0KsUH9PjHlszCgObWfMaWDmvan4n9fOKToLxjLJcsJEzBZFuWKUsum/WU9qFKRGlnChpb2ViQHXXJBNp9wpBlkWxT2MjEv4YGPx50NYJDd11z9x65fHsA77cABH4MMpNOACmtACAX14hhd4dZ6cN+d9FmDJmVXYgz9wPr4BSHuUcw==</latexit>
2 Proportional to 82
0 = 2
1
©2021 Mende 19
Time series models
Now consider the covariance of observations taken at two different times.
From stationarity, it depends on k only, not t.
k ( )k 2
they're in
=( ) =
k 0
1 2 AE o
©2021 Mende 20
Time series models
§ Summary
§ Linear time series models can be constructed out of standard random
variables, lagged observations, and constant coefficients.
§ They can exhibit temporal correlations useful in modeling the
propagation of information and influence over time.
§ An example is the AR(1) model, used for mean reversion:
<latexit sha1_base64="7PZhGpc1dpyU/lxVvbI6jpwKKH8=">AAACKHicbVBNT9wwFHyBltLla+HKxQIVUaGNkhUqXJCQuHAExALSZhU5zsuuhZ1E9gtiifav8C/4B1zbe9Ub4ofUm+2hhY705NGMR/abpFTSUhD89ObmP3xc+LT4ubW0vLK61l5fvrJFZQT2RKEKc5Nwi0rm2CNJCm9Kg1wnCq+T25Opf32Hxsoiv6RxiQPNh7nMpODkpLh9eBFTJ9IV2zlinUi5YMojhRntXsQ1dcLJ1IyMHI7oK9tjkZVDzdlDTHF7O/CDBuw9Cf+Q7WMfGpzF7dcoLUSlMSehuLX9MChpUHNDUiictKLKYsnFLR9i39Gca7SDutlwwr44JWVZYdzkxBr170TNtbVjnbibmtPIvvWm4v+8fkXZ4aCWeVkR5mL2UFYpRgWb1sVSaVCQGjvChZHur0yMuOGCXKmtqAmyMtMpZtYnvHe1hG9LeE+uun74ze+e78MibMIW7EIIB3AMp3AGPRDwCM/wHX54T94v72VW4Jw3O2ED/oH3+hvmRKhM</latexit>
Rt µ= (Rt 1 µ) + zt
©2021 Mende 21
expected
Future is unconditional Past is conditional to info at time t
Eeleen o varixt 0
Ee pixe 0Mt vartleen de
Instead of computingpropertiesof a distribution
like meanvariance against a PDF we're doing
against empirical data
©2021 Mende 22
Monte Carlo simulation
Use random number generators to simulate stochastic process
§ This provides a test lab, with "best case" data since it comes from a
known distribution
§ Typically generate an ensemble with a large number of hypothetical
realizations of a financial process or market
§ Approximate exact results by computing statistics over the ensemble.
- Results become more precise as simulation size increases
- Numerical results exist even when close-form results do not
- Testbed for code and algorithms designed for real-world data
§ Applications:
§ Asset price dynamics
§ Option pricing
§ Portfolio and risk management
©2021 Mende 23
Monte Carlo simulation
Most computer languages include functions to generate individual random
numbers from various distributions. The R language includes these:
§ Note that they are not truly random, since the machine is deterministic,
and also are just approximations to the distribution. For instance, range
of rnorm (approximation to Gaussian) is bounded, and Prob(X = 1/2) for
runif (approximation to uniform) is non-zero.
©2021 Mende 24
R Monte Carlo
Rescale these functions to get useful ranges, e.g.,
Generate sequences S
S <- exp(apply(r,2,cumsum)) corresponding to lognormal
distribution
timedirection
©2021 Mende 25
Simple 20-step random walk
p <-
0.5;q <- 1-p; # Set probability of "success" and "failure"
Nt <-
20; # Number of time steps
Np <-
1; # Number of sample paths
z <-
matrix(runif(Nt*Np),nrow=Nt)
a
# Generate a set of uniform random draws
x <-
sign(p-z); # Transform to binomial random variable +/- 1
s <-
matrix(0,Nt+1,Np) # Initial value for random walk.
# Note that R indices start with 1,not zero.
for (t in 1:Nt) {
s[t+1,] <- s[t,]+x[t,] # New location equals previous plus a new random step
}
plot(s,type="b") # Plot resulting path
©2021 Mende 26
Many simulations of a one-year daily walk
Nt <- 252; # Number of trading days in a year
Np <- 1e4; # Reasonably large number of simulations
z <- matrix(runif(Nt*Np),nrow=Nt) # Generate a set of uniform random draws
x <- sign(p-z); # Transform to binomial random variable +/- 1
s <- matrix(0,Nt+1,Np) # Initialize and reserve space for random paths.
for (t in 1:Nt) {
s[t+1,] <- s[t,]+x[t,] # New location equals previous plus a new random step
9
}
matplot(s[,1:3],type="b") # Plot a few of the resulting paths
Path I hi
2
Path
Path 3
©2021 Mende 27
Application: asset price dynamics
Asset prices are often modeled as lognormal variables, i.e., where their
continuously compounded (log) returns are drawn from a normal
distribution
2 rt
rt = log(Pt /Pt 1) ⇠ N (µ, ), Pt = Pt 1e ,
rt +rt 1 recursive
= Pt 2e ,...
<latexit sha1_base64="uxPYYMOYmpmz/Qs3Bxa7UOh0EvU=">AAACinicbVFdb9MwFHXC1wiDdbzwwIvFtKlVS5aESfBSaRII8YSKRLdJdRc5jtNZs+PMvkGrovwR/hnv/BCctA+wcSXLx+eeY1vnZpUUFqLol+c/ePjo8ZOdp8Gz3ecv9gb7u2dW14bxOdNSm4uMWi5FyecgQPKLynCqMsnPs+uPXf/8BzdW6PI7rCu+VHRVikIwCo5KBz9NClMi9Wo4S+F4ljbwNm5HmFihGsKoxF/bIVH1xBErRS+T0YTc3NQ0x4HTH023Bn7ZuHvaCQ4ICbZssmXHZqNpJ0TmGmwnOew0ESb8thqaNMZjbNIEjwnrBP0JRkE6OIjCqC98H8RbcHAaor5m6eA3yTWrFS+BSWrtIo4qWDbUgGCStwGpLa8ou6YrvnCwpIrbZdNn2OJDx+S40MatEnDP/u1oqLJ2rTKnVBSu7N1eR/6vt6ih+LBsRFnVwEu2eaioJQaNu4HgXBjOQK4doMwI91fMrqihDNzYAtIbcVWonBc2BH7rYonvhnAfnCVh/C5Mvp2gHfQavUFDFKP36BR9QTM0R8xD3pF37EX+K3/qf9oE6HubHb1E/5T/+Q+duMLF</latexit>
So over T periods, the sum of log returns is Gaussian, and the price is a
function of that sum:
assuming
our
trials
we're
Po 1
PT = P9
0e
r(T )
= P0 exp(r1 + r2 + · · · + rT ) randomvariables
2
r(T ) = r1 + r2 + · · · + rT ⇠ N (T µ, T )
<latexit sha1_base64="YTWr+MJRquHQVXCGE5J7+KHwDMw=">AAACZnicdVFda9swFJW9j7ZutmV7K325tGwkdBg7K2wvhUJf+lQycNpClBpZvk5FJdtIcmkw+aGDPvYf9A9UcfawtdsFoXPPPYcrjrJaCmOj6Jfnv3r95u3G5law3Xv3/kP/Y+/cVI3mOOGVrPRlxgxKUeLECivxstbIVCbxIrs5Wc0vblEbUZWJXdQ4U2xeikJwZh2V9m/HaQJfjsZphFetHiTDJRyB64DiXT3QaQwHoNMRHFCeV9Z0XTIMKA1WYueE/2iAGqFaypmEs+Ugoar5mjhqrtjVaBik/f0ojLqClyD+DfaPQ9LVOO0/0LzijcLScsmMmcZRbWct01ZwicuANgZrxm/YHKcOlkyhmbVdPkv47Jgcikq7U1ro2D8dLVPGLFTmlIrZa/N8tiL/NZs2tvgxa0VZNxZLvl5UNBJsBauwIRcauZULBxjXwr0V+DXTjFv3JQHtjFAXKsfChBbvXCzx8xBegvNRGH8LRz8PySbZJXtkQGLynRyTUzImE8LJved7217Pe/R3fFgH6Hvrm3wif5W/9wRIEbQ/</latexit>
©2021 Mende 28
Simulating a lognormal price process
1. Determine parameters for underlying distribution
©2021 Mende 29
Simulating a lognormal price process
sigma <- 0.3 # Set annualized volatility to 30%
mu <- 0.1 # Set annualized drift/return to 10%
dt <- 1/252 # Set time step scale factor to one day, (252 trading days per year)
z <- matrix(rnorm(Nt*Np),nrow=Nt) # Generate a set of standard normal random draws
r <- mu*dt + z*sigma*sqrt(dt) # Draw daily return from scaled N(mu,sigma^2)
r <- matrix(rnorm(Nt*Np, mean=mu*dt, sd=sigma*sqrt(dt)),nrow=Nt) # 1-step generation
s <- matrix(0,Nt+1,Np)
for (t in 1:Nt) {
s[t+1,] <- s[t,] + r[t,]
}
P <- exp(s)
matplot(P[,1:3],type="l")
©2021 Mende 30
Simulating a lognormal price process
> R <- P[Nt+1,] – 1
> mean(R)
[1] 0.1547869
> exp(mu+sigma^2/2)-1
[1] 0.1560396
> sd(R)
[1] 0.3563872
> sqrt(exp(2*mu+sigma^2)*(exp(sigma^2)-1))
[1] 0.3547634
hist(R,breaks=50)
hist(log(1+R))
plot.ecdf(1+R)
barplot(sort(1+R))
qqnorm(1+R)
R = PT /P0 1
h i 2
r(T )
E [R] = E e 1 = eµ+ /2
1
⇣ 2 ⌘
2µ+ 2
Var(R) = e e 1
©2021 Mende 31
Simulating a lognormal price process
> R <- P[Nt+1,] – 1
> mean(R)
[1] 0.1547869
> exp(mu+sigma^2/2)-1
[1] 0.1560396
> sd(R)
[1] 0.3563872
> sqrt(exp(2*mu+sigma^2)*(exp(sigma^2)-1))
[1] 0.3547634
hist(R,breaks=50)
hist(log(1+R))
plot.ecdf(1+R)
barplot(sort(1+R))
qqnorm(1+R)
R = PT /P0 1
h i 2
r(T )
E [R] = E e 1 = eµ+ /2
1
⇣ 2 ⌘
2µ+ 2
Var(R) = e e 1
©2021 Mende 32
Simulating a lognormal price process
> R <- P[Nt+1,] – 1
> mean(R)
[1] 0.1547869
> exp(mu+sigma^2/2)-1
[1] 0.1560396
> sd(R)
[1] 0.3563872
> sqrt(exp(2*mu+sigma^2)*(exp(sigma^2)-1))
[1] 0.3547634
hist(R,breaks=50)
hist(log(1+R))
plot.ecdf(1+R)
barplot(sort(1+R))
qqnorm(1+R)
R = PT /P0 1
h i 2
r(T )
E [R] = E e 1 = eµ+ /2
1
⇣ 2 ⌘
2µ+ 2
Var(R) = e e 1
©2021 Mende 33
Simulating a lognormal price process
> R <- P[Nt+1,] – 1
> mean(R)
[1] 0.1547869
> exp(mu+sigma^2/2)-1
[1] 0.1560396
> sd(R)
[1] 0.3563872
> sqrt(exp(2*mu+sigma^2)*(exp(sigma^2)-1))
[1] 0.3547634
hist(R,breaks=50)
hist(log(1+R))
plot.ecdf(1+R)
barplot(sort(1+R))
qqnorm(1+R)
R = PT /P0 1
h i 2
r(T )
E [R] = E e 1 = eµ+ /2
1
⇣ 2 ⌘
2µ+ 2
Var(R) = e e 1
©2021 Mende 34
Allowustocompare
QQslots
l distributions
> mean(R)
[1] 0.1547869
> exp(mu+sigma^2/2)-1
[1] 0.1560396
> sd(R)
[1] 0.3563872
> sqrt(exp(2*mu+sigma^2)*(exp(sigma^2)-1))
[1] 0.3547634
hist(R,breaks=50)
hist(log(1+R))
plot.ecdf(1+R)
barplot(sort(1+R))
qqnorm(1+R)
R = PT /P0 1
h i 2
r(T )
E [R] = E e 1 = eµ+ /2
1
⇣ 2 ⌘
2µ+ 2
Var(R) = e e 1
©2021 Mende 35
Simulating an AR(1) process Re re
lambda <- 0.4; mu <- 0.1 # Set mean-reversion strength and drift
R <- matrix(0,Nt,Np) # Reserve space for sample processes
epsilon <- matrix(rnorm(Nt*Np,sd=sigma*sqrt(dt)),nrow=Nt) # Simulate noise
for (t in 2:Nt)
{ # Run simulation process forward in time
R[t,] <- (1+lambda)*(mu*dt) - lambda*R[t-1,] + epsilon[t,]
}
r <- log(1+R) # Interpret R as simple return, r as continuous return
acf(R[,1]) # Show autocorrelation coefficients as function of lag
©2021 Mende 36
Simulating an AR(1) process
lambda <- 0.4; mu <- 0.1 # Set mean-reversion strength and drift
R <- matrix(0,Nt,Np) # Reserve space for sample processes
epsilon <- matrix(rnorm(Nt*Np,sd=sigma*sqrt(dt)),nrow=Nt) # Simulate noise
for (t in 2:Nt)
{ # Run simulation process forward in time
R[t,] <- (1+lambda)*(mu*dt) - lambda*R[t-1,] + epsilon[t,]
}
r <- log(1+R) # Interpret R as simple return, r as continuous return
acf(R[,1]) # Show autocorrelation coefficients as function of lag
©2021 Mende 37
Monte Carlo Methods
Summary
§ Monte Carlo sampling uses computer random number generators to
simulate data that follows a given model, process, or distribution
©2021 Mende 38
Testing the Random Walk
©2021 Mende 39
A random walk down Wall Street
Do stock prices follow random walks?
§ Model for returns drawn from lognormal distribution
©2021 Mende 40
Random walks, efficient markets, and the real world
How do stock prices behave?
How should stock prices behave?
§ Deterministic?
§ Noisy?
§ Random?
©2021 Mende 41
Model predictions
Two-parameter model, as written, holds for all time periods with same
parameter values.
<latexit sha1_base64="Vt3geqAofRJNIXUYYMEysSVNkrU=">AAACBnicbZDNSsQwFIVv/Xf8G124cRMUQRBKK6JuBMGNSwVnRpgOJc3cjsGkLcmtOI4+hW/gVl/AnfgW7n0QMx0X/h0IOZyTSy5fUihpKQjevbHxicmp6ZnZ2tz8wuJSfXm+afPSCGyIXOXmIuEWlcywQZIUXhQGuU4UtpKr42HfukZjZZ6dU7/Ajua9TKZScHJRXF81MbFDFumSbbPIyp7m7DamuL4R+EEl9teEX2bjyIdKp3H9I+rmotSYkVDc2nYYFNQZcENSKLyvRaXFgosr3sO2sxnXaDuDav97tumSLktz405GrEq/Twy4travE/dSc7q0v7th+F/XLik96AxkVpSEmRh9lJaKUc6GMFhXGhSk+s5wYaTblYlLbrggh6wWVYOsSHUXU+sT3jgs4W8If01zxw/3/J2zXZiBNViHLQhhH47gBE6hAQLu4BGe4Nl78F681xHAMW90wwr8kPf2Cfqtm0U=</latexit>
rt = µ + zt
©2021 Mende 42
Testing the random walk
§ Scaling behavior
§ Variance ratio test
§ Frequency-dependence
§ Long-range behavior
§ Alternative models
§ Serial correlation
§ Implications for market efficiency
©2021 Mende 43
Exploratory data analysis
In the case of Tootsie Roll, a quick plot of the return series appears to show non-constant
variance.
©2021 Mende 44
Exploratory data analysis
> summary(tr) # Summary of imported Yahoo data for TR
Summarize vital statistics Min.
Date
:1987-12-30 Min.
Open
:19.55 Min.
High
:19.66 Min.
Low
:19.00
§ Length of series 1st Qu.:1995-04-03
Median :2002-07-18
1st Qu.:28.95
Median :33.00
1st Qu.:29.17
Median :33.26
1st Qu.:28.64
Median :32.61
§ Max, min, sum, mean, std. deviation, Mean :2002-07-18
3rd Qu.:2009-10-29
Mean :38.72
3rd Qu.:42.00
Mean :39.07
3rd Qu.:42.50
Mean :38.37
3rd Qu.:41.75
etc. Max. :2017-02-15 Max. :83.50 Max. :84.50 Max. :82.50
Close Volume Adj Close
§ Example: Tootsie Roll (TR): mean return Min. :19.46 Min. : 0 Min. : 2.587
and volatility: 8.5% and 24.4% 1st Qu.:28.94 1st Qu.: 34800 1st Qu.: 8.797
Median :32.94 Median : 68300 Median :19.457
Histogram Mean :38.74 Mean : 90813 Mean :17.417
3rd Qu.:42.12 3rd Qu.: 114750 3rd Qu.:22.523
§ Useful for returns, not prices (Why?) Max. :83.75 Max. :5819300 Max. :41.550
> P <- tr$`Adj Close` # Define price using split&div adjusted values
> N <- length(P); N
[1] 7342
> r <- diff(log(P)) #Define log returns from successive daily prices
> summary(r)
Min. 1st Qu. Median Mean 3rd Qu. Max.
Normal? -0.1527000 -0.0078470 0.0000000 0.0003375 0.0082100 0.1726000
Symmetric?
> mean(r)*252 # Mean return for TR (annualize by 252 days/year)
[1] 0.08506148
> sd(r)*sqrt(252) # Volatility of TR (annualize with square root!)
[1] 0.2442396
> hist(r, breaks=50)
©2021 Mende 45
Flavors of Random Walk
RW1: IID – Independent and identically distributed increments (or
"innovations")
2 2
Xt = Xt 1 + µ + ✏t , ✏t ⇠ IID(0, ), E[✏t ✏t0 ] = tt0
E[Xt |X0 ] = X0 + µt,
2
Var(Xt |X0 ) = t
©2021 Mende 47
Variance and ratios
- Close to linear?
- Close enough?
©2021 Mende 48
Variance ratio estimators and data
T = nq
©2021 Mende 49
Variance ratio test
Test performed to see if ratio equals one
ˆb2 (q) p ⇣ ⌘
d
V R(q) = , T VdR(q) 1 ⇠ N (0, 2(q 1))
qˆa2
s
T ⇣ ⌘
z(q) = d
V R(q) 1 ⇠ N (0, 1)
2(q 1)
©2021 Mende 50
Variance ratio tests: as easy as a, b, c…
©2021 Mende 51
variance.c <- function(X, q) {
Variance and ratios # Compute variance statistic from overlapping q-period windows
# See Lo & MacKinlay (1988), p. 47, Eq. 12
T <- length(X) - 1
mu <- (X[T+1] - X[1])/T
§ Lo and MacKinlay add further m <- (T-q)*(T-q+1)*q/T
refinements and consider whether sumsq <- 0
variance ratios over different q-day for (t in q:T) {
sumsq <- sumsq + (X[t+1] - X[t-q+1] - q*mu)^2
window sizes are statistically identical }
return(sumsq/m)
}
§ The idea is to construct a sampling
statistic z(q) that follows a standard z <- function(X, q) {
Normal distribution if the random walk # Compute sampling statistic for variance ratio
hypothesis holds. # See Lo & MacKinlay (1988), p. 47, last line (after Eqs. 12-14)
T <- length(X) - 1
c <- sqrt(T*(3*q)/(2*(2*q-1)*(q-1)))
§ Large values of z(q) are unlikely. The p- M <- variance.c(X,q)/variance.c(X,1) - 1
©2021 Mende 52
Variance ratio test
Bias correction and improved statistics from overlapping terms
ˆc2 p
¯c2= , nq V R(q) 1 ⇠ N (0, 2(2q 1)(q 1)/3q)
(1 1/n + 1/nq)(1 1/n)
s
p 3q
z(q) = nq V R(q) 1
2(2q 1)(q 1)
©2021 Mende 53
Variance ratio test
©2021 Mende 54
Variance and ratios
Random walk model predicts that volatility > sigma <- sqrt(252)*sd(diff(log(P)))
has square-root scaling with sampling > for (n in 2:100) {
interval sigma[n] <- sqrt(252/n)*sd(diff(log(P[seq(from=n, to=N, by=n)])))
}> barplot(sigma,xlab="n",ylab="Standard Deviation (annualized) /
Example: Tootsie Roll 1988-2017 sqrt(n)",main="Volatility Scaling of Returns From n-day
Observations");grid()
Let's present data so that it appears
constant if the model is correct:
§ Compute annualized volatility from
every day, every other day, every third
day, etc.
§ Divide each volatility by sqrt(n)
§ Does the data support the model? How
significant are the variations?
©2021 Mende 55
Variance and ratios
> P.MC <- exp(cumsum(rnorm(N)*0.02)) # Monte Carlo returns 32% vol
How significant are the variations? > sigma.MC <- sqrt(252)*sd(diff(log(P.MC)))
©2021 Mende 56
Testing the Random Walk
Summary
§ The random walk model predicts that variances scale linearly with
time.
©2021 Mende 57
References
§ Books
§ Campbell, Lo, and MacKinlay (1977) – "Econometrics of Financial Markets," Princeton
§ Feller, William (1968) – "Introduction to Probability and Its Applications (3rd ed.)," Wiley
§ Glasserman, Paul (2004) – "Monte Carlo Methods in Financial Engineering," Springer
§ Tsay, Ruey S. (2010) – "Analysis of Financial Time Series (3rd ed.)," Wiley
§ Articles
§ Fama, Eugene (1965) – "Random Walks in Stock Market Prices," Financial Analysts Journal,
Vol. 21, No. 5, pp. 55-59
§ Samuelson, Paul. (1965) – "Proof that Properly Anticipated Prices Fluctuate Randomly,"
Industrial Management Review, 6:2, 41-49
§ Lo, Andrew W. & A. Craig MacKinlay (1988) – "Stock Market Prices do not Follow Random
Walks: Evidence from a Simple Specification Test," Review of Financial Studies, Vol. 1, No. 1
(Spring, 1988), pp. 41-66
©2021 Mende 58