Jensen's Alpha and Performance Analytics package

Hello community,

I am fairly new to R and specially finance R, and I keep being stuck with an R mistake. I'm trying to compute Jensen's alpha for a fund (named A, imported XLS), using the Oslo Ex. Benchmark Index (OSEBX), the NIBOR interest level and the PerformanceAnalytics package (CAPM.jensenAlpha).

I already had problems with the data types, so I converted everything to timeSeries format and gave it the same row names, but when executing I get a bunch of NAs (additional question, can I use a time series for the Rf, or does it have to be constant?).

Code

library(PerformanceAnalytics)
library(quantmod)

data_ose <- BatchGetSymbols(tickers = "OSEBX.OL",
first.date = "1993-03-01",
last.date = "2003-03-04",
freq.data = "monthly",
do.cache = FALSE,
thresh.bad.data = 0)

OSEBX_rtn <- data_ose$df.tickers$ret.adjusted.prices

OSEBXrtn_ts <- timeSeries(OSEBX_rtn)
nibor_ts <- timeSeries(nibor)
A <- timeSeries(Funds_data$A)

row.names(A) <- Funds_data$Date
row.names(OSEBXrtn_ts) <- Funds_data$Date
row.names(nibor_ts) <- Funds_data$Date

CAPM.jensenAlpha(A,OSEBXrtn_ts,nibor_ts)

Outcome for a time series Rf
Captura de Pantalla 2021-11-09 a les 14.20.11

I'd really appreciate if someone could give me a hand.

Thanks.

Hi,

object 'nibor' not found

nibor isn't in your example. Nor is Funds_data. Can you provide examples of these and anything else needed?

What other packages are loaded? I assume BatchGetSymbols. Not sure where timeSeries() is from but ts seems to be the same.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.