CRSP留学生程序 辅导、 写作R程序设计程序

CRSP留学生作业 辅导、 写作R程序设计作业、 辅导R语言作业、 写作data课程作业
This problem uses the SP500 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 le gives the simple return rt = Pt/Pt1 1. Suppose at the end of 1957/12, John invested $1000 on SP500 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 Johns wealth at time t. For example, W1 = 1000(1 + r1). At the month t, Johns 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 Johns 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 Johns wealth W744.
(c) From now on John is not a Prophet, so he tried to do some predictions. Suppose Johns 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 Johns wealth W744.
(d) Use the arima() function to t an AR(1) model to the whole data. Report the tted models and its AIC value.
(e) Use the arima() function to t an MA(1) model to the whole data. Report the tted models and its AIC value.
(f) Use the arima() function to t an ARMA(1,1) model to the whole data. Report the tted 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 ve years (from t59 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 Johns wealth W744.
(i) Comment on your ndings in (a), (b), (c) and (h).

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导