function CAPM.jensenAlpha works weird when Rf is a vector
Opened this issue · 1 comments
lhloki commented
According the code, the Jensen's alpha is calculated with accumulated return in the following formula
result = Rp - Rf - CAPM.beta(Ra, Rb, Rf) * (Rpb - Rf)
Yet, if Rf is feed with a time series, which is normal in practical application, a same size of vector will be returned instead of a single value which is expected in general. Again if Rp is the accumulated return of Ra, we have the same reason to expect that Rf should be the the accumulated return of risk-free interest rate.
lhloki commented
I believe the same issue exists in the MSquared function too. Either narrow down the acceptable Rf to a constant factor or replace Rf by its accumulated return should solve the problem