Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rp_grid

Generate random portfolios based on grid search method


Description

This function generates random portfolios based on the gridSearch function from the 'NMOF' package.

Usage

rp_grid(portfolio, permutations = 2000, normalize = TRUE)

Arguments

portfolio

an object of class 'portfolio' specifying the constraints for the optimization, see portfolio.spec

permutations

integer: number of unique constrained random portfolios to generate

normalize

TRUE/FALSE to normalize the weghts to satisfy min_sum or max_sum

Details

The number of levels is calculated based on permutations and number of assets. The number of levels must be an integer and may not result in the exact number of permutations. We round up to the nearest integer for the levels so the number of portfolios generated will be greater than or equal to permutations.

The grid search method only satisfies the min and max box constraints. The min_sum and max_sum leverage constraints will likely be violated and the weights in the random portfolios should be normalized. Normalization may cause the box constraints to be violated and will be penalized in constrained_objective.

Value

matrix of random portfolio weights


PortfolioAnalytics

Portfolio Analysis, Including Numerical Methods for Optimization of Portfolios

v1.1.0
GPL-2 | GPL-3
Authors
Brian G. Peterson [cre, aut, cph], Peter Carl [aut, cph], Kris Boudt [ctb, cph], Ross Bennett [ctb, cph], Hezky Varon [ctb], Guy Yollin [ctb], R. Douglas Martin [ctb]
Initial release
2018-05-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.