Advanced moment estimates
PortfolioAnalytics
supports the "sample" method as well as three more advanced methods for estimating portfolio moments.
"sample"
: Basic sample estimate of first four moments."boudt"
: The first four moments are estimated by fitting a statistical factor model based on the work of Boudt et al., 2014."black_litterman"
: The first two moments are estimated using the Black-Litterman framework."Meucci"
: The first two moments are estimated using the Fully Flexible Views framework.
In this exercise, you will estimate the second moment using the "boudt" method. A portfolio specification object named port_spec
with a "StdDev" objective has already been created.
This exercise is part of the course
Intermediate Portfolio Analysis in R
Exercise instructions
- Print the portfolio specification object.
- Fit a statistical factor model with 3 factors to the asset returns. Assign to a variable named
fit
- Estimate the portfolio moments using the "boudt" method with 3 factors. Assign to a variable named
moments_boudt
. - Use
extractCovariance()
to get the estimated variance-covariance matrix fromfit
and check if it is equal to the estimate inmoments_boudt
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Print the portfolio specification object
# Fit a statistical factor model to the asset returns
fit <- statistical.factor.model(R = ___, k = ___)
# Estimate the portfolio moments using the "boudt" method with 3 factors
moments_boudt <- set.portfolio.moments(R = ___, portfolio = ___, method = ___, k = ___)
# Check if the covariance matrix extracted from the model fit is equal to the estimate in `moments_boudt`
moments_boudt$___ == extractCovariance(___)