# Estimate the covariance matrix based on the given asset returns
data(sp500.subset)
ys <- TawnyPortfolio(sp500.subset, 150)
S.hat <- cov_shrink(ys)
# Optimize the portfolio weights using the shrinkage estimator
ws <- optimizePortfolio(ys, ShrinkageDenoiser())
#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)Run the code above in your browser using DataLab