MAFS6010R留学生辅导、辅导R编程设计、Portfolio Optimization讲解、讲解R设计

- 首页 >> Algorithm 算法

Homework 1

file:///C:/Users/Administrator/Documents/WeChat%20Files/littlecharmingprince/Files/HW1.html 1/3

Homework 1

MAFS6010R- Portfolio Optimization with R

MSc in Financial Mathematics

Fall 2018-19, HKUST, Hong Kong

Prof. Daniel P. Palomar

Hong Kong University of Science and Technology (HKUST)

Shrinkage estimator for \(\boldsymbol{\mu}\)

After Week 5 on shrinkage and the Black-Litterman model, you have learned how to improve the naive

estimation of \(\boldsymbol{\mu}\) and \(\boldsymbol{\Sigma}\) (i.e., the sample mean and sample covariance

matrix, respectively). In particular, we have seen that the estimation error in \(\boldsymbol{\mu}\) is much

more signicative

than that of \(\boldsymbol{\Sigma}\).

The purpose of this homework is to explore the possible improvements on the estimation of \

(\boldsymbol{\mu}\).

Outline

Step 1: Load market data (you can also start with synthetic data, but eventually you need to try with real

market data).

Step 2: Compute the sample mean estimator for \(\boldsymbol{\mu}\) and evaluate its performance by

computing the estimation error compared to the real parameter (in case of synthetic data) or the sample

estimation from the test data (in case of real data).

Step 3: Design the Markowitz mean-variance portfolio based on the sample mean estimator for \

(\boldsymbol{\mu}\) and the sample covariance matrix estimator for \(\boldsymbol{\Sigma}\). Evaluate it and

plot its performance.

Step 4: Consider some way to improve the estimation of \(\boldsymbol{\mu}\). For example, you could try the

James-Stein estimator (but have some imagination for the target) or the Black-Litterman model (but have

some imagination for the views).

Step 5: Evaluate its performance by computing the estimation error compared to the real parameter (in case

of synthetic data) or the sample estimation from the test data (in case of real data). Compare with the

estimation error in Step 2.

Step 6: Design the Markowitz mean-variance portfolio based on your estimator for\(\boldsymbol{\mu}\) and

the sample covariance matrix estimator for \(\boldsymbol{\Sigma}\). Evaluate it and plot its performance.

Compare with the performance in Step 3.

Step 7: Try more ideas. You will get additional points if you can clarify some different methods from class.

10/16/2018 Homework 1

file:///C:/Users/Administrator/Documents/WeChat%20Files/littlecharmingprince/Files/HW1.html 2/3

Hint: There are tons of R packages improving estimation for mean and covariance matrix. Figure out what

they are doing by tracking their references. Some prior knowledge like sector information (partially available

via function getSectorInfo() in package covFactorModel ) could be helpful. Clarify your method even if it is

heuristic because we will count if you can make it reasonable.

Format for homeworks in R Markdown

Use the R Markdown (http://rmarkdown.rstudio.com/index.html) format (with le

extension .Rmd) to prepare

your homework. It is an extremely versatile format that allows the combination of formattable text,

mathematics based on Latex codes, R code (or any other language), and then automatic inclusion of the

results from the execution of the code (plots or just other type of output). This type of format also exists for

Python and they are generally referred to as Notebooks and have recently become key in the context of

reproducible research (because anybody can execute the source .Rmd le

and reproduce all the plots and

output). This document that you are now reading is an example of an R Markdown script.

R Markdown les

can be directly created or opened from within RStudio. To compile the source .Rmd le,

just

click the button called Knit and an html will be automatically generated after executing all the chunks of code

(other formats can also be generated like pdf).

The following is a simple template that can be used to prepare the homework and projects in this course:

10/16/2018 Homework 1

file:///C:/Users/Administrator/Documents/WeChat%20Files/littlecharmingprince/Files/HW1.html 3/3

---

title: "Title"

subtitle: "Subtitle"

author: "Author"

date: '2018-10-09'

output: html_document

---

Summary of this document here.

# First header

## First subheader

# Second header

* bullet list

* bullet list

- more

- more


This is a link: [R MArkdown tutorial](http://rmarkdown.rstudio.com)

```r

# here some R code

```

For more information on the R Markdown formatting:

R Markdown tutorial (http://rmarkdown.rstudio.com)

R Markdown Cheat Sheet (https://www.rstudio.org/links/r_markdown_cheat_sheet)

R Markdown Reference Guide (https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdownreference.pdf)


站长地图