# hw8 - ORIE 4630 D Ruppert Homework#8 due Friday Note...

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*(T-t) + sigma*sqrt(T-t)*Z) - K*exp(-r*(T-t)) 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() t2-t1[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.

## This note was uploaded on 09/20/2011 for the course ORIE 4630 at Cornell.

### Page1 / 2

hw8 - ORIE 4630 D Ruppert Homework#8 due Friday Note...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online