This preview shows pages 1–2. Sign up to view the full content.
ORIE 4630 — D. Ruppert
Homework #8 — due Friday, Oct 22, 2010
Note:
Students are required to work independently on homework.
The following
R
code creates a function named
BlackScholesSim
that approximates the
price of a call option by simulation and, as default values, uses 10,000,000 simulations with
a seed equal to 4360. The other inputs are deﬁned as in Section 8.17 of the textbook. The
function
proc.time
is used to time the simulation.
BlackScholesSim
returns the mean
and the standard deviation of the
N
simulations. The latter is useful for constructing a
conﬁdence interval for the price.
*****
Put code here to specify the values of S, T, t, K, sigma, and r
*****
BlackScholesSim = function(S,T,t,K,sigma,r,N=1e07,seed=4360)
{
set.seed(seed)
Z = rnorm(N)
X
= S*exp(sigma^2/2*(Tt) + sigma*sqrt(Tt)*Z)  K*exp(r*(Tt))
Ind = as.numeric(X>0)
payoff = X*Ind
c(mean(payoff),sd(payoff))
}
t1 = proc.time()
sim_results = BlackScholesSim(S,T,t,K,sigma,r)
t2= proc.time()
t2t1[3]
1. Use
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 '10
 RUPPERT

Click to edit the document details