Learn R Programming

RiskPortfolios (version 2.1.7)

covEstimation: Covariance matrix estimation

Description

Function which performs various estimations of covariance matrices.

Usage

covEstimation(rets, control = list())

Arguments

rets

a matrix \((T \times N)\) of returns.

control

control parameters (see *Details*).

Value

A \((N \times N)\) covariance matrix.

Details

The argument control is a list that can supply any of the following components:

  • type method used to compute the covariance matrix, among 'naive', 'ewma', 'lw', 'factor','const', 'cor', 'oneparm', 'diag' and 'large' where:

    'naive' is used to compute the naive (standard) covariance matrix.

    'ewma' is used to compute the exponential weighting moving average covariance matrix. The following formula is used to compute the ewma covariance matrix: $$\Sigma_t := \lambda \Sigma_{t-1} + (1-\lambda)r_{t-1}r_{t-1}$$ where \(r_t\) is the \((N \times 1)\) vector of returns at time \(t\). Note that the data must be sorted from the oldest to the latest. See RiskMetrics (1996)

    'factor' is used to compute the covariance matrix estimation using a K-factor approach. See Harman (1976).

    'lw' is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. The prior is given by a one-factor model and the factor is equal to the cross-sectional average of all the random variables. See Ledoit and Wolf (2003).

    'const' is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. The prior is given by constant correlation matrix. See Ledoit and Wolf (2002).

    'cor' is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. The prior is given by the constant correlation covariance matrix given by Ledoit and Wolf (2003).

    'oneparm' is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. The prior is given by the one-parameter matrix. All variances are the same and all covariances are zero. See Ledoit and Wolf (2004).

    'diag' is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. The prior is given by a diagonal matrix. See Ledoit and Wolf (2002).

    'large' This estimator is a weighted average of the sample covariance matrix and a 'prior' or 'shrinkage target'. Here, the prior is given by a one-factor model. The factor is equal to the cross-sectional average of all the random variables. The weight, or 'shrinkage intensity' is chosen to minimize quadratic loss measured by the Frobenius norm. The estimator is valid as the number of variables and/or the number of observations go to infinity, but Monte-Carlo simulations show that it works well for values as low as 10. The main advantage is that this estimator is guaranteed to be invertible and well-conditioned even if variables outnumber observations. See Ledoit and Wolf (2004).

    'bs' is the Bayes-Stein estimator for the covariance matrix given by Jorion (1986).

    Default: type = 'naive'.

  • lambda decay parameter. Default: lambda = 0.94.

  • K number of factors to use when the K-factor approach is chosen to estimate the covariance matrix. Default: K = 1.

References

Jorion, P. (1986). Bayes-Stein estimation for portfolio analysis. Journal of Financial and Quantitative Analysis 21(3), pp.279-292.

Harman, H.H. (1976) Modern Factor Analysis. 3rd Ed. Chicago: University of Chicago Press.

Ledoit, O., Wolf, M. (2002). Improved estimation of the covariance matrix of stock returns with an application to portfolio selection. Journal of Empirical Finance 10(5), pp.603-621.

Ledoit, O., Wolf, M. (2003). Honey, I Shrunk the Sample Covariance Matrix. Journal of Portfolio Management 30(4), pp.110-119.

Ledoit, O., Wolf, M. (2004). A well-conditioned estimator for large-dimensional covariance matrices. Journal of Multivariate Analysis 88(2), pp.365-411.

RiskMetrics (1996) RiskMetrics Technical Document. J. P. Morgan/Reuters.

Examples

Run this code
# NOT RUN {
# Load returns of assets or portfolios
data("Industry_10")
rets = Industry_10

# Naive covariance estimation
covEstimation(rets)

# Ewma estimation of the covariance with default lambda = 0.94
covEstimation(rets, control = list(type = 'ewma'))

# Ewma estimation of the covariance with default lambda = 0.90
covEstimation(rets, control = list(type = 'ewma', lambda = 0.9))

# Factor estimation of the covariance with dafault K = 1
covEstimation(rets, control = list(type = 'factor'))

# Factor estimation of the covariance with K = 3
covEstimation(rets, control = list(type = 'factor', K = 3))

# Ledot-Wolf's estimation of the covariance
covEstimation(rets, control = list(type = 'lw'))

# Shrinkage of the covariance matrix using constant correlation matrix
covEstimation(rets, control = list(type = 'const'))

# Shrinkage of the covariance matrix towards constant correlation matrix by
# Ledoit-Wolf.
covEstimation(rets, control = list(type = 'cor'))

# Shrinkage of the covariance matrix towards one-parameter matrix
covEstimation(rets, control = list(type = 'oneparm'))

# Shrinkage of the covaraince matrix towards diagonal matrix
covEstimation(rets, control = list(type = 'diag'))

# Shrinkage of the covariance matrix for large data set
covEstimation(rets, control = list(type = 'large'))
# }

Run the code above in your browser using DataLab