Expand a Variance Matrix to Include a Benchmark
Takes a variance matrix (or 3-dimensional array) and a vector of weights for the benchmark. An object like the input is returned which includes a new asset representing the benchmark.
A variance matrix or a three-dimensional array
where each slice of the third dimension is a variance matrix.
This must have dimnames which specify the assets, and it must
include all of the assets named in
required. A named vector giving the weights of the constituents of the benchmark.
character string to be used as the asset name for the benchmark.
logical vector stating whether to check and enforce that
a matrix or array similar to the input
variance, but including
an additional asset.
The (absolute value of) the weights ideally sum to one. You can give it weights that do not sum to one (perhaps they sum to 100 or the market cap of the benchmark), but you will get a warning that the weights are being adjusted.
If your "benchmark" is something that doesn't sum to 1 (such as
portfolio weights minus benchmark weights), then set the
This help was last revised 2012 January 20.
1 2 3 4 5 6 7 8 9
## Not run: varian.ben <- var.add.benchmark(varian, ftse.constituents, "ftse100") ## End(Not run) var.orig <- array(c(400, 32, 24, 32, 64, 9.6, 24, 9.6, 144), c(3,3), list(c("equities", "bonds", "commodities"), c("equities", "bonds", "commodities"))) var.aa <- var.add.benchmark(var.orig, c(equities=.6, bonds=.4), "e60b40")
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.