联系方式

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

您当前位置:首页 >> Algorithm 算法作业Algorithm 算法作业

日期:2020-03-15 04:59

This problem uses the S&P500 monthly return (of the valued weighted index constructed by CRSP), from 1958/01 to 2019/12. Please load the data using the following command

sp500=read.table("~/your file directory/sp500m_5819.txt",header=T)

In this problem we will consider several trading strategies based on time series methods. Let us use Pt to denote the value of the index at month t. Here t = 1 indicates 1958/01, and t = 744 means 2019/12. The second column of the data file gives the simple return rt = Pt/Pt−1 −1. Suppose at the end of 1957/12, John invested $1000 on S&P500 index, and he either sold or bought the index at the end of each month t. Let us use Wt to denote the dollar value of John’s wealth at time t. For example, W1 = 1000(1 + r1). At the month t, John’s wealth was Wt, and he had the following possible positions and actions.

(i) Suppose at month t, he held the index and continued to hold, then at time t + 1 his wealth is Wt+1 = Wt(1 + rt+1).

(ii) Suppose at month t, he held the index but decided to sell it, he would have the cash of amount Wt. At time t + 1, his wealth would be the same Wt+1 = Wt.

(iii) Suppose at month t, he had the cash of amount Wt, and decided to buy the index, then his wealth at month t + 1 would be Wt+1 = Wt(1 + rt+1).

(iv) Suppose at month t, he had the cash of amount Wt, and decided not to buy the index, then his wealth at month t + 1 would still be Wt+1 = Wt.

You should write your own R code to answer the following questions.

(a) If John did not do anything in between, what is the value of his wealth at 2019/12, i.e. what is W744?

(b) Suppose John is a Prophet, and knows exactly the return of next month. Here is John’s strategy: at month t, his wealth was Wt, and he looked at rt+1: if rt+1 > 0, he would either buy or hold the index (depending on his current position), so that his wealth at t+1 is Wt+1 = (1+rt+1)Wt; and if rt+1 <= 0, he would either hold the cash or sell the index to get the cash, so that his wealth at time t + 1 is still Wt+1 = Wt. Calculate John’s wealth W744.

(c) From now on John is not a Prophet, so he tried to do some predictions. Suppose John’s strategy is as follows. At time t, his wealth is Wt. He either had the cash or held the index at time t. He looked at rt, if rt ≥−0.05, he would held or bought (depending on his current position) the index, so that his wealth at t + 1 is Wt+1 = (1 + rt+1)Wt; and if rt+1 < −0.05, he would either hold the cash or sell the index to get the cash, so that his wealth at time t + 1 is still Wt+1 = Wt. Calculate John’s wealth W744.

(d) Use the arima() function to fit an AR(1) model to the whole data. Report the fitted models and its AIC value.

(e) Use the arima() function to fit an MA(1) model to the whole data. Report the fitted models and its AIC value.

(f) Use the arima() function to fit an ARMA(1,1) model to the whole data. Report the fitted models and its AIC value.

(g) Suppose John did not do anything for 5 years, what is his wealth at 1962/12, i.e. what is W60?

(h) Suppose John did not do anything but held the index until 1962/12, and then used the following strategy starting from 1962/12. For each time t such that 60 ≤ t ≤ 743, he used the returns of past five years (from t−59 to t) to build an AR(1) model, and used it to predict the return at time t + 1. Denote the prediction by ˆ rt(1). If ˆ rt(1) ≥−0.05, he would held or bought (depending on his current position) the index, so that his wealth at t + 1 is Wt+1 = (1 + rt+1)Wt; and if ˆ rt(1) < −0.05, he would either hold the cash or sell the index to get the cash, so that his wealth at time t + 1 is still Wt+1 = Wt. Calculate John’s wealth W744.

(i) Comment on your findings in (a), (b), (c) and (h).


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

python代写
微信客服:codinghelp