Learn R Programming

fExpressCertificates (version 1.3)

simPricesAndMinimumFromGBM: Simulation of the joint finite-dimensional distribution of the Geometric Brownian Motion and its minimum

Description

Simulates from the joint distribution of finite-dimensional distribution \((S(t_1),\ldots,S(t_n))\) and the minimum \(m(t_n)\) of a Geometric Brownian motion by either using simple grid approach or using the multivariate normal distribution of the returns and the conditional distribution of a minimum of a Brownian Bridge given the returns.

Usage

simPricesAndMinimumFromGBM(N = 100, S, T, mu, sigma, log = FALSE, m=Inf)

simPricesAndMinimumFromGBM2(N = 10000, S, T, mu, sigma, mc.steps = 1000)

Arguments

N

number of samples to draw

S

start value of the Arithmetic/Geometric Brownian Motion, i.e. S(0)=S0 or B(0) = S0

T

Numeric vector of valuation times (length n). \(T = (t_1,...,t_n)'\)

mu

the drift parameter of the Geometric Brownian Motion

sigma

volatility p.a., e.g. 0.2 for 20%

log

logical, if true the returns instead of prices are returned

m

Possible prior minimum value.

mc.steps

Number of gridpoints

Value

A matrix \((N \times 2n)\) with rows \((S(t_1),\ldots,S(t_n), m(t_1),\ldots,m(t_n))\)

Details

grid-approach The simPricesAndMinimumFromGBM2 method uses the Monte Carlo Euler Scheme, the stepsize is \(\delta t = t_n/mc.steps\). The method is quite slow.

multivariate-normal distribution approach

The method simPricesAndMinimumFromGBM draws from the multivariate normal distribution of returns. For the \(n\) valuation times given by \(T = (t_1,\ldots,t_n)'\) we simulate from the joint distribution \((S(t_1),\dots,S(t_n),m(t_1),\ldots,m(t_n))\) of the finite-dimensional distribution \((S(t_1),...,S(t_n))\) and the running minimum \(m(t_i) = \min_{0 \le t \le t_i}(S(t))\) of a Geometric Brownian motion. This is done by using the multivariate normal distribution of the returns of a GBM and the conditional distribution of a minimum of a Brownian Bridge (i.e. in-between valuation dates).

First we simulate \((S(t_1),\dots,S(t_n))\) from a multivariate normal distribution of the returns with mean vector $$(\mu - \sigma^2/2) T$$ and covariance matrix $$(\Sigma)_{ij} = \min{(t_i, t_j)} * \sigma^2$$

Next, we simulate the period minimum \(m(t_{i-1},t_i) = \min_{t_{i-1} \le t \le t_i}S(t)\) between two times \(t_{i-1}\) and \(t_i\) for all \(i=1,\dots,n\). This minimum \(m(t_{i-1},t_i) | S(t_{i-1}), S(t_i)\) is the minimum of a Brownian Bridge between \(t_{i-1}\) and \(t_i\).

The global minimum is the minimum of all period minima given by \(m(t_n) = \min(m_{(0,1)},m_{(1,2)},\dots, m_{(n-1,n)}) = \min m(t_{i-1},t_i)\) for all \(i=1,\dots,n\).

References

Beskos, A.; Papaspiliopoulos, O. and Roberts, G. O. (2006). Retrospective Exact Simulation of Diffusion Sample Paths with Applications Bernoulli, 12, 1077--1098

Karatzas/Shreve (2008). Brownian Motion and Stochastic Calculus, Springer

See Also

The method simPricesAndMinimumFromGBM2 returns the same, but using the Euler Scheme.

See also calcGBMProbability for the CDF of the minimum m_t (i.e. Type="P(m_t <= B)")

Examples

Run this code
# NOT RUN {
# Comparison of sampling of GBM Minimum m_t via finite dimensional approach +
# Brownian Bridges vs. crude Monte Carlo

# naive grid-based approach
X0 <- simPricesAndMinimumFromGBM2(N=5000, S=100, T=c(1,2,3), mu = 0.05, sigma=0.3, 
  mc.steps=1000)

# Simulation of minimums m_t via prices at valuation dates 
# (S(t_1),S(t_2),...,S(t_n)) and Brownian Bridges in-between	
X1 <- simPricesAndMinimumFromGBM(N=5000, S=100, T=c(1,2,3), mu=0.05, sigma=0.3)
m1 <- X1[,4]
  
# Monte Carlo simulation of m_t via gridpoints (m2)
mc.loops <- 5000
mc.steps <- 2000
S <- matrix(NA, mc.loops, mc.steps + 1)
for (j in 1:mc.loops) {
 S[j,] <- GBM(S0=100, mu=0.05, sigma=0.3, T=3, N=mc.steps)
}	
m2 <- apply(S, 1, min) # minimum for each price path
  
# Compare probability density function and CDF for m_t against each other
# and against theoretical CDF.
par(mfrow=c(2,2))
# a) pdf of GBM minimum m_t at maturity for both approaches
plot(density(m1, to=100), col="black")
lines(density(m2, to=100), col="blue")
  
# b) compare empirical CDFs for m_t with theoretical probability P(m_t <= B)
B  <- seq(0, 100, by=1)
p3 <- calcGBMProbability(Type="P(m_t <= B)", 
  S0=100, B=B, t=3, mu=0.05, sigma=0.3)
  
plot(ecdf(m1), col="black", main="Sampling of GBM minimum m_t")
lines(ecdf(m2), col="blue")
lines(B, p3, col="red")
legend("topleft", legend=c("Finite-dimensions and Brownian Bridge", 
   "MC Euler scheme", "Theoretical value"), 
   col=c("black","blue","red"), lwd=2) 
# }

Run the code above in your browser using DataLab