0% found this document useful (0 votes)
10 views9 pages

Simulating Stock Prices with R

Uploaded by

ahmedzaghloul279
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Simulating Stock Prices with R

Uploaded by

ahmedzaghloul279
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Simulating Stock Prices with Brownian Motion

With an Application in R

Corrado Botta, PhD

Bocconi University

1/9
Outline

Introduction

Definition

Standard Brownian Motion

SDE Representation

Euler Approximation

R Code

2/9
Introduction

Brownian motion and geometric Brownian motion are widely used


in finance, particularly for:
▶ Pricing vanilla options under the Black–Scholes model.
▶ Simulating complex derivatives like path-dependent options.
▶ Measuring sensitivities through Greeks for hedging.
▶ Understanding statistical properties in small samples.

3/9
Definition

Definition
A stochastic process B = {B(t) : t ≥ 0} is a standard Brownian
motion if:
▶ B(0) = 0 almost surely.
▶ The mapping t 7→ B(t) is continuous on [0, T ] with probability
1.
▶ B has stationary independent increments.
▶ B(t) − B(s) ∼ N (0, t − s) for 0 ≤ s < t.

4/9
Standard Brownian Motion

A stochastic process X = {X (t) : t ≥ 0} is a Brownian motion with


initial value x, drift µ, and volatility σ if:

X (t) − x − µt
(1)
σ
is a standard Brownian motion. The process X can be constructed
from a standard Brownian motion B setting:

X (t) = x + µt + σB(t). (2)

It follows that X (t) ∼ N x + µt, σ 2 t .




5/9
SDE Representation

The process X satisfies the Stochastic Differential Equation (SDE):

dX (t) = µdt + σdB(t). (3)

For time-varying drift µ(t) and volatility σ(t), the equation gener-
alizes to:
dX (t) = µ(t)dt + σ(t)dB(t). (4)

R 
t Rt
▶ X (t) − X (s) ∼ N s µ(u)du, s σ 2 (u)du .
▶ X has continuous sample paths and independent increments.

6/9
Euler Approximation

The SDE of Equation (3) can be approximated by:



X (t + 1) = X (t) + X (t) · µ · dt + X (t) · σ · dt · Z (t), (5)
t = t0 , . . . , T

where:
▶ µ represents the expected return (drift term).
▶ σ represents volatility (diffusion term).
▶ dt is the time increment1 .
▶ Z (t) is an independent standard normal random variable (Z (t) ∼
N (0, 1)).

1
e.g., dt = 1/250 for daily prices, assuming 250 trading days in a year.
7/9
R Code
# define a function
[Link] = function(X0,dt,mu,sigma,T){
X = rep(NA,T)
Z = rnorm(T,mean=0,sd=1)
X[1] = X0
for(t in 2:T){
X[t] = X[t-1] + X[t-1]*mu*dt + X[t-1]*sigma*sqrt(dt)*Z[t]
}
return(X)
}

# make results reproducible


[Link](42)

# run the simulation


X = [Link](X0 = 100,
dt = 1/250,
mu = 0.05 ,
sigma = 0.15,
T = 500)

8/9
Graphical Visualization

105 Simulated Stock Prices Using Euler Approximation


Simulated Stock Price

100
95

0 100 200 300 400 500

Time (days)

9/9

You might also like