CAPM.beta rollapply
问题 I have already successfully calculated my rolling correlations in my xts object with x <- cbind(market_return,stock_returns) rollcor_3year <- rollapplyr( x, width=width_cor,function(x) cor(x[,1],x[,-1], use="pairwise.complete.obs"),by.column=FALSE) The correlation was later used to calculate rolling Betas. Now I found the function CAPM.beta from the PerformanceAnalytics package and I wonder why I cannot use beta <- rollapplyr(x,width=width_cor,function(x) CAPM.beta(x[,1],x[,-1]),by.column