MeanVar_portfolio {HDShOP} | R Documentation |
A helper function for MeanVar_portfolio
Description
A user-friendly function making mean-variance portfolios for assets with customly computed covariance matrix and mean returns. The weights are computed in accordance with the formula
\hat w_{MV} = \frac{\hat{\Sigma}^{-1} 1}{1' \hat{\Sigma}^{-1} 1} +
\gamma^{-1} \hat Q \hat{\mu},
where \hat{\Sigma}
is an estimator for the covariance matrix,
\hat{\mu}
is an estimator for the mean vector, \gamma
is
the coefficient of risk aversion, and \hat Q
is given by
\hat Q = \hat{\Sigma}^{-1} - \frac{\hat{\Sigma}^{-1} 1
1' \hat{\Sigma}^{-1}}{1' \hat{\Sigma}^{-1} 1} .
The computation is made by new_MeanVar_portfolio
and
the result is validated by validate_MeanVar_portfolio
.
Usage
MeanVar_portfolio(mean_vec, cov_mtrx, gamma)
Arguments
mean_vec |
mean vector of asset returns provided in the form of a vector or a list. |
cov_mtrx |
the covariance matrix of asset returns. It could be a matrix or a data frame. |
gamma |
a numeric variable. Coefficient of risk aversion. |
Value
Mean-variance portfolio in the form of object of S3 class MeanVar_portfolio.
Examples
n<-3e2 # number of realizations
p<-.5*n # number of assets
gamma<-1
x <- matrix(data = rnorm(n*p), nrow = p, ncol = n)
# Simple MV portfolio
cov_mtrx <- Sigma_sample_estimator(x)
means <- rowMeans(x)
cust_port_simp <- MeanVar_portfolio(mean_vec=means,
cov_mtrx=cov_mtrx, gamma=2)
str(cust_port_simp)