portfolioReturns(h, weights)portfolioPerformance(p, rf.rate = 0.01)
plotPerformance(h, weights, window = NULL, rf.rate = 0.01, new.plot = TRUE, y.min = -0.25, y.max = 0.25, bg = NULL, name = "", color = "red", colors = c(), ...)
compare.EqualWeighted(h, window, color = "#342a31", ...)
compare.Market(market, obs, window, end = Sys.Date(), color = "#44bc43", ...)
The equal weighted portfolio is simply the same portfolio weight for each
asset in the specified portfolio. For this to be meaningful, the same
portfolio and window are passed into the function as with the
optimizePortfolio call thus ensuring that the equal weighted portfolio
and corresponding returns are constructed correctly.
When comparing to the market portfolio, the number of observations need to be specified again so the market portfolio and corresponding returns are constructed properly.
data(sp500.subset)
ys <- sp500.subset
ws <- optimizePortfolio(ys, 150, getCorFilter.RMT())
plotPerformance(ys, ws, 150)
compare.EqualWeighted(ys, 150)
compare.Market('^GSPC', 200, 150)Run the code above in your browser using DataLab