Session Ready
Exercise

Sample moment estimates

The default method for estimating portfolio moments is the sample method. The moments are calculated in optimize.portfolio() by evaluating the function passed to the momentFUN argument. The default for momentFUN is set.portfolio.moments() which defaults to calculating the sample moments. The moments are then used as inputs to the objective functions. The moments that must be estimated depend on the objectives. For example, an objective to minimize portfolio standard deviation requires only an estimate of the second moment. Compare that to the objective to maximize Sharpe Ratio which requires the first and second moments to be estimated. Sample estimates of the moments have disadvantages including estimation error and the curse of dimensionality. There is an increased risk of estimation error as the dimension of assets and parameters to estimate increase.

Instructions
100 XP
  • Add a return objective with "mean" as the objective name.
  • Calculate the sample moments using set.portfolio.moments. Assign to a variable named moments.
  • Check if the first moment is equal to the sample estimate of mean returns.
  • Add a risk objective with "StdDev" as the objective name.
  • Calculate the sample moments using set.portfolio.moments. Assign to a variable named moments.
  • Check if the second moment is equal to the sample estimate of the variance-covariance matrix.