Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Summer 2022 Timed R Coursework

ST330

Stochastic and Actuarial Methods in Finance

2021/22 syllabus only

Instructions to candidates

This paper contains two questions. Answer ALL TWO.

Question 1: 40 marks

Question 2: 60 marks

The marks in brackets relect marks for each part of a question.

Your work should show all steps and all results. R code should be included either as part of the .pdf ile you submit or as a separate .R or .Rmd ile. Any plots should be included in the .pdf ile. No iles other than .pdf, .R and .Rmd are acceptable.

Make sure your ve-digit candidate number and course code are written or included at the top of every page of your answers.

Time allowed    Reading Time:    None

Writing Time:      2 hours

Additional time for assessment upload: one hour

1.  Consider the CRR model with stock price S with value at time 0 given by S0  = 30. Over a single period, S can either move up to 40 or down to 20, with equal probability.  The (continuously compounded) interest rate is 10% in each period.

(a)  Use R to compute the risk neutral probability of an upward move.                [5 marks]

(b)  In the single period case, compute the value at time zero of a European put option with maturity T = 1 and strike price equal to the sum of 30 and the last digit of your candidate number.              [10 marks]

(c)  Consider now the six period case, where in each step the upward factor is 4/3 and downward factor is 2/3. You may use here the following function which generates the values of the stock at any time between t = 0 and t = 6.

Stocktree = matrix(0, nrow=7, ncol=7)

u = 4/3

d = 2/3

for (i in 1:7) {

for (j in 1:i) {

Stocktree[i,j] = 30 * u^(j-1) * d^((i-1)-(j-1))

}

}

Stocktree

i.  Use the Stocktree command to ind the mean of S6 .                              [5 marks]

ii.  Compute the value at any node of an American put option on S in this six-period model, with maturity T = 6 and strike price equal to the sum of 20 and the last digit of your candidate number.           [20 marks]

2.  This question concerns Brownian motion and the Black Scholes model.  Let S0   =  10,

T = 2, µ = 2 and σ 2 = 4 i.e. one risky asset which has value at time T given by ST  = S0e(µσ2 /2)T+σBT

where B denotes standard Brownian motion. Recall that BT follows a normal distribution with mean 0 and variance T.

(a) With the values µ,σ,T,S0 as deined use R to compute the mean m of X := log(ST) given by

m <- log(S_0)+(mu-sigma^2/2)T. [5 marks]

(b)  Use the dnorm command to plot the density dens of log ST on the domain deined by

x <- seq(-5,9,by=0.01).                                                                                  [10 marks]

(c)  Find the 5% quantile of log(ST). You may use the qnorm command for this. [5 marks]

(d)  Highlight in red on the plot the area under the density between the 10% and 80% quantiles. This can be done by following the plot command by

i <- x >=A & x <= B

polygon(c( A,x[i],B), c(0,dens[i],0), col="red") where A and B need to be speciied                [10 marks]

(e) Assume that for the risk free rate r we have r = 1 and consider a European call option on S with maturity T = 2 and strike price K equal to the sum of 10 and the last digit of your candidate number. You may use without proof any result derived in the lectures.

i.  Use R to ind the value at time 0 of this European call option.              [10 marks]

ii.  Now let S0 be general and plot the value at time 0 of this European call option as a function of S0 .           [10 marks]

iii.  Plot a graph of the gamma of this European call option.                        [10 marks]