cov.shrink {tawny}R Documentation

Shrink the covariance matrix towards some global mean

Description

This performs a covariance shrinkage estimation as specified in Ledoit and Wolf. Using within the larger framework only requires using the getCorFilter.Shrinkage function, which handles the work of constructing a shrinkage estimate of the covariance matrix of returns (and consequently its corresponding correlation matrix).

Usage

cov.shrink(h, ...)
## Default S3 method:
cov.shrink(h, ...)
## S3 method for class 'returns':
cov.shrink(h, prior.fun = cov.prior.cc, ...)
## S3 method for class 'covariance':
cov.shrink(h, T, constant.fun, prior.fun = cov.prior.cc, ...)
## S3 method for class 'correlation':
cov.shrink(h, ...)

cov.sample(returns)

cov.prior.cc(S)

cor.mean(S)

shrinkage.intensity(returns, prior, sample)

shrinkage.p(returns, sample)

shrinkage.r(returns, sample, pi.est)

shrinkage.c(prior, sample)

Arguments

returns A zoo object of returns. This is TxM
sample The sample covariance matrix (synonomous to S)
prior The shrinkage target covariance matrix (synonomous to F)
prior.fun Generates the prior/model covariance matrix
constant.fun Use this function to calculate the shrinkage constant
S The sample covariance matrix
T Length of returns series used in scaling of shrinkage coefficient
pi.est The estimate returned from shrinkage.p
h A generic tawny object representing either a returns, covariance, or correlation matrix
... Additional parameters to pass to prior.fun

Details

Most of the code related to the shrinkage estimator is tied to calculating a value for the shrinkage coefficient. The remainder of the code shrinks the sample covariance matrix towards the target. In addition, there is a function generator used in conjunction with the optimizePortfolio process to produce a correlation matrix based on the shrinkage.

Value

Scalars are produced by all of the shrinkage.* functions, resulting in the final shrinkage coefficient, calculated by shrinkage.intensity.
The cov.sample function calculates the sample covariance matrix and is MxM.
The cov.shrink function produces the shrunk version of the covariance matrix and has the same dimensions as the sample covariance matrix.
The cor.mean function calculates the constant correlation used in estimating the global mean (aka the shrinkage target) produced by cov.prior.cc.

Author(s)

Brian Lee Yung Rowe

See Also

tawny, optimizePortfolio

Examples

  # Estimate the covariance matrix based on the given asset returns
  data(sp500.subset)
  ys <- sp500.subset
  S.hat <- cov.shrink(ys)

  # Optimize the portfolio weights using the shrinkage estimator
  ws <- optimizePortfolio(ys, 150, getCorFilter.Shrinkage())
  plotPerformance(ys,ws, bg='white', name='Shrinkage')

  # Calculate the sample covariance matrix
  S <- cov.sample(ys)

  # Calculate the shrinkage coefficient
  F <- cov.prior.cc(S)
  k <- shrinkage.intensity(ys, F, S)

[Package tawny version 1.1.0 Index]