This is the first time I use the Package ‘PerformanceAnalytics’. I have a problem when it comes to use "Rf" (risk-free rate) when using the CAPM.beta. I use EONIA as a proxy for the risk free-rate. Here is my code :
library(zoo)
library(Quandl)
library(PerformanceAnalytics)
cac <- Quandl('YAHOO/INDEX_FCHI', start_date = '2014-01-01', end_date = '2016-01-01', type = 'zoo')
saf <- Quandl('YAHOO/PA_SAF', start_date = '2014-01-01', end_date = '2016-01-01', type = 'zoo')
eonia <-Quandl("BOF/QS_D_IEUEONIA", start_date = '2014-01-01', end_date = '2016-01-01', type = 'zoo')
safreturn <- Return.calculate(saf$Close, method = ("log"))
cacreturn <- Return.calculate(cac$Close, method = ("log"))
then when I try to use the CAPM.beta() function I get :
CAPM.beta(safreturn, cacreturn, eonia)
Error in NextMethod(.Generic) :
dims [product 523] do not match the length of object [266730]
I think that I understand that the problem comes from the length of Rf = eonia
.
I have noticed that even if the length of safreturn
and cacreturn
are not the same, if I put a random number for Rf
I can obtain a solution, but I need to use the daily rate of EONIA.
Can someone help me ? Thanks in advance :)