CS代考程序代写 finance python MFIT5009: Optimization in Fintech (Due: 27/02/2021) Homework #1

MFIT5009: Optimization in Fintech (Due: 27/02/2021) Homework #1
Instructor: Daniel Palomar
Name: Student name(s), Netid: NetId(s)
Course Policy: Read all the instructions below carefully before you start working on the assignment and before you make a submission.
􏰀 Please typeset your submissions in LATEX, RMarkdown or Jupyter notebook. Please include your name and student ID with submission. Submit your homework in the form of pdf or html via Canvas.
􏰀 Assignments are due by 11:59 pm of February 27th.
􏰀 No cheating will be tolerated, so make sure you complete the homework on your own.
􏰀 Only R and Python are allowed for the implementation. You should also show the code for how to generate the function and remember to set seed if needed so that your code can be replicated.
Problem 1: Practice with Solvers
Please read this website carefully before you start solving the problems. (a) Solve the following optimization problem:
Here, we consider
maximize
Σ
subject to
wT Σw
Ljk ≤ Σjk ≤ Ujk,
j,k = 1,…,n.
0.1
0.5 −0.3 0.1 0.1 −0.1 0.5 0.7
 0.2 0.7 0.4 w=0.2, L=−0.5 0.1 0.2, U=0.4 0.1 0.5.
Please show the optimal value of Σ and all the code you use to solve the problem. (b) Solve the following optimization problem:
Here, we consider
minimize λmax(X) − λmin(X) X∈S+n
subject to trace (AX) = 1.
91 83 85 54 A=83 102 84 56.
85 84 150 72 54 56 72 52
 0.2 0.1 0.1
Please show the optimal value of X and all the code you use to solve the problem.
(c) Solve the unconstrained optimization problem with piecewise-linear objective function
minimize maxi{aix + bi}, x∈R
where a = (a1,a2,a3,a4,a5) = (−2,−4,−8,1,3) and b = (b1,b2,b3,b4,b5) = (−1,−6,−1,−1,−12). Compare the results with the solution of following optimization problem:
minimize t x∈R
subjectto t≥aix+bi, i=1,…,5. 1
(45 points)

Student name(s) – Homework #1 2 Please show the optimal value of x for both problems and all the code you use to solve the problem.
(25 points)
In this problem we need to import SP500 index from Jan 3, 2005 to Dec 31, 2016.
(a) Convert daily data to monthly data by the index to the first day of the month. Then plot the corresponding monthly prices using ‘ggplot2’.
(b) Compute the 10-day simple moving average and 10-day exponential moving average for daily closing prices, draw them on the same figure.
(30 points)
In statistics, the Elastic net uses a regularization that linearly combines the L1 and L2 penalties. The es- timates from the elastic net method can be denoted as
βˆ =argmin􏰁f(β)+λ1∥β∥1 +λ2∥β∥2􏰂, β
where f(β) is the loss function without regularization subject to the optimization variable β and λ1,λ2 are the coefficients to control the magnitude of penalty. Now we consider a linear model with
f(β) = ∥y − Xβ∥2
wherey∈Rn,X∈Rn×p,andβ∈Rp. PleasefindthedataofXandywithn=500andp=200viaCanvas,
solve the problem with different values of (λ1,λ2), then fill in the table by computing
p
􏰄I(|βi⋆| ≤ ε), i=1
where β⋆ is the corresponding optimal solution, ε is set to be 10−3, and the indicator function is defined as
⋆ 􏰃1 if|βi⋆|≤ε, I(|βi | ≤ ε) = 0 otherwise.
Problem 2: Practice with key packages for finance
Problem 3: Elastic net regularization
λ1 = 100
λ1 = 102
λ1 = 104
λ1 = 106
λ2 = 100
λ2 = 102
λ2 = 104
λ1 = 106