Description Usage Arguments Value Examples
View source: R/makeExcessReturns.R
This function just strubtracts the returns of benchmark
from the
returns of assets
. It's just a convenience function for generating
excess returns. benchmark
is typically passes as the risk-free rate.
1 | makeExcessReturns(assets, benchmark)
|
assets |
the xts object of asset returns. |
benchmark |
the xts object of benchmark returns. |
an xts object of excess returns defined as asset - benchmark
1 2 3 4 5 6 7 8 9 10 | dts.asset <- seq(Sys.Date()-49, Sys.Date(), 1)
ret.asset <- matrix(rep(.05,50),ncol = 1)
asset.xts <- xts(ret.asset, dts.asset)
dts.benchmark <- seq(Sys.Date()-49, Sys.Date(), 1)
ret.benchmark <- matrix(rep(.03,50),ncol = 1)
benchmark.xts <- xts(ret.benchmark, dts.benchmark)
# Should return .02 everywhere...
makeExcessReturns(assets = asset.xts, benchmark = benchmark.xts)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.