程序代写案例-MFIT5009

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
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 (45 points)
Please read this website carefully before you start solving the problems.
(a) Solve the following optimization problem:
maximize
Σ
wTΣw
subject to Ljk ≤ Σjk ≤ Ujk, j, k = 1, . . . , n.
Here, we consider
w =
0.10.2
0.5
 , L =
 0.2 0.1 0.1−0.5 0.1 0.2
−0.3 0.1 0.1
 , U =
 0.2 0.7 0.40.4 0.1 0.5
−0.1 0.5 0.7
 .
Please show the optimal value of Σ and all the code you use to solve the problem.
(b) Solve the following optimization problem:
minimize
X∈Sn+
λmax(X)− λmin(X)
subject to trace (AX) = 1.
Here, we consider
A =

91 83 85 54
83 102 84 56
85 84 150 72
54 56 72 52
 .
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
x∈R
maxi{aix+ bi},
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
x∈R
t
subject to t ≥ aix+ bi, i = 1, . . . , 5.
1
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.
Problem 2: Practice with key packages for finance (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.
Problem 3: Elastic net regularization (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
βˆ = arg min
β
(
f(β) + λ1‖β‖1 + λ2‖β‖22
)
,
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β‖22
where y ∈ Rn, X ∈ Rn×p, and β ∈ Rp. Please find the data of X and y with n = 500 and p = 200 via Canvas,
solve the problem with different values of (λ1, λ2), then fill in the table by computing
p∑
i=1
I (|β?i | ≤ ) ,
where β? is the corresponding optimal solution, is set to be 10−3, and the indicator function is defined as
I(|β?i | ≤ ) =
{
1 if |β?i | ≤ ,
0 otherwise.
λ1 = 10
0 λ1 = 10
2 λ1 = 10
4 λ1 = 10
6
λ2 = 10
0
λ2 = 10
2
λ2 = 10
4
λ1 = 10
6

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468