联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> R语言程序R语言程序

日期:2023-03-18 07:56

STA2570 Winter 2023
Assignment 3
March 29, 2023
In the following, all backtests (simulation of portfolios) must be done using btest() which
was introduced in the class. You may use all codes and tools introduced in Chapter 15 of the
textbook [GMS]. Make and state any decisions about unspecified details.
1. (Rebalancing frequency) Consider weekly (adjusted closing) stock prices of Apple (AAPL)
[stock 1] and Nvidia (NVDA) [stock 2] from January 2000 to February 2023. Normalize the
prices such that the initial prices of both stocks are 1. We use the prices from January
2000 to December 2015 as training data. The rest will be used for testing.
(a) Let k ≥ 1 be an integer and α ∈ [0, 1]. These are the parameters. Implement a
strategy (using signal and other functions) which performs the following:
– The portfolio trades (rebalances) every k periods. [The portfolio is set up imme-
diately at time 1. So the second time it rebalances is 1 + k.]
– When it trades, it rebalances to the weights (α, 1? α).
(b) Consider k ∈ {1, 2, . . . , 52} and α ∈ {0, 0.05, . . . , 0.95, 1}. Using the training data,
find the values (k?, α?) of the parameters which maximizes the value of the ending
value (in December 2015). Also visualize the wealth processes of the portfolios using
a graph which is as informative as possible. [Imagine that you, as a portfolio analyst,
are going to report the results to portfolio managers.]
(c) Repeat (b) for the testing period and discuss the performance of the portfolio with
parameters (k?, α?) in the testing period.
2. (Mean-variance optimization) Pick arbitrarily 9 stocks in the S&P 500 index:
https://en.wikipedia.org/wiki/List_of_S%26P_500_companies
The 10th asset is the S&P 500 index itself; we use SPY which is a tradable proxy. The
requirement is that we have at least 20 years of data for all assets. (Note that some survival
bias is present here.) Download 20 years of monthly data. Implement the following two
strategies:
(i) At each time, use the last 5 years of data (previous 60 data points) to estimate the
expected return and covariance matrix (with the simple empirical average). Find the
long-only portfolio which minimizes
1
2
w>Σw ? μ>w.
(ii) Use the setting in (i) but compute the long-only minimum variance portfolio.
1
Thus each portfolio begins after observing 5 years of data. (See Section 15.4.3 of the book.)
(a) Visualize the value process of both portfolios.
(b) Visualize the portfolio weights of both portfolios over time and discuss their sensitiv-
ities over time.
(c) Compute the time series of drawdown for both portfolios.
3. (Single index model) Use the same data and setting in Problem 2. The single index model
is
Ri,t = αi + βiRm,t + i,t,
where Ri,t is the return of stock i at time t, Rm,t is the benchmark (market) return and
i,t is the noise (assumed to be uncorrelated across stocks). We let the benchmark be
S&P500. Within each 5-year window, estimate the parameters (for all stocks) using ordi-
nary least squares and use the results to estimate a covariance matrix Σ? (rather than using
the empirical average). Some details of the single index model may be found here: https:
//faculty.washington.edu/ezivot/econ424/singleindexslides.pdf. Note that here
the 10th asset is the benchmark; make necessary changes. Using Σ?, implement the mini-
mum variance portfolio as in (ii) in Problem 2. Compare (a)–(c) for the two portfolios.

版权所有:留学生编程辅导网 2021,All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。