CS代考程序代写 matlab finance algorithm MATH 11158 : Optimization Methods in Finance
MATH 11158 : Optimization Methods in Finance
Lab 6 : Stochastic Programming
Thomas Byrne Joshua Fogg Akshay Gupte Vadim Platonov Josaine Zarco Roldan
25 February 2021
Part I : Theoretical Exercises
Question 1 (Stochastic Gradient Method). Take the risk-neutral stochastic portfolio (investment) problem from week 5. The general formulation is
minz(x):=c⊤x+EQ(x,ω) s.t. x∈X x
where c is the expense ratio (investment cost), x is the portfolio, X = {x ≥ 0: ni=1 xi = 1} is the set of feasible portfolios, and the recourse function Q(x, ω) is given by
Tn
Q(x,ω)=minbtyt(ω) s.t. ri,t(ω)xi+yt(ω)≥Rt,t=1,…,T, yt≥0∀t.
y
t=1 i=1
Here, b is the penalty cost on shortfall and y is the shortfall variable. Derive expressions for the partial derivatives ∂Q and ∂z .
Part II : Computational Exercises
Question 2. Take the first question and consider the example when we have the same data as in the lecture slides. Compute the values of the partial derivatives at the portfolio x = (0.25, 0.75) and with scenarios ω that yield the returns r1,1 = 1.5, r1,2 = 3.1, r2,1 = 4.2, r2,2 = 1.3.
Question 3 (k-means clustering). Download mykmeans.m and lab6clustering.m files from Learn. The first file is a function for the k-means clustering algorithm (this code is different than the in-built algorithm in Matlab). The second file is a script that generates a random set of points in 2D with 5 “natural” clusters and then uses the k-means clustering algorithm to attempt to identify the clusters.
1. Read mykmeans.m function in detail. Try to understand as many details as you can. Compare the code with the lecture slides covering the topic.
2. Run the script lab6clustering.m repeatedly and observe that the result changes. Why so? You should link this with what was covered in a lecture. Note that the colours of the individual points correspond to the distribution that generated the point, not to the cluster that they have been assigned to.
3. Run the script repeatedly with varying values of the parameters u (1 to 100) – number of data points in each cluster – and r (0.1 to 3) – standard deviation of each cluster. See what happens. Do you recover the 5 clusters the data points are coming from?
∂xi ∂xi
Page 1