程序代写代做代考 1 Answer to Bonus Question 2

1 Answer to Bonus Question 2
(i) Let Ri be the random variable containing the returns of stock i. We wish to choose weights wi such that:
E(􏰃 wiRi) = 􏰃 wiE(Ri) = 1.1 ii
This is a linear constraint on the wi.
Var(􏰃wiRi) = 􏰃􏰃wiwjCov(Ri,Rj)
iij
(Here I’m writing Cov(X,X):=Var(X)). This is a quadratic function in the wi. Thus this is a quadratic programming problem.
Writing μ for the vector of returns, w for the vector of weights and Σ for the covariance matrix we can write this completely explicitly as:
subject to
minimize wT Σw w.μ = 1.1
(ii) The efficient frontier is a plot of the maximum expected return for a given variance plotted against the variance. A single stock is a point on the inside of the ”bullet”. See the notes for a picture.
(iii) One can simulate the stock prices by, for example, using the Euler method. Given a set of investment weights one can simulate a large number of investment outcomes. Taking the mean of the realised utility, one obtains an estimate for the expected utility. This allows one to write a function that takes a choice of investment weights and returns the expected utility. One could then use fmincon or fminunc to find the optimal portfolio. Note that it is important to use the same Monte Carlo scenarios for each expected utility computation.
(iv) One can create convex combinations of two strategies where one invests a proportion p of one’s wealth in strategy S1 and a proportion 1 − p in S2. Treating each strategy just as we treated individual stocks in the answer to the previous section we can then optimize over convex combinations of S1 and S2. The resulting strategy is guaranteed to be at least as good as S1 and S2.
2 Answer to Bonus Question 3
(i) I’m going to choose to write the expected utility in terms of the log of the stock price. This is because the log of the stock price obeys a simpler
1

process than the stock price. Write zt = log(St) dzt =(μ−1σ2)dt+σdWt
2
So zT is normally distributed with mean z0 + (μ − 1 σ2)T and standard
√2 deviation σ T.
Write p(z) for the p.d.f. of zT . We can write this explicitly as:
1 􏰔 (z−(z0+(μ−1σ2)T))2􏰕 p(z)=√ exp− 2
σ 2πT 2σ2T
The stock investment at time T has value Q exp(zT ). The bond invest-
S0
ment at time 0 is P −Q so it has value (P −Q)erT at time T. Hence:
􏶩∞Q
E(u) = u((P − Q)erT + S exp(z))p(z)dz
00
(ii) We use the fact that evaluating an integral by Monte Carlo is the same thing as running a simulation to justify simply simulating stock prices, computing the utility in each case then taking the average. See compute- UtilityByMonteCarlo.m
(iii) Antithetic sampling would improve the rate of convergence
(iv) Since bankruptcy is disallowed by the use of −∞ utility, we see that short selling either the bond or the stock is disallowed. So we have the trading constraints 0 ≤ Q ≤ P .
(v) I would use fmincon with objective function essentially given by compute- UtilityByMonteCarlo together with the constraint 0 ≤ Q ≤ P to find an optimal value for Q. See findOptimalQ.m. Note that it is important to use the same Monte Carlo scenarios each time the objective function is computed. One easy way to do this is by seeding the random number generator each time computeUtilityByMonteCarlo is called.
2