当我运行下面的代码时,我的 CAPM.beta.bull 函数正常工作,但返回 CAPM.beta.bear 和 TimingRatio 的错误
library(PerformanceAnalytics)
library(quantmod)
getSymbols("AAPL", from="2012-01-01", to="2015-01-01")
getSymbols("SPY", from="2012-01-01", to="2015-01-01")
stockbull = function(call){
CAPM.beta.bull(Ad(call), Ad(SPY) , Rf=0)
}
stockbear = function(call){
CAPM.beta.bear(Ad(call), Ad(SPY), Rf=0)
}
stocktiming = function(call){
TimingRatio(Ad(call), Ad(SPY) , Rf=0)
}
我正在运行 R 3.1.3,这是我产生的错误,任何帮助将不胜感激。
> stockbull(AAPL)
[1] 0.3041228
> stockbear(AAPL)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases
> stocktiming(AAPL)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases