randport.eval {PortfolioProbe}R Documentation

Evaluate Each Random Portfolio

Description

Takes a random portfolio object and evaluates each individual portfolio. Any set of components of the output of trade.optimizer can be saved.

Usage

randport.eval(x, keep = c("results", "alpha.values", "var.values", 
        "utility.values"), subset = NULL, do.warn = FALSE, 
        additional.args = NULL, checkinput = TRUE, FUN = NULL, ...) 

Arguments

x required. An object that is the result of a call to random.portfolio or random.portfolio.utility.
keep character vector of the names of components of the output of trade.optimizer. If this is NULL, then the slightly ironic result is that all components are kept.
subset either NULL or a vector to subscript along the components of x.
do.warn the control for the warnings coming from trade.optimizer. The default is FALSE, meaning all warnings are turned off that can be turned off. The two other likely values are: TRUE (turn on all warnings), and NULL (use the do.warn value that was in effect to start with). (A value of NULL here is not necessarily the same as NULL in trade.optimizer.)
In general, this can be any value that the do.warn argument to trade.optimizer will accept.
additional.args a list of arguments to trade.optimizer either not in the call to random.portfolio or that should be changed. In the latter case, argument names need to be given exactly the same as in the original – that is, with the same amount of abbreviation.
checkinput a logical value. If TRUE, then a (fallible) check is made to see if there is a change in the value of price, variance, expected.return or existing between the current computation and the original computation. There is no warning about arguments that are in additional.args.
FUN a function or a character string naming a function. Each portfolio trade object will be passed to the function.
... additional arguments given to FUN.

Value

a list as long as x (or by what is indicated by subset if given).
If FUN is not given, each component is a list containing the components of the output of trade.optimizer listed in keep.
If FUN is given, then each component is the result of FUN applied to the portfolio trade object for the component.

Details

The objects that are involved (like prices and variances) need to be available in the current session, and presumably should be unchanged.

If you get a warning about a "checkinput difference" for one or more arguments, then you probably want to add those arguments to additional.args. Problems like this can arise because the arguments for the original computation were dependent on the iteration in a loop. Outside that original loop the value may be interpreted differently (or cause an error).

Bugs

This depends on the default value of out.trade in random.portfolio (and random.portfolio.utility) remaining FALSE.

Revision

This help was last revised 2010 January 02.

See Also

random.portfolio, trade.optimizer, random.portfolio.utility.

Examples

randport1 <- random.portfolio(100, prices, variance=varian, 
        long.only=TRUE, bench.constr=c(spx=.04^2/252), 
        lin.constraints=cntrysect.conmat,
        lin.bounds=cntrysect.bounds, gross.value=1e6)

randeval1 <- randport.eval(randport1)

# look at linear constraints of the random portfolios
randlincon1 <- randport.eval(randport1, keep="lin.realized")

# returns the above plus more
randsummary <- randport.eval(randport1, FUN=summary)

[Package PortfolioProbe version 1.03 Index]