SOLUTIONS MOCK EXAM 2021
Question1:
(a) See Exercise 2 Tutorial 1.
(b)
> v1 <−runif (6 ,−5 ,5)
> v1
[ 1 ] −3.534955 −2.125690 −3.197416 −2.690970 1.171644 4.615299
> v2 <−runif (14 ,−5 ,5)
> v2
[ 1 ] −1.19118968 0.99891338 1.94085672 −4.69556951
3.59148792 0.02149171
[ 7 ] −2.65920813 4.52136889 −0.60572579 1.77306420 −0.71442411
4.73246855
[ 1 3 ] −1.71294960 −1.27886442
> Marray<−array (c ( v1 , v2 ) ,dim = c ( 3 , 6 , 3 ) )
> Marray
, , 1
[ , 1 ] [ , 2 ] [ , 3 ] [ , 4 ] [ , 5 ]
[ , 6 ]
[ 1 , ] −3.534955 −2.690970 −1.1911897 −4.69556951 −2.6592081
1.7730642
[ 2 , ] −2.125690 1.171644 0.9989134 3.59148792
4.5213689 −0.7144241
[ 3 , ] −3.197416 4.615299 1.9408567 0.02149171 −0.6057258
4.7324685
, , 2
[ , 1 ] [ , 2 ] [ , 3 ] [ , 4 ] [ , 5 ]
[ , 6 ]
[ 1 , ] −1.712950 −2.125690 1.171644 0.9989134 3.59148792
4.5213689
[ 2 , ] −1.278864 −3.197416 4.615299 1.9408567
0.02149171 −0.6057258
1
2[ 3 , ] −3.534955 −2.690970 −1.191190 −4.6955695 −2.65920813
1.7730642
, , 3
[ , 1 ] [ , 2 ] [ , 3 ] [ , 4 ] [ , 5 ]
[ , 6 ]
[ 1 , ] −0.7144241 −1.278864 −3.197416 4.6152986 1.940857
0.02149171
[ 2 , ] 4 .7324685 −3.534955 −2.690970 −1.1911897 −4.695570 −2.65920813
[ 3 , ] −1.7129496 −2.125690 1.171644 0.9989134 3.591488
4.52136889
> Marray [ , 2 , 1 ]
[ 1 ] −2.690970 1.171644 4.615299
> mean( v1 )
[ 1 ] −0.9603482
> print ( Marray [ , Marray [3 , ,3 ] >mean( v1 ) , 3 ] )
[ , 1 ] [ , 2 ] [ , 3 ] [ , 4 ]
[ 1 , ] −3.197416 4.6152986 1.940857 0.02149171
[ 2 , ] −2.690970 −1.1911897 −4.695570 −2.65920813
[ 3 , ] 1 .171644 0.9989134 3.591488 4.52136889
Question2:
(a)
> rA<−0 .11 # expec ted re turn o f s t o c k A
> rB<−0 .14# expec ted re turn o f s t o c k B
> rC<−0 .085# expec ted re turn o f s t o c k C
> sigA<−0 .30 # standard d e v i a t i on o f A
> s igB<−0 .45 # standard d e v i a t i on o f B
> s igC<−0 .30 # standard d e v i a t i on o f C
> sigmaAB<− sigA∗s igB∗0 .3 #
> sigmaAC<− sigA∗s igC∗0 .15 # covar iance between a s s e t s A and C
> sigmaBC<− s igB∗s igC∗0 .45 # covar iance between a s s e t s B and C
> rp<−function (wA,wB){
+ return (wA∗rA+wB∗rB+(1−wA−wB)∗rC)}
> rp (1/3 ,1/3)
[ 1 ] 0 .1116667
> varp<−function (wA,wB){
3+ return (wAˆ2∗sigAˆ2+wBˆ2∗s igBˆ2+(1−wA−wB)ˆ2∗s igCˆ2+
+ 2∗wA∗wB∗sigmaAB+2∗wA∗(1−wA−wB)∗sigmaAC+2∗wB∗(1−wA−wB)∗sigmaBC)
+ }
> sqrt ( varp (1/3 ,1/3) )
[ 1 ] 0 .2607681
> varp (1/3 ,1/3)
[ 1 ] 0 .068
> sigmap<−sqrt ( varp )
> plot ( sigmap , rp , pch=” . ” )
(b)
> r f<−0 .02
> amax<−max( ( rp−r f )/sigmap )# the p o s i t i v e tangency o f sharpe r a t i o
> amax
[ 1 ] 0 .3675796
> x<−seq (0 , 3 ,by=0.01)
> l ines (x , amax∗x+r f )
0.3 0.4 0.5 0.6 0.7 0.8
0.
05
0.
10
0.
15
0.
20
sigmap
rp
(c)
4> varp<−function (wA,wB){
+ return (wAˆ2∗sigAˆ2+wBˆ2∗s igBˆ2+(1−wA−wB)ˆ2∗s igCˆ2+
+ 2∗wA∗wB∗sigmaAB+2∗wA∗(1−wA−wB)∗sigmaAC+2∗wB∗(1−wA−wB)∗sigmaBC)
+ }
> wA<−seq (0 , 1 , by=0.001)
> WBn<−(1/ ( rB−rC ) )∗(0.12−rC−wA∗ ( rA−rC ) )
> Wamin<−match(min( varp (wA,WBn) ) , varp (wA,WBn) )
> wA[Wamin ]
[ 1 ] 0 .56
> WB1<−(1/ ( rB−rC ) )∗(0.12−rC−wA[Wamin ] ∗ ( rA−rC ) )
> WB1
[ 1 ] 0 .3818182
> WC1<−1−wA[Wamin]−WB1
> WC1
[ 1 ] 0 .05818182
Question3:
> bu i ld s tock t r e e<−function (S , u , d ,N){
+ t r e e=matrix (0 ,nrow=N+1, ncol=N+1)
+ for ( i in 1 : (N+1)){
+ for ( j in 1 : i ){
+ t r e e [ i , j ]=S∗uˆ( j −1)∗d ˆ( ( i −1)−( j −1))}}
+ return ( t r e e )}
> QM2<−function ( r , d e l t a t , u , d){
+ return ( (exp( r∗de l t a t)−d)/ (u−d ) )
+ }
> QM1<−function ( r , m, de l t a t , u , d){
+ return (((1+ r/m)ˆ(m∗de l t a t)−d)/ (u−d ) )
+ }
> Bin Op Pri2<−function ( t ree , d e l t a t , r1 , r2 , m, u , d , K){
+ D1<−(1+r1/m)ˆ(−m∗de l t a t )
+ D2<−exp(−r2∗de l t a t )
+ Q1<−QM1( r1 ,m, de l t a t , u , d )
+ Q2<−QM2( r2 , d e l t a t , u , d )
+ Q<−c (Q1,Q2)
+ D<−c (D1 , D2)
+ opt ion1 t r e e=matrix (0 , nrow=nrow( t r e e ) , ncol=ncol ( t r e e ) )
+ opt ion1 t r e e [nrow( opt ion1 t r e e ) , ]=pmax(2∗ (K−sqrt ( t r e e [nrow( t r e e ) , ] ) ) , 0)
5+ for ( i in (nrow( t r e e )−1):1){
+ for ( j in 1 : i ){
+ option1 t r e e [ i , j ]=max(max(2∗ (K−sqrt ( t r e e [ i , j ] ) ) , 0 ) ,
+ (Q[ i ] ∗opt ion1 t r e e [ i +1, j +1]+(1−Q[ i ] ) ∗opt ion1 t r e e [ i +1, j ] ) ∗D[ i ] )
+ }
+ }
+ return ( opt ion1 t r e e )
+ }
> Bin Op Pri va l<−function (S , T, r1 , r2 ,m, K, u , d ,N){
+ Q<−c (QM1( r1 ,m, de l t a t=T/N, u , d ) ,QM2( r2 , d e l t a t=T/N, u , d ) )
+ t r e e<−bu i ld s tock t r e e (S=S , u=u , d=d ,N=N)
+ opt ion<−Bin Op Pri2 ( t ree , d e l t a t=T/N, r1=r1 , r2=r2 , u=u ,m=m, d=d , K=K)
+ return ( l i s t (Q=Q, s tock=tree , opt ion=option , p r i c e=opt ion [ 1 , 1 ] ) )
+ }
> r e s u l t s 1<−Bin Op Pri va l (S=30, T=8/12 , r1 =0.05 , r2 =0.06 ,m=52,
+ u=1.15 ,d=0.8 ,K=6, N=2)
> r e s u l t s 1
$Q
[ 1 ] 0 .6194234 0.6291467
$ s tock
[ , 1 ] [ , 2 ] [ , 3 ]
[ 1 , ] 30 .0 0 .0 0 .000
[ 2 , ] 24 .0 34 .5 0 .000
[ 3 , ] 19 .2 27 .6 39 .675
$opt ion
[ , 1 ] [ , 2 ] [ , 3 ]
[ 1 , ] 1 .154789 0.0000000 0
[ 2 , ] 2 .202041 0.5426693 0
[ 3 , ] 3 .236439 1.4928596 0
$p r i c e
[ 1 ] 1 .154789
Question4:
(a)
> S<−c (50 ,50∗1 .08 ,50∗ 0 . 88 ) #(S(0) , uS (0) , dS (0) )
6> V<−c (max(S [2 ] −48 ,0) ,max(S [3 ] −48 ,0) )
> V
[ 1 ] 6 0
> QM<−function ( r , m, de l t a t , u , d){
+ return (((1+ r/m)ˆ(m∗de l t a t)−d)/ (u−d ) )
+ }
> Q<−QM( 0 . 1 , 1 2 , 3/ 1 2 , 1 . 0 8 , 0 . 8 8 )
> Q
[ 1 ] 0 .7260446
> D1<−function ( r ,m, de l t a t ){(1+ r/m)ˆ(−m∗de l t a t )}
> D<−D1( 0 . 1 , 12 , 3/12)
> D
[ 1 ] 0 .975411
> BinOpP<−(Q∗V[1]+(1−Q)∗V[ 2 ] ) ∗D
> BinOpP
[ 1 ] 4 .249151
> Del<−(V[1]−V[ 2 ] ) / (S [2]−S [ 3 ] ) # compute the d e l t a
> Del
[ 1 ] 0 . 6
(b) For the Hedging strategy, check similar argument as in Homework 5 question 3 (ii).
(c) Assume that C(0) = £4 ¡ £4.2. Then, the value of the option is too cheap
• At time t = 0, short sell 0.6 share and use the proceeds (0.6× 50 = £20) to buy a
call option at £4 and invest the rest 30-4=£26 at the risk free interest rate 10%.
• At time t = T = 3 months, there are two possible outcomes:
: S1(T ) = uS(0) = £48. The call option is exercised. The option buyer collects
26(1+ 0.1
12
)3 ' £26.655 representing the future value of £26 invested at the risk
free interest rate. She additionally short sale 0.4 stock at 54 × 0.4 = £21.6
and use the proceeds 26.655+21.6 = £48.255 to purchase one share at £48 and
close the short position in one share by returning it to the owner. By following
this strategy, there is a risk free profit of pounds 0.255.
: S2(T ) = dS(0) = £44. The option is not exercised. Collect 26(1 +
0.1
12
)3 '
£26.655 representing the future value of £16.5 invested at the risk free interest
rate. Buy 0.6 stock for 0.6 × 44 = £26.4 and close the short position in 0.6
stock by returning it to the owner. By following this strategy, there is a risk
free profit of pounds 26.655− 26.4 ' £0.255.
学霸联盟