| pp.smallSelect {pprobeSup} | R Documentation |
Goes to some effort to select the subset of the assets of a certain size that are the best in the optimization.
pp.smallSelect(prices, port.size, ..., sets = 10, finalStringency = 2)
prices |
named numeric vector of the prices to use in the optimization. |
port.size |
the exact number of assets that are to be in the portfolio. This is presumably a small positive integer. |
... |
the rest of the arguments that define the optimization. |
sets |
the number of unique combinations of assets to create and test. The full name of this argument must be given since it is after the dot-dot-dot argument. |
finalStringency |
the value of The full name of this argument must be given since it is after the dot-dot-dot argument. |
a list with the following components:
optimum |
the result of |
sets |
a |
call |
an image of the call that created the object. |
There are two stages. The first stage does sets optimizations
where each optimization will not select any of the exact subsets that
have already been selected.
The second stage again does sets optimizations but now the
assets are specified so there is no selection aspect to the optimization.
These optimizations set stringency to finalStringency.
The application that led to this function was looking for 3 to 6 assets in the portfolio, and it was quite desirable to have the best selection.
In test suite, mildly tested.
This help file was last revised 2013 May 02.
trade.optimizer.
# attach data
require(pprobeData)
# select best three assets out of 100
# a real problem would hopefully have a better expected return
ones <- xassetPrices[1, 1:100]
ones[] <- 1
bestThree <- pp.smallSelect(prices=ones,
variance=var(xassetPrices[1:500, 1:100]),
expected.return=colMeans(xassetLogReturns[1:500,1:100]),
gross=10000 + c(-.5, .5), long.only=TRUE, max.weight=.5,
port.size=3)
# look at the good asset combinations
bestThree$sets
sort(table(bestThree$sets))