Add benchmark to variance matrix

Task

Include a benchmark as an asset in a variance matrix given the variance matrix and the benchmark weights of assets contained in the variance matrix.

Preparation

  • variance matrix
  • benchmark weights
  • BurStFin package

You need a variance matrix and a vector of the weights of assets in the benchmark.  The names of the weight vector need to be the asset identifiers that match those used in the variance.

You also need the BurStFin package available in the session:

require(BurStFin)

The command above assumes the package is installed.

Doing the example

Doing it

In a real case, you need the weights for the benchmark.  For this example, we will create a vector of weights which will be for an equal-weight benchmark.

> dim(xaLWvar06)
[1] 350 350
> benwt <- rep(1/350, 350)
> names(benwt) <- rownames(xaLWvar06)

Now we create the bigger variance matrix that includes the benchmark:

> xaLWvar06EqWt <- var.add.benchmark(xaLWvar06, benwt, name="EqWt")
> dim(xaLWvar06EqWt)
[1] 351 351

Explanation

The var.add.benchmark function from the BurStFin package takes a variance matrix and a vector of weights of the assets in the variance matrix.  It then returns a variance matrix that has the additional asset of the benchmark, which is identified via the name argument.

The vector of benchmark weights doesn’t need to contain all of the assets that are in the variance matrix, nor be in the same order.  However, it is an error if there is an asset in the weight vector that is not in the variance.

Further details

An alternative approach to adding a benchmark to a variance is to just use the benchmark return series as another asset when the variance is built.  This is much less accurate than what is done here.  There are two reasons:

  • benchmark weights and composition change over time
  • the variance estimate is an approximation

When the benchmark weights are used to build the covariances with other assets, the errors in the variance matrix approximation cancel out.

Troubleshooting

  • The weights are expected to sum to (close to) either 1 or 100.

See also

To get a variance matrix given a matrix of returns, see “Returns to variance matrix”.

Navigate