Learn R Programming

PortfolioAnalytics (version 2.0.0)

extractStats: extract some stats and weights from a portfolio run via optimize.portfolio

Description

This function will dispatch to the appropriate class handler based on the input class of the optimize.portfolio output object.

Usage

extractStats(object, prefix = NULL, ...)

Arguments

object

list returned by optimize.portfolio

prefix

prefix to add to output row names

...

any other passthru parameters

Details

For optimize.portfolio objects:

In general, extractStats will extract the values objective measures and weights at each iteration of a set of weights. This is the case for the DEoptim, random portfolios, and pso solvers that return trace information. Note that trace=TRUE must be specified in optimize.portfolio to return the trace information.

For optimize.portfolio.pso objects, this function will extract the weights (swarm positions) from the PSO output and the out values (swarm fitness values) for each iteration of the optimization. This function can be slow because we need to run constrained_objective to calculate the objective measures on the transformed weights.

For optimize.portfolio.rebalancing objects:

The extractStats function will return a list of the objective measures and weights at each rebalance date for optimize.portfolio.rebalancing objects. The objective measures and weights of each iteration or permutation will be returned if the optimization was done with DEoptim, random portfolios, or pso. This could potentially result in a very large list object where each list element has thousands of rows of at each rebalance period.

The output from the GenSA solver does not store weights evaluated at each iteration The GenSA output for trace.mat contains nb.steps, temperature, function.value, and current.minimum

See Also

optimize.portfolio