Question: Modify this code that I can replace to compare to others companies but, no the portfolio. The code will provide to compare correlation between companies.

Modify this code that I can replace to compare to others companies but, no the portfolio. The code will provide to compare correlation between companies.

Table_cor <- Monthly_Ret_Join %>%

group_by(symbol) %>%

summarise(Num_of_Months=n(),

mRet_Mean=mean(mRet, na.rm= TRUE),

mRet_SD=sd(mRet, na.rm= TRUE),

Rb_SD=sd(Rb, na.rm= TRUE),

Cov_mRet_Rb=cov(x=mRet,y=Rb, use="pairwise.complete.obs"),

Cor_mRet_Rb=cor(x=mRet,y=Rb, use="pairwise.complete.obs"),

Cor_mRet_Rb2=Cov_mRet_Rb/(mRet_SD*Rb_SD))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!