| randport.eval {PortfolioProbe} | R Documentation |
Takes a random portfolio object and evaluates each individual portfolio.
Any set of components of the output of trade.optimizer can
be saved.
randport.eval(x, keep = c("results", "alpha.values", "var.values",
"utility.values"), subset = NULL, do.warn = FALSE,
additional.args = NULL, checkinput = TRUE,
envir = parent.frame(), FUN = NULL, ...)
x |
required.
An object that is the result of a call to
|
keep |
character vector of component names of the
output of |
subset |
either |
do.warn |
the control for the warnings coming from This can be any value that the |
additional.args |
list of arguments to |
checkinput |
a logical value.
If |
envir |
the environment where the objects used to generate the random portfolios are going to be found. This is nonsensical to S+. |
FUN |
a function or a character string naming a function. Each portfolio trade object will be passed to the function. |
... |
additional arguments given to |
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.
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).
If neither expected returns nor variance are given (and a distance utility is not specified), then the utility is set to zero by maximizing expected returns that are all zero.
There are limited circumstances when the utility.values component
is confused (equal to zero) if
expected.return can not be found and utility is not specified.
This help was last revised 2013 April 19.
random.portfolio, trade.optimizer,
random.portfolio.utility.
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="con.realized")
# returns the above plus more
randsummary <- randport.eval(randport1, FUN=summary)
# vector of weight differences
rdist <- unlist(randport.eval(randport1, FUN = function(x)
trade.distance(x, some.portf, prices=privec, scale="weight")))