R Analysis ProjectR

Java Python 

R Analysis Project [15 marks]

Please finish the tasks according to the requirements. All the tasks need to be finished by using R. Present your results in the word file, copy and paste all your R code in the end of this word file, and then submit your word file via the Turnitin link in iLearn.

Task: Stock Return and Portfolio Analysis

In the file named as “Stock.csv”, you have been provided with the daily prices of three stocks from 2012 to 2018.

a. Pls plot the daily prices of three stocks (either in one figure or three separate figures). Pls include date information and make relevant title and legend.                       [1.5 mark]

b. Calculate the daily log returns of all the three stocks and express them in percentages.

Pls report the descriptive statistics of log returns of three stocks in Table 1. Pls change the names in Table 1 to the stock names in your file. [note: SD stands for standard deviation; and N stands for number of observations]    [1 mark]

Table 1: Summary Statistics

Variable

Stock 1

Stock 2

Stock 3

Min

 

 

 

Max

 

 

 

Mean

 

 

 

Median

 

 

 

SD

 

 

 

Skewness

 

 

 

Kurtosis

 

 

 

N

 

 

 

c.  Pls report the correlation matrix of log returns of three stocks in Table 1. Pls chan R Analysis ProjectR ge the names in Table 1 to the stock names in your file.    [1 mark]

Table 2: Correlation Matrix

Variable

Stock 1

Stock 2

Stock 3

Stock 1

 

 

 

Stock 2

 

 

 

Stock 3

 

 

 

d. There is a file named as “FF3factors.csv” in your folder. Merge your stock return data with the Fama French three factors data, which are all in percentages.  Pls create a new variable StockR for all the three stocks, which equals to the difference between daily log return of each stock and RF (available in the FF3factors.csv), and run a regression of:

StockR = α + βMktR + u,

where MktR is the daily market excess return. Report the regression results for all the three stocks in tables (you can use only one table to summarize all the results or use three separate tables). [1.5 mark]

e. Plot the time-varying betas of these three stocks separately or together. To calculate the time-varying beta, use a 252-day fixed window.  In the plot, the X-bar should be the date of the last day in the fixed window. For instance, if this window covers from day 1 to day 252, use the date of day 252 to label the beta estimated in this window, and so on so forth.     [1.5 mark]

f. Pls run regressions of :

StockR = α + β1MktR + β2SMB + β3HML + u.

        Report the regression results for all the three stocks in tables (you can use only one table to summarize all the results or three separate tables). [1.5 mark]

g. Pls make your comments by comparing the results in c and d.  [1 mark].

[Hint: which model can fit the data better?]

h. If an investor would like to form. a portfolio with a targeted expected return of 0.05% and achieve the minimized standard deviation by investing in these three stocks in the “Stock.csv” file. If the daily risk free rate is 0.02%, what is the Sharpe ratio of this optimal portfolio, given there is no short sale constraint? [1mark] [hint: can use the library of “quadprog”]

i. If an investor would like to form. a portfolio with a targeted expected return of 0.05% and achieve the minimized standard deviation by investing in these three stocks. If the daily risk free rate is 0.02%, what is the Sharpe ratio of this optimal portfolio, given there is short sale constraint (i.e., you cannot short sell the stocks)? [1 mark] [hint: can use the library of “quadprog”]

j. By comparing your answer in g) and h), is there any difference in their Sharpe ratios? Why that’s the case? [1 mark]

k. Given there is no short sale constraint, pls draw an efficient frontier that satisfies the following conditions: 1. The range of the mean return of the portfolio is from 0.75*min of the mean return of three stocks to 1.25*max of the mean return of three stocks; 2. Pls create 500 optimal portfolios in this range; 3. Then pls plot all the risk-return combination of the 500 optimal portfolios (i.e., the efficient frontier). [1 mark]

l. Following j, pls draw the Capital Allocation Line that connects the risk-free rate and the Tangency portfolio. What’s the slope of this CAL? [1 mark]

m. An investor invests 30% in the risk free rate and 70% in the tangency portfolio. Calculate the expected return and standard deviation of this complete portfolio         

  • 17
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值