Popular in Course
Popular in Economcs
This 10 page Class Notes was uploaded by Elody Bogisich DDS on Thursday October 15, 2015. The Class Notes belongs to ECG 790C at North Carolina State University taught by Paul Fackler in Fall. Since its upload, it has received 41 views. For similar materials see /class/223871/ecg-790c-north-carolina-state-university in Economcs at North Carolina State University.
Reviews for ECG 790C
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/15/15
Notes on Monte Carlo and Simulation of Stochastic Processes Paul L Fackler North Carolina State University January 20 2009 Brownian Motion The stochastic processes most commonly used in economic applications are constructed from the so called standard Weiner process or standard Brow nian motion This process is most intuitively de ned as a limit of sums of independent normally distributed random variables tAt At n ztm 7 2t 2 dz lim 2m 1 t Hoe 111 where the iii are independently and identically distributed standard normal variates Md N07 The standard Weiner process has the following prop erties 1 time paths are continuous no jumps 2 non overlapping increments are independent 3 increments are normally distributed with mean zero and variance At The rst property is not obvious but properties 2 and 3 follow directly from the de nition of the process Each non overlapping increment of the process is de ned as the sum of independent random variables and hence the incre ments are independent Each of the variables in the sum have expectation zero and hence so does the sum The variance is 2 1 1 2 i i i i 2 i EAz i Atnlggo EE 15gt i Atnlir lo 1 7 At 2 1 Time paths for Brownian motion easily generated if a good standard normal random number generator is available because an increment of a Brownian motion over a time period A is N0A MATLAB provides an intrinsic standard normal random generator randn A function to generate a time path of a Brownian motion that begins at W0 0 and is sampled at n points between t 0 and t T follows function Wbrownian1nT DeltaTn qusqrtDelta Wzeros1n1 for i1 n Wi1wirandn11qu end It is important to note that randn returns different values each time it is called This differs from most functions In general a function should return the same value each time it is called with the same input arguments Random number generators are one of the few exceptions to this rule An alternative that returns p paths and avoids the loop is brownian pnT cumsum zerosp1 randnpnsqrtTn 2 In contrast to brownianl7 which returns a 1 gtlt n 1 vector7 brownian returns a p gtlt n 1 matrix It is possible to generate the same sequence of random numbers from a generator by using the same starting values or seeds The following script demonstrates how this can be done in MATLAB n5 T1 srandn state W1brownian1nT randn state s Wbrownian1nT disp Time paths using two Brownian path functions dispW1W Brownian Bridge Suppose that we know the value of a Brownian motion at time t and t A and that we want to simulate the value at time t AA for some 0 lt A lt 1 Set Wt AA 7 AWt A 1 7 AWt AA17 Az 3 where z is standard normal This ensures that VarWt AA 7 Wt 7 AA 4 OovWt AA 7 Wt Wt A 7 Wt 7 AA 5 and OovWt AA 7 Wt Wt 7 0 6 A Brownian bridge can be used to check whether a simulation is accurate enough and to change the size of the time step appropriately For simulation purposes7 it is useful to simulate the increments of the Browian motion The increments of a Brownian motion can be simulated using ut A2 7 Wt A2 7 Wt 7 w A M2 2 7 This formula can be used recursively to ll in the path of a Brownian process half way between previously generated steps The Brownian bridge concept can also be used to generate a Brownian motion backwards Suppose we are interested in a Brownian path that begins at W0 0 and ends at WT lVT7 where WT N0T We would like to generate this process backwards at the points 71 7 1A7 n 7 2A7 7A7 where A Tn Using the formula for the Brownian bridge7 the value at time 23971A is given by Wi71A ZfllViA l A22 8 Z Z where z N N01 This can be useful in solving asset pricing problems by starting at the terminal date and working backwards Ito Processes lto diffusion processes are typically represented in differential form as dS S7 tdt 0S7 td2 9 where z is a standard Wiener process The Ito process in completely de ned in terms of the functions 1 and a which can be interpreted as the instantaneous mean and standard deviation of the process EdS uStdt 10 and VarldS EdSZ7EdS2 EdSZ7uS t2dt2 EdSZ s tdt11 which are also known as the drift and diffusion terms7 respectively This is not as limiting as it might appear at rst7 because a wide variety of stochastic behavior can be represented by appropriate de nition of the two functions The differential representation is a shorthand for the stochastic integral tAt tAt SHAt S MSTTdT 0877Td2 12 t t The rst of the integrals in 12 is an ordinary Riemann integral The sec ond integral7 however7 involves the stochastic term dz and requires additional explanation It is de ned in the following way tAt At 1 0ST7 739dz lim 0St1ih t 270m 13 t T00 n i0 where h Altn and Di iid N01 The key feature of this de nition is that it is non anticipating values of S that are not yet realized are not used to evaluate the 039 function This naturally represents the notion that current events cannot be functions of speci c realizations of future events1 1Standard Riemann integrals of continuous functions are de ned as b n71 fltzgtdz hm h 2 fa 239 ah 14gt a ngtoo 10 with h b 7 an and A is any value on 01 With stochastic integrals7 alternative values on A produce different results Furthermore7 any value of A other than 0 would imply a sort of clairvoyance that makes it unsuitable for applications involving decision making under uncertainty It is useful to note that Ed MStdt this is a direct consequence of the fact that each of the elements of the sum in 13 has zero expectation This implies that tAt Eqstim St E 77d7 15 t Ito s Lemma In order to de ne and work with functions of lto processes it is necessary to have a calculus that operates consistently with them Suppose y ft7 S7 with continuous derivatives ft f5 and fss In the simplest case S and y are both scalar processes It is intuitively reasonable to de ne the differential dy as dyftdtfgdS as would be the case in standard calculus Unfortunately7 this approach will produce incorrect results because it ignores the fact that dS2 Odt To see what this means consider a Taylor expansion of dy at Sgt that is7 totally differentiate the Taylor expansion of fS7 t dy ft dt f5 dS fttdt2 fts dt dS fss dS2 higher order terms Terms of higher order than dt and d5 are then ignored in the differential In this case7 however7 the term dS2 represents the square of the increments of a random variable that has expectation 02 dt and7 therefore7 cannot be ignored lncluding this term results in the differential dy ft f550257tl dt f5 d5 ft f5uSt f5502St dt fsUStdz a result known as lto7s Lemma An immediate consequence of lto7s Lemma is that functions of lto processes are also lto processes provided the functions have appropriately continuous derivatives Multivariate versions of lto7s Lemma are easily de ned Suppose S is an n vectorivalued process and z is a k vector Wiener process composed of k independent standard Wiener processes Then M is an n vector7valued function u R 1 7 Rquot7 and 039 is an n gtlt k matriX7valued function 0 R 1 7 Rn The instantaneous covariance of S is UUT which may be less than full rank For vector valued S lto7s Lemma is dy ft f5MS t trace UTS7 tfggaS7 dt fsUSt d2 the only difference being in the second order term derivatives are de ned such that f5 is a 1 gtlt n vector The lemma extends in an obvious way if y is vector valued lto7s lemma can be used to generate some simple results concerning lto processes For example7 consider the case of geometric Brownian motion7 de ned as dSuSdtanz De ne y lnS7 implying that dydt0 3y3S1S7 and 62y652 7 182 Applying lto7s Lemma yields the result that dy M7022ldtadz This is a process with independent increments7 yHAt 7 yt that are Nu 7 022 At UzAt Hence a geometric Brownian motion process has conditional probability distributions that are lognormally distributed lnStAt 7 lnSt Nu 7 022At702At Constant Variance Transformations Given an SDE dx Mdt UdW 16 consider the transformation y we lt17 with f Ux 1 Using lto7s Lemma dy Uxl 1ux0 xl 102xdt dW lt18 W 20 To simulate this process set ytA ytAMiUz2UKD 21 where 1 is standard normal N0 The original variable is then recovered using 2 exp0yt 22 Another example is the square root process dz uzdt dW 23 Setting y 2 we get i 1 4 2 2 4 i 1 2 dy dt dW dt CM 24 x5 y with z 1124 lf 112 04 x we get 2 i 1 2 dy a dt dW 25 9 Both of these transformations lead to a model with a constant unit dif fusion term Such a transformation is extremely useful in both simulation and parameter estimation because the resulting conditional density is gen erally closer to a Gaussian density than for the untransformed model This means that simulations that use Gaussian approximations are generally more accurate and can use a larger step size The improvement is often several orders of magnitude W27 Numerical Solutions to SDES Generating Sample Paths ln economics and nance one is often interested in stochastic processes ei ther in discrete or continuous time Discrete time processes are generally not problematic as they typically are de ned relate to a sequence of indepen dent and identically distributed shocks which can be generated in standard fashion Generating a stochastic process in continuous time will often involve some discretization error in all but the simplest processes Diffusion processes are typically these are de ned in terms of a stochastic differential equation dY MY tdt UY tdW where W is a standard Brownian motion Recall that W itself is easily generated at a discrete set of time periods t1t2 tn using Wt1 W 1241 125141 where e is standard normal and Eeiej 0 for 239 31 j The simplest strategy for generating time paths of Y uses the Euler scheme th Yti thtixti ti 0th tiWi1 Wi If M and 039 are constants this yields a time path with no discretization error In some case a process can be transformed to a process with con stant drift M and diffusion 039 in which case it too can be generated with no discretization error The most important case is perhaps that of Geometric Brownian rnotion7 the log of which has constant drift and diffusion An SDE dx MTdt UTdW 28 can be solved by integrating T T zT xi x7d739 0T7dW7 29 t t A rst order Euler approximation is obtained by treating M and 039 as xed over the interval LT at their starting values Mxt and 0xt T T zT Ti uztt d7 Uztt dWT 95 MWMT 13 l7951WT T Wt 22 Thus to simulate a path for a process de ned by an SDE starting at t 0 and ending at t T with 71 steps of size A Tn and with X0 0 one can use function XsdepathmusigmaXOTnvarargin k sizex01 Delta Tn sqrtD sqrtDelta X zeroskn1 X1 X0 for i1 n Xixi X i1 Xi muxivararginDelta sigmaxivararginsqrtDrandnk1 end For exarnple7 tirne paths for the SDE dx H09 7 dt ndW can be generated using kappa 075 theta 1 eta 025 mu Xkappathetaeta kappatheta X sigma Xkappathetaeta eta T10 n1000O xo15 XsdepathmusigmaXOTnkappathetaeta figure1 plotlinspaceOTn1X Xlabel t ylabel x
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'