random_portfolios {PortfolioAnalytics}R Documentation

version 2 generate an arbitary number of constrained random portfolios

Description

Generate random portfolios using the 'sample', 'simplex', or 'grid' method. See details.

Usage

random_portfolios(
  portfolio,
  permutations = 100,
  rp_method = "sample",
  eliminate = 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

rp_method

method to generate random portfolios. Currently "sample", "simplex", or "grid". See Details.

eliminate

TRUE/FALSE, eliminate portfolios that do not satisfy constraints

...

any other passthru parameters

Details

Random portfolios can be generate using one of three methods.

sample:

The 'sample' method to generate random portfolios is based on an idea pioneerd by Pat Burns. This is the most flexible method, but also the slowest, and can generate portfolios to satisfy leverage, box, group, position limit, and leverage exposure constraints.

simplex:

The 'simplex' method to generate random portfolios is based on a paper by W. T. Shaw. The simplex method is useful to generate random portfolios with the full investment constraint, where the sum of the weights is equal to 1, and min box constraints. Values for min_sum and max_sum of the leverage constraint will be ignored, the sum of weights will equal 1. All other constraints such as group and position limit constraints will be handled by elimination. If the constraints are very restrictive, this may result in very few feasible portfolios remaining.

grid:

The 'grid' method to generate random portfolios is based on the gridSearch function in package 'NMOF'. 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.

The constraint types checked are leverage, box, group, position limit, and leverage exposure. Any portfolio that does not satisfy all these constraints will be eliminated. This function is particularly sensitive to min_sum and max_sum leverage constraints. For the sample method, there should be some "wiggle room" between min_sum and max_sum in order to generate a sufficient number of feasible portfolios. For example, min_sum=0.99 and max_sum=1.01 is recommended instead of min_sum=1 and max_sum=1. If min_sum=1 and max_sum=1, the number of feasible portfolios may be 1/3 or less depending on the other constraints.

Value

matrix of random portfolio weights

Author(s)

Peter Carl, Brian G. Peterson, Ross Bennett

See Also

portfolio.spec, objective, rp_sample, rp_simplex, rp_grid


[Package PortfolioAnalytics version 2.0.0 Index]