最適權重
本練習延續上一個練習,持續分析 opt 與 opt_rebal 的輸出。擷取並視覺化最適權重是最佳化流程中很重要的一環。你可以用 extractWeights() 擷取最適權重,並用 chart.Weights() 繪圖。這對回測特別有幫助,能看出權重隨時間的變化。接著,你就能回答資產配置如何隨時間調整的問題。
本練習屬於課程
R 中級投資組合分析
練習說明
- 擷取單一期最佳化的最適權重。
- 繪製單一期最佳化的權重圖。
- 擷取最佳化回測的最適權重。
- 繪製最佳化回測的權重圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Extract the optimal weights for the single period optimization
# Chart the weights for the single period optimization
# Extract the optimal weights for the optimization backtest
# Chart the weights for the optimization backtest