rp_grid {PortfolioAnalytics}R Documentation

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


[Package PortfolioAnalytics version 2.0.0 Index]