By Cheng Few Lee Joseph Finnerty John Lee Alice C Lee Donald Wort

8
Appendix 19 A Microsoft Excel Program for Calculating Cumulative Bivariate Normal Density Function (19.8.2) By Cheng Few Lee Joseph Finnerty John Lee Alice C Lee Donald Wort

description

By Cheng Few Lee Joseph Finnerty John Lee Alice C Lee Donald Wort. Appendix 19 A Microsoft Excel Program for Calculating Cumulative Bivariate Normal Density Function ( 19.8.2). Option Explicit Public Function Bivarncdf (a As Double, b As Double, rho As Double) As Double - PowerPoint PPT Presentation

Transcript of By Cheng Few Lee Joseph Finnerty John Lee Alice C Lee Donald Wort

Page 1: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

Appendix 19 AMicrosoft Excel

Program for Calculating Cumulative

Bivariate Normal Density Function

(19.8.2)By

Cheng Few LeeJoseph Finnerty

John LeeAlice C Lee

Donald Wort

Page 2: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

• Option Explicit• Public Function Bivarncdf(a As Double, b As Double, rho As Double) As Double• Dim rho_ab As Double, rho_ba As Double• Dim delta As Double• If (a * b * rho) <= 0 Then• If (a <= 0 And b <= 0 And rho <= 0) Then• Bivarncdf = Phi(a, b, rho)• End If • If (a <= 0 And b >= 0 And rho > 0) Then• Bivarncdf = Application.WorksheetFunction.NormSDist(a) - Phi(a, -b, -rho)• End If • If (a >= 0 And b <= 0 And rho > 0) Then• Bivarncdf = Application.WorksheetFunction.NormSDist(b) - Phi(-a, b, -rho)• End If• If (a >= 0 And b >= 0 And rho <= 0) Then• Bivarncdf = Application.WorksheetFunction.NormSDist(a) + Application.WorksheetFunction.NormSDist(b) -

1 + Phi(-a, -b, rho)• End If• Else• rho_ab = ((rho * a - b) * IIf(a >= 0, 1, -1)) / Sqr(a ^ 2 - 2 * rho * a * b + b ^ 2)• rho_ba = ((rho * b - a) * IIf(b >= 0, 1, -1)) / Sqr(a ^ 2 - 2 * rho * a * b + b ^ 2)• delta = (1 - IIf(a >= 0, 1, -1) * IIf(b >= 0, 1, -1)) / 4• Bivarncdf = Bivarncdf(a, 0, rho_ab) + Bivarncdf(b, 0, rho_ba) - delta• End If• End Function

2

Page 3: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

• Public Function Phi(a As Double, b As Double, rho As Double) As Double • Dim a1 As Double, b1 As Double• Dim w(5) As Double, x(5) As Double• Dim i As Integer, j As Integer• Dim doublesum As Double • a1 = a / Sqr(2 * (1 - rho ^ 2))• b1 = b / Sqr(2 * (1 - rho ^ 2)) • w(1) = 0.24840615• w(2) = 0.39233107• w(3) = 0.21141819• w(4) = 0.03324666• w(5) = 0.00082485334 • x(1) = 0.10024215• x(2) = 0.48281397• x(3) = 1.0609498• x(4) = 1.7797294• x(5) = 2.6697604 • doublesum = 0 • For i = 1 To 5• For j = 1 To 5• doublesum = doublesum + w(i) * w(j) * Exp(a1 * (2 * x(i) - a1) + b1 * (2 * x(j) - b1) + 2 * rho * (x(i) - a1) * (x(j) - b1))• Next j• Next i • Phi = 0.31830989 * Sqr(1 - rho ^ 2) * doublesum • End Function

3

Page 4: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

Appendix 19 BMicrosoft Excel

Program for Calculating

American Call Options(19.8.2)

ByCheng Few LeeJoseph Finnerty

John LeeAlice C Lee

Donald Wort

Page 5: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

Number* A B C*

1  Option Pricing Calculation    

2      3 S (current stock price)= 50  

4 St* (critical exdividend stock price)= 46.9641  

5 S(current stock price NPV of promised dividend)= 48.0218 =B3-B11*EXP(-B7*B10)

6 X (exercise price of option)= 48  

7 r(risk-free interest rate)= 0.08  8 σ(volatility of stock)= 0.2  9 T(expiration date)= 0.24658  

10 t(exercise date)= 0.13699  11 D(Dividend)= 2  12 d1(nondividend-paying)= 0.65933 =(LN(B3/B6)+(B7+0.5*B8^2)*B9)/(B8*SQRT(B9))13 d2(nondividend-paying)= 0.56001 =B12-B8*SQRT(B9)

14 d1*(critical exdividend stock price)= -0.16401 =(LN(B4/B6)+(B7+0.5*B8^2)*(B9-B10))/(B8*SQRT

(B9-B10))

15 d2*(critical exdividend stock price)= -0.23022 =B14-B8*SQRT(B9-B10)

5

Page 6: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

16 d1(dividend-paying)= 0.25285 =(LN(B5/B6)+(B7+0.5*B8^2)*(B9))/(B8*SQRT(B9))

17 d2(dividend-paying)= 0.15354 =B16-B8*SQRT(B9)

18 a1= 0.25285 =(LN((B3-B11*EXP(-B7*B10))/B6)+(B7+0.5*B8^2)*(B9))/(B8*SQRT(B9))

19 a2= 0.15354 =B18-B8*SQRT(B9)

20 b1= 0.48593 =(LN((B3-B11*EXP(-B7*B10))/B4)+(B7+0.5*B8^2)*(B10))/(B8*SQRT(B10))

21 b2= 0.41191 =B20-B8*SQRT(B10)

22      

23 C(St*,T-t;X)= 0.9641 =B4*NORMSDIST(B14)-B6*EXP(-B7*(B9-B10))*NORMSDIST(B15)

24 C(St*,T-t;X)-St*-D+X= 2.3E-06 =B23-B4-B11+B6

25      

26 N1(a1)= 0.59981 =NORMSDIST(B18)

27 N1(a2)= 0.56101 =NORMSDIST(B19)

28 N1(b1)= 0.68649 =NORMSDIST(B20)

29 N1(b2)= 0.6598 =NORMSDIST(B21)

30 N1(-b1)= 0.31351 =NORMSDIST(-B20)

6

Page 7: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

31 N1(-b2)= 0.3402 =NORMSDIST(-B21)

32 ρ= -0.74536 =-SQRT(B10/B9)

33 a = a1;b = -b1    

34 Φ(a,-b;-ρ)= 0.20259 =phi(-B20,0,-B37)

35 Φ(-a,b;-ρ)= 0.04084 =phi(-B18,0,-B36)

36 ρab= 0.87002 =((B32*B18-(-B20))*IF(B18>=0,1,-1))/SQRT(B18^2-2*B32*B18*-B20+(-B20)^2)

37 ρba= -0.31979 =((B32*-B20-(B18))*IF(-B20>=0,1,-1))/SQRT(B18^2-2*B32*B18*-B20+(-B20)^2)

38 N2(a,0;ρab)= 0.45916 =bivarncdf(B18,0,B36)

39 N2(b,0;ρba)= 0.11092 =bivarncdf(-B20,0,B37)

40 δ= 0.5 =(1-IF(B18>=0,1,-1)*IF(-B20>=0,1,-1))/4

41 a = a2;b = b2    

42 Φ(a,-b;-ρ)= 0.24401 =phi(-B21,0,-B45)

43 Φ(-a,b;-ρ)= 0.02757 =phi(-B19,0,-B44)

44 ρab= 0.94558 =((B32*B19-(-B21))*IF(B19>=0,1,-1))/SQRT(B19^2-2*B32*B19*-B21+(-B21)^2)

45 ρba= -0.48787 =((B32*-B21-(B19))*IF(-B21>=0,1,-1))/SQRT(B19^2-2*B32*B19*-B21+(-B21)^2)

7

Page 8: By Cheng Few Lee Joseph  Finnerty John Lee Alice C Lee Donald  Wort

46 N2(a,0;ρab)= 0.47243 =bivarncdf(B19,0,B44)

47 N2(b,0;ρba)= 0.09619 =bivarncdf(-B21,0,B45)

48 δ= 0.5 =(1-IF(B19>=0,1,-1)*IF(-B21>=0,1,-1))/4

49      

50 N2(a1,-b1;ρ)= 0.07007 =bivarncdf(B18,-B20,B32)

51 N2(a2,-b2;ρ)= 0.06862 =bivarncdf(B19,-B21,B32)

52      

53 c(value of European call option to buy one share) 2.40123 =B5*NORMSDIST(B16)-B6*EXP(-B7*B9)*NO

RMSDIST(B17)

54 p(value of European put option to sell one share) 1.44186 =-B5*NORMSDIST(-B16)+B6*EXP(-B7*B9)*NO

RMSDIST(-B17)

55 c(value of American call option to buy one share) 3.08238

=(B3-B11*EXP(-B7*B10))*(NORMSDIST(B20)+bivarncdf(B18,-B20,-SQRT(B10/B9)))-B6*EXP

(-B7*B9)*(NORMSDIST(B21)*EXP(B7*(B9-B10))+bivarncdf(B19,-B21,-SQRT(B10/B9)))+B11*EX

P(-B7*B10)*NORMSDIST(B21)

8