[Returnanalytics-commits] r2994 - in pkg/PortfolioAnalytics: . R demo man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 5 03:40:11 CEST 2013


Author: rossbennett34
Date: 2013-09-05 03:40:09 +0200 (Thu, 05 Sep 2013)
New Revision: 2994

Added:
   pkg/PortfolioAnalytics/man/barplotGroupWeights.Rd
   pkg/PortfolioAnalytics/man/constraint_v2.Rd
Removed:
   pkg/PortfolioAnalytics/man/HHI.Rd
   pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd
   pkg/PortfolioAnalytics/man/chart.RiskReward.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.DE.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.GenSA.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.ROI.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.RP.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.pso.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.DE.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.GenSA.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.ROI.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.RP.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.pso.Rd
   pkg/PortfolioAnalytics/man/charts.DE.Rd
   pkg/PortfolioAnalytics/man/charts.GenSA.Rd
   pkg/PortfolioAnalytics/man/charts.ROI.Rd
   pkg/PortfolioAnalytics/man/charts.RP.Rd
   pkg/PortfolioAnalytics/man/charts.pso.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.DEoptim.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.GenSA.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.ROI.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.parallel.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.pso.Rd
   pkg/PortfolioAnalytics/man/extractStats.optimize.portfolio.random.Rd
   pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.rebalancing.Rd
Modified:
   pkg/PortfolioAnalytics/DESCRIPTION
   pkg/PortfolioAnalytics/NAMESPACE
   pkg/PortfolioAnalytics/R/applyFUN.R
   pkg/PortfolioAnalytics/R/chart.RiskReward.R
   pkg/PortfolioAnalytics/R/chart.Weights.R
   pkg/PortfolioAnalytics/R/charts.DE.R
   pkg/PortfolioAnalytics/R/charts.GenSA.R
   pkg/PortfolioAnalytics/R/charts.PSO.R
   pkg/PortfolioAnalytics/R/charts.ROI.R
   pkg/PortfolioAnalytics/R/charts.RP.R
   pkg/PortfolioAnalytics/R/charts.efficient.frontier.R
   pkg/PortfolioAnalytics/R/charts.groups.R
   pkg/PortfolioAnalytics/R/constrained_objective.R
   pkg/PortfolioAnalytics/R/constraint_fn_map.R
   pkg/PortfolioAnalytics/R/constraints.R
   pkg/PortfolioAnalytics/R/extract.efficient.frontier.R
   pkg/PortfolioAnalytics/R/extractstats.R
   pkg/PortfolioAnalytics/R/generics.R
   pkg/PortfolioAnalytics/R/objective.R
   pkg/PortfolioAnalytics/R/objectiveFUN.R
   pkg/PortfolioAnalytics/R/optimize.portfolio.R
   pkg/PortfolioAnalytics/R/random_portfolios.R
   pkg/PortfolioAnalytics/demo/00Index
   pkg/PortfolioAnalytics/man/add.objective.Rd
   pkg/PortfolioAnalytics/man/applyFUN.Rd
   pkg/PortfolioAnalytics/man/chart.EfficientFrontierOverlay.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd
   pkg/PortfolioAnalytics/man/constrained_objective.Rd
   pkg/PortfolioAnalytics/man/constraint.Rd
   pkg/PortfolioAnalytics/man/create.EfficientFrontier.Rd
   pkg/PortfolioAnalytics/man/extract.efficient.frontier.Rd
   pkg/PortfolioAnalytics/man/extractStats.Rd
   pkg/PortfolioAnalytics/man/extractWeights.Rd
   pkg/PortfolioAnalytics/man/fn_map.Rd
   pkg/PortfolioAnalytics/man/is.objective.Rd
   pkg/PortfolioAnalytics/man/objective.Rd
   pkg/PortfolioAnalytics/man/optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd
   pkg/PortfolioAnalytics/man/position_limit_constraint.Rd
   pkg/PortfolioAnalytics/man/print.constraint.Rd
   pkg/PortfolioAnalytics/man/print.efficient.frontier.Rd
   pkg/PortfolioAnalytics/man/print.optimize.portfolio.DEoptim.Rd
   pkg/PortfolioAnalytics/man/print.optimize.portfolio.GenSA.Rd
   pkg/PortfolioAnalytics/man/print.optimize.portfolio.ROI.Rd
   pkg/PortfolioAnalytics/man/print.optimize.portfolio.pso.Rd
   pkg/PortfolioAnalytics/man/print.optimize.portfolio.random.Rd
   pkg/PortfolioAnalytics/man/print.portfolio.Rd
   pkg/PortfolioAnalytics/man/randomize_portfolio.Rd
   pkg/PortfolioAnalytics/man/scatterFUN.Rd
   pkg/PortfolioAnalytics/man/summary.efficient.frontier.Rd
   pkg/PortfolioAnalytics/man/summary.optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/summary.optimize.portfolio.rebalancing.Rd
   pkg/PortfolioAnalytics/man/summary.portfolio.Rd
   pkg/PortfolioAnalytics/man/txfrm_position_limit_constraint.Rd
   pkg/PortfolioAnalytics/man/update.constraint.Rd
   pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd
Log:
Cleaning up documentation to attempt to pass R CMD check.

Modified: pkg/PortfolioAnalytics/DESCRIPTION
===================================================================
--- pkg/PortfolioAnalytics/DESCRIPTION	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/DESCRIPTION	2013-09-05 01:40:09 UTC (rev 2994)
@@ -15,8 +15,9 @@
     PerformanceAnalytics (>= 1.0.0)
 Suggests:
     quantmod,
-    DEoptim(>= 2.3.1),
+    DEoptim(>= 2.2.1),
     foreach,
+    iterators,
     fGarch,
     Rglpk,
     quadprog,

Modified: pkg/PortfolioAnalytics/NAMESPACE
===================================================================
--- pkg/PortfolioAnalytics/NAMESPACE	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/NAMESPACE	2013-09-05 01:40:09 UTC (rev 2994)
@@ -3,48 +3,17 @@
 export(applyFUN)
 export(box_constraint)
 export(CCCgarch.MM)
-export(chart.EfficientFrontier.efficient.frontier)
-export(chart.EfficientFrontier.optimize.portfolio.ROI)
-export(chart.EfficientFrontier.optimize.portfolio)
 export(chart.EfficientFrontier)
 export(chart.EfficientFrontierOverlay)
 export(chart.GroupWeights)
 export(chart.RiskBudget)
-export(chart.RiskReward.optimize.portfolio.DEoptim)
-export(chart.RiskReward.optimize.portfolio.GenSA)
-export(chart.RiskReward.optimize.portfolio.pso)
-export(chart.RiskReward.optimize.portfolio.random)
-export(chart.RiskReward.optimize.portfolio.ROI)
 export(chart.RiskReward)
-export(chart.Scatter.DE)
-export(chart.Scatter.GenSA)
-export(chart.Scatter.pso)
-export(chart.Scatter.ROI)
-export(chart.Scatter.RP)
-export(chart.Weights.DE)
-export(chart.Weights.EF.efficient.frontier)
-export(chart.Weights.EF.optimize.portfolio)
 export(chart.Weights.EF)
-export(chart.Weights.GenSA)
-export(chart.Weights.optimize.portfolio.DEoptim)
-export(chart.Weights.optimize.portfolio.GenSA)
-export(chart.Weights.optimize.portfolio.pso)
-export(chart.Weights.optimize.portfolio.random)
-export(chart.Weights.optimize.portfolio.ROI)
-export(chart.Weights.pso)
-export(chart.Weights.ROI)
-export(chart.Weights.RP)
 export(chart.Weights)
-export(charts.DE)
-export(charts.GenSA)
-export(charts.pso)
-export(charts.ROI)
-export(charts.RP)
 export(constrained_group_tmp)
 export(constrained_objective_v2)
 export(constrained_objective)
 export(constraint_ROI)
-export(constraint_v2)
 export(constraint)
 export(create.EfficientFrontier)
 export(diversification_constraint)
@@ -53,15 +22,7 @@
 export(extractEfficientFrontier)
 export(extractGroups)
 export(extractObjectiveMeasures)
-export(extractStats.optimize.portfolio.DEoptim)
-export(extractStats.optimize.portfolio.GenSA)
-export(extractStats.optimize.portfolio.parallel)
-export(extractStats.optimize.portfolio.pso)
-export(extractStats.optimize.portfolio.random)
-export(extractStats.optimize.portfolio.ROI)
 export(extractStats)
-export(extractWeights.optimize.portfolio.rebalancing)
-export(extractWeights.optimize.portfolio)
 export(extractWeights)
 export(factor_exposure_constraint)
 export(fn_map)
@@ -69,6 +30,7 @@
 export(get_constraints)
 export(group_constraint)
 export(group_fail)
+export(HHI)
 export(insert_constraints)
 export(insert_objectives)
 export(is.constraint)
@@ -82,24 +44,10 @@
 export(optimize.portfolio.parallel)
 export(optimize.portfolio.rebalancing)
 export(optimize.portfolio)
-export(plot.optimize.portfolio.DEoptim)
-export(plot.optimize.portfolio.GenSA)
-export(plot.optimize.portfolio.pso)
-export(plot.optimize.portfolio.random)
-export(plot.optimize.portfolio.ROI)
-export(plot.optimize.portfolio)
 export(portfolio_risk_objective)
 export(portfolio.spec)
 export(pos_limit_fail)
 export(position_limit_constraint)
-export(print.constraint)
-export(print.efficient.frontier)
-export(print.optimize.portfolio.DEoptim)
-export(print.optimize.portfolio.GenSA)
-export(print.optimize.portfolio.pso)
-export(print.optimize.portfolio.random)
-export(print.optimize.portfolio.ROI)
-export(print.portfolio)
 export(quadratic_utility_objective)
 export(random_portfolios_v1)
 export(random_portfolios_v2)
@@ -116,10 +64,6 @@
 export(set.portfolio.moments_v1)
 export(set.portfolio.moments_v2)
 export(set.portfolio.moments)
-export(summary.efficient.frontier)
-export(summary.optimize.portfolio.rebalancing)
-export(summary.optimize.portfolio)
-export(summary.portfolio)
 export(trailingFUN)
 export(turnover_constraint)
 export(turnover_objective)
@@ -129,7 +73,48 @@
 export(txfrm_position_limit_constraint)
 export(txfrm_weight_sum_constraint)
 export(update_constraint_v1tov2)
-export(update.constraint)
 export(var.portfolio)
 export(weight_concentration_objective)
 export(weight_sum_constraint)
+S3method(chart.EfficientFrontier,efficient.frontier)
+S3method(chart.EfficientFrontier,optimize.portfolio.ROI)
+S3method(chart.EfficientFrontier,optimize.portfolio)
+S3method(chart.RiskReward,optimize.portfolio.DEoptim)
+S3method(chart.RiskReward,optimize.portfolio.GenSA)
+S3method(chart.RiskReward,optimize.portfolio.pso)
+S3method(chart.RiskReward,optimize.portfolio.random)
+S3method(chart.RiskReward,optimize.portfolio.ROI)
+S3method(chart.Weights,optimize.portfolio.DEoptim)
+S3method(chart.Weights,optimize.portfolio.GenSA)
+S3method(chart.Weights,optimize.portfolio.pso)
+S3method(chart.Weights,optimize.portfolio.random)
+S3method(chart.Weights,optimize.portfolio.ROI)
+S3method(chart.Weights.EF,efficient.frontier)
+S3method(chart.Weights.EF,optimize.portfolio)
+S3method(extractStats,optimize.portfolio.DEoptim)
+S3method(extractStats,optimize.portfolio.GenSA)
+S3method(extractStats,optimize.portfolio.parallel)
+S3method(extractStats,optimize.portfolio.pso)
+S3method(extractStats,optimize.portfolio.random)
+S3method(extractStats,optimize.portfolio.ROI)
+S3method(extractWeights,optimize.portfolio.rebalancing)
+S3method(extractWeights,optimize.portfolio)
+S3method(plot,optimize.portfolio.DEoptim)
+S3method(plot,optimize.portfolio.GenSA)
+S3method(plot,optimize.portfolio.pso)
+S3method(plot,optimize.portfolio.random)
+S3method(plot,optimize.portfolio.ROI)
+S3method(plot,optimize.portfolio)
+S3method(print,constraint)
+S3method(print,efficient.frontier)
+S3method(print,optimize.portfolio.DEoptim)
+S3method(print,optimize.portfolio.GenSA)
+S3method(print,optimize.portfolio.pso)
+S3method(print,optimize.portfolio.random)
+S3method(print,optimize.portfolio.ROI)
+S3method(print,portfolio)
+S3method(summary,efficient.frontier)
+S3method(summary,optimize.portfolio.rebalancing)
+S3method(summary,optimize.portfolio)
+S3method(summary,portfolio)
+S3method(update,constraint)

Modified: pkg/PortfolioAnalytics/R/applyFUN.R
===================================================================
--- pkg/PortfolioAnalytics/R/applyFUN.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/applyFUN.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -3,9 +3,9 @@
 #' This function is used to calculate risk or return metrics given a matrix of
 #' weights and is primarily used as a convenience function used in chart.Scatter functions
 #' 
-#' @param R 
+#' @param R xts object of asset returns
 #' @param weights a matrix of weights generated from random_portfolios or \code{optimize.portfolio}
-#' @param FUN
+#' @param FUN name of a function
 #' @param ... any passthrough arguments to FUN
 #' @author Ross Bennett
 #' @export
@@ -90,8 +90,8 @@
 #' This function is used to calculate risk or return metrics given a matrix of
 #' asset returns and will be used for a risk-reward scatter plot of the assets
 #' 
-#' @param R 
-#' @param FUN
+#' @param R xts object of asset returns
+#' @param FUN name of function
 #' @param ... any passthrough arguments to FUN
 #' @author Ross Bennett
 #' @export

Modified: pkg/PortfolioAnalytics/R/chart.RiskReward.R
===================================================================
--- pkg/PortfolioAnalytics/R/chart.RiskReward.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/chart.RiskReward.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -2,21 +2,32 @@
 
 #' classic risk reward scatter
 #' 
+#' \code{neighbors} may be specified in three ways.  
+#' The first is as a single number of neighbors.  This will extract the \code{neighbors} closest 
+#' portfolios in terms of the \code{out} numerical statistic.
+#' The second method consists of a numeric vector for \code{neighbors}.
+#' This will extract the \code{neighbors} with portfolio index numbers that correspond to the vector contents.
+#' The third method for specifying \code{neighbors} is to pass in a matrix.  
+#' This matrix should look like the output of \code{\link{extractStats}}, and should contain
+#' \code{risk.col},\code{return.col}, and weights columns all properly named. 
+#' 
 #' @param object optimal portfolio created by \code{\link{optimize.portfolio}}
-#' @param neighbors set of 'neighbor' portfolios to overplot, see Details in \code{\link{charts.DE}}
-#' @param ... any other passthru parameters 
-#' @param rp TRUE/FALSE. If TRUE, random portfolios are generated by \code{\link{random_portfolios}} to view the feasible space 
+#' @param neighbors set of 'neighbor' portfolios to overplot, see Details
+#' @param \dots any other passthru parameters 
 #' @param return.col string matching the objective of a 'return' objective, on vertical axis
 #' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
 #' @param chart.assets TRUE/FALSE. Includes a risk reward scatter of the assets in the chart
+#' @param element.color color for the default plot scatter points
 #' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
-#' @param element.color color for the default plot scatter points
 #' @param xlim set the x-axis limit, same as in \code{\link{plot}}
 #' @param ylim set the y-axis limit, same as in \code{\link{plot}}
 #' @seealso \code{\link{optimize.portfolio}}
+#' @rdname chart.RiskReward
+#' @aliases chart.RiskReward.optimize.portfolio.DEoptim chart.RiskReward.optimize.portfolio.RP 
+#' chart.RiskReward.optimize.portfolio.ROI chart.RiskReward.optimize.portfolio.pso 
+#' chart.RiskReward.optimize.portfolio.GenSA
 #' @export
-chart.RiskReward <- function(object, neighbors, ..., rp=FALSE, return.col="mean", risk.col="ES", element.color = "darkgray", cex.axis=0.8, ylim=NULL, xlim=NULL){
+chart.RiskReward <- function(object, neighbors, ..., return.col, risk.col, chart.assets, element.color, cex.axis, xlim, ylim){
   UseMethod("chart.RiskReward")
 }
 
-

Modified: pkg/PortfolioAnalytics/R/chart.Weights.R
===================================================================
--- pkg/PortfolioAnalytics/R/chart.Weights.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/chart.Weights.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -5,6 +5,8 @@
 #' 
 #' @param object optimal portfolio object created by \code{\link{optimize.portfolio}}
 #' @param neighbors set of 'neighbor' portfolios to overplot
+#' @param \dots any other passthru parameters 
+#' @param main an overall title for the plot: see \code{\link{title}}
 #' @param las numeric in \{0,1,2,3\}; the style of axis labels
 #'       \describe{
 #'         \item{0:}{always parallel to the axis [\emph{default}],}
@@ -14,11 +16,12 @@
 #'       }
 #' @param xlab a title for the x axis: see \code{\link{title}}
 #' @param cex.lab The magnification to be used for x and y labels relative to the current setting of \code{cex}
+#' @param element.color color for the default plot lines
 #' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
-#' @param element.color color for the default plot lines
-#' @param ... any other passthru parameters 
-#' @param main an overall title for the plot: see \code{\link{title}}
 #' @seealso \code{\link{optimize.portfolio}}
+#' @rdname chart.Weights
+#' @name chart.Weights
+#' @aliases chart.Weights.optimize.portfolio.ROI chart.Weights.optimize.portfolio.DEoptim chart.Weights.optimize.portfolio.pso chart.Weights.optimize.portfolio.RP chart.Weights.optimize.portfolio.GenSA
 #' @export
 chart.Weights <- function(object, neighbors = NULL, ..., main="Weights", las = 3, xlab=NULL, cex.lab = 1, element.color = "darkgray", cex.axis=0.8){
   UseMethod("chart.Weights")

Modified: pkg/PortfolioAnalytics/R/charts.DE.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.DE.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/charts.DE.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -10,8 +10,7 @@
 #
 ###############################################################################
 
-#' @rdname chart.Weights
-#' @export
+
 chart.Weights.DE <- function(object, neighbors = NULL, ..., main="Weights", las = 3, xlab=NULL, cex.lab = 1, element.color = "darkgray", cex.axis=0.8){
   # Specific to the output of optimize.portfolio with optimize_method="DEoptim"
   if(!inherits(object, "optimize.portfolio.DEoptim")) stop("object must be of class 'optimize.portfolio.DEoptim'")
@@ -82,12 +81,12 @@
   box(col = element.color)
 }
 
-#' @rdname chart.Weights
+#' @method chart.Weights optimize.portfolio.DEoptim
+#' @S3method chart.Weights optimize.portfolio.DEoptim
 #' @export
 chart.Weights.optimize.portfolio.DEoptim <- chart.Weights.DE
 
-#' @rdname chart.RiskReward
-#' @export
+
 chart.Scatter.DE <- function(object, neighbors = NULL, ..., return.col='mean', risk.col='ES', chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   # more or less specific to the output of the DEoptim portfolio code with constraints
   # will work to a point with other functions, such as optimize.porfolio.parallel
@@ -234,7 +233,7 @@
       rr[i,2] = x[rtc]  #'FIXME      
     }
     colors2 = colorRamp(c("blue","lightblue"))
-    colortrail = rgb(colors2((0:rows)/rows),max=255)
+    colortrail = rgb(colors2((0:rows)/rows),maxColorValue=255)
     for(i in 1:rows){
       points(rr[i,1], rr[i,2], pch=1, col = colortrail[rows-i+1])
     }
@@ -285,36 +284,17 @@
   box(col = element.color)
 }
 
-#' @rdname chart.RiskReward
+#' @method chart.RiskReward optimize.portfolio.DEoptim
+#' @S3method chart.RiskReward optimize.portfolio.DEoptim
 #' @export
 chart.RiskReward.optimize.portfolio.DEoptim <- chart.Scatter.DE
 
-#' scatter and weights chart  for random portfolios
-#' 
-#' \code{neighbors} may be specified in three ways.  
-#' The first is as a single number of neighbors.  This will extract the \code{neighbors} closest 
-#' portfolios in terms of the \code{out} numerical statistic.
-#' The second method consists of a numeric vector for \code{neighbors}.
-#' This will extract the \code{neighbors} with portfolio index numbers that correspond to the vector contents.
-#' The third method for specifying \code{neighbors} is to pass in a matrix.  
-#' This matrix should look like the output of \code{\link{extractStats}}, and should contain
-#' \code{risk.col},\code{return.col}, and weights columns all properly named.  
-#' 
-#' @param DE set of random portfolios created by \code{\link{optimize.portfolio}}
-#' @param ... any other passthru parameters 
-#' @param risk.col string name of column to use for risk (horizontal axis)
-#' @param return.col string name of column to use for returns (vertical axis)
-#' @param neighbors set of 'neighbor portfolios to overplot
-#' @param main an overall title for the plot: see \code{\link{title}}
-#' @seealso 
-#' \code{\link{optimize.portfolio}}
-#' \code{\link{extractStats}}
-#' @export
+
 charts.DE <- function(DE, risk.col, return.col, chart.assets, neighbors=NULL, main="DEoptim.Portfolios", xlim=NULL, ylim=NULL, ...){
 # Specific to the output of the random portfolio code with constraints
     # @TODO: check that DE is of the correct class
     op <- par(no.readonly=TRUE)
-    layout(matrix(c(1,2)),height=c(2,1.5),width=1)
+    layout(matrix(c(1,2)),heights=c(2,1.5),widths=1)
     par(mar=c(4,4,4,2))
     chart.Scatter.DE(object=DE, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)
     par(mar=c(2,4,0,2))
@@ -322,12 +302,14 @@
     par(op)
 }
 
-#TODO make chart.DE into a plot() method or methods
 
 #' plot method for optimize.portfolio.DEoptim output
 #' 
-#' scatter and weights chart  for DEoptim portfolio optimizations run with trace=TRUE
+#' scatter and weights chart for DEoptim portfolio optimizations run with trace=TRUE
 #' 
+#' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
+#' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
+#' 
 #' \code{neighbors} may be specified in three ways.  
 #' The first is as a single number of neighbors.  This will extract the \code{neighbors} closest 
 #' portfolios in terms of the \code{out} numerical statistic.
@@ -345,6 +327,8 @@
 #' @param main an overall title for the plot: see \code{\link{title}}
 #' @param xlim set the limit on coordinates for the x-axis
 #' @param ylim set the limit on coordinates for the y-axis
+#' @method plot optimize.portfolio.DEoptim
+#' @S3method plot optimize.portfolio.DEoptim
 #' @export
 plot.optimize.portfolio.DEoptim <- function(x, ..., return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, main='optimized portfolio plot', xlim=NULL, ylim=NULL) {
     charts.DE(DE=x, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...)

Modified: pkg/PortfolioAnalytics/R/charts.GenSA.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.GenSA.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/charts.GenSA.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -1,6 +1,4 @@
 
-#' @rdname chart.Weights
-#' @export
 chart.Weights.GenSA <- function(object, neighbors = NULL, ..., main="Weights", las = 3, xlab=NULL, cex.lab = 1, element.color = "darkgray", cex.axis=0.8){
   
   if(!inherits(object, "optimize.portfolio.GenSA")) stop("object must be of class 'optimize.portfolio.GenSA'")
@@ -70,13 +68,12 @@
   box(col = element.color)
 }
 
-#' @rdname chart.Weights
+#' @method chart.Weights optimize.portfolio.GenSA
+#' @S3method chart.Weights optimize.portfolio.GenSA
 #' @export
 chart.Weights.optimize.portfolio.GenSA <- chart.Weights.GenSA
 
-#' @rdname chart.RiskReward
-#' @export
-chart.Scatter.GenSA <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color="darkgray", cex.axis=0.8, ylim=NULL, xlim=NULL){
+chart.Scatter.GenSA <- function(object, neighbors=NULL, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, element.color="darkgray", cex.axis=0.8, ylim=NULL, xlim=NULL, rp=FALSE){
   
   if(!inherits(object, "optimize.portfolio.GenSA")) stop("object must be of class 'optimize.portfolio.GenSA'")
   
@@ -133,31 +130,16 @@
   box(col = element.color)
 }
 
-#' @rdname chart.RiskReward
+#' @method chart.RiskReward optimize.portfolio.GenSA
+#' @S3method chart.RiskReward optimize.portfolio.GenSA
 #' @export
 chart.RiskReward.optimize.portfolio.GenSA <- chart.Scatter.GenSA
 
-#' scatter and weights chart for portfolios
-#' 
-#' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
-#' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
-#' 
-#' @param GenSA object created by \code{\link{optimize.portfolio}}
-#' @param rp set of weights generated by \code{\link{random_portfolio}}
-#' @param return.col string matching the objective of a 'return' objective, on vertical axis
-#' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
-#' @param ... any other passthru parameters 
-#' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
-#' @param element.color color for the default plot scatter points
-#'  @param neighbors set of 'neighbor' portfolios to overplot
-#' @param main an overall title for the plot: see \code{\link{title}}
-#' @seealso \code{\link{optimize.portfolio}}
-#' @author Ross Bennett
-#' @export
+
 charts.GenSA <- function(GenSA, rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=GenSA
   op <- par(no.readonly=TRUE)
-  layout(matrix(c(1,2)),height=c(2,2),width=1)
+  layout(matrix(c(1,2)),heights=c(2,2),widths=1)
   par(mar=c(4,4,4,2))
   chart.Scatter.GenSA(object=GenSA, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim, ...=...)
   par(mar=c(2,4,0,2))
@@ -165,14 +147,16 @@
   par(op)
 }
 
-#' scatter and weights chart for portfolios
+#' plot method for optimize.portfolio.DEoptim output
 #' 
+#' scatter and weights chart for GenSA portfolio optimizations run with trace=TRUE
+#' 
 #' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
 #' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
 #' 
 #' @param x object created by \code{\link{optimize.portfolio}}
 #' @param ... any other passthru parameters
-#' @param rp set of weights generated by \code{\link{random_portfolio}}
+#' @param rp TRUE/FALSE to plot feasible portfolios generated by \code{\link{random_portfolios}}
 #' @param return.col string matching the objective of a 'return' objective, on vertical axis
 #' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
 #' @param chart.assets TRUE/FALSE to include risk-return scatter of assets
@@ -184,6 +168,8 @@
 #' @param ylim set the limit on coordinates for the y-axis
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
+#' @method plot optimize.portfolio.GenSA
+#' @S3method plot optimize.portfolio.GenSA
 #' @export
 plot.optimize.portfolio.GenSA <- function(x, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="GenSA.Portfolios", xlim=NULL, ylim=NULL){
   charts.GenSA(GenSA=x, rp=rp, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...=...)

Modified: pkg/PortfolioAnalytics/R/charts.PSO.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.PSO.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/charts.PSO.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -1,6 +1,4 @@
 
-#' @rdname chart.Weights
-#' @export
 chart.Weights.pso <- function(object, neighbors = NULL, ..., main="Weights", las = 3, xlab=NULL, cex.lab = 1, element.color = "darkgray", cex.axis=0.8){
   
   if(!inherits(object, "optimize.portfolio.pso")) stop("object must be of class 'optimize.portfolio.pso'")
@@ -70,12 +68,11 @@
   box(col = element.color)
 }
 
-#' @rdname chart.Weights
+#' @method chart.Weights optimize.portfolio.pso
+#' @S3method chart.Weights optimize.portfolio.pso
 #' @export
 chart.Weights.optimize.portfolio.pso <- chart.Weights.pso
 
-#' @rdname chart.RiskReward
-#' @export
 chart.Scatter.pso <- function(object, neighbors=NULL, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
   if(!inherits(object, "optimize.portfolio.pso")) stop("object must be of class 'optimize.portfolio.pso'")
   
@@ -191,30 +188,16 @@
   box(col = element.color)
 }
 
-#' @rdname chart.RiskReward
+#' @method chart.RiskReward optimize.portfolio.pso
+#' @S3method chart.RiskReward optimize.portfolio.pso
 #' @export
 chart.RiskReward.optimize.portfolio.pso <- chart.Scatter.pso
 
-#' scatter and weights chart for portfolios
-#' 
-#' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
-#' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
-#' 
-#' @param pso object created by \code{\link{optimize.portfolio}}
-#' @param return.col string matching the objective of a 'return' objective, on vertical axis
-#' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
-#' @param ... any other passthru parameters 
-#' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
-#' @param element.color color for the default plot scatter points
-#'  @param neighbors set of 'neighbor' portfolios to overplot
-#' @param main an overall title for the plot: see \code{\link{title}}
-#' @seealso \code{\link{optimize.portfolio}}
-#' @author Ross Bennett
-#' @export
+
 charts.pso <- function(pso, return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=pso
   op <- par(no.readonly=TRUE)
-  layout(matrix(c(1,2)),height=c(2,2),width=1)
+  layout(matrix(c(1,2)),heights=c(2,2),widths=1)
   par(mar=c(4,4,4,2))
   chart.Scatter.pso(object=pso, return.col=return.col, risk.col=risk.col, chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim, ...=...)
   par(mar=c(2,4,0,2))
@@ -222,12 +205,14 @@
   par(op)
 }
 
-#' scatter and weights chart for portfolios
+#' plot method for optimize.portfolio.pso output
 #' 
+#' scatter and weights chart for pso portfolio optimizations run with trace=TRUE
+#' 
 #' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
 #' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
 #' 
-#' @param pso object created by \code{\link{optimize.portfolio}}
+#' @param x object created by \code{\link{optimize.portfolio}}
 #' @param ... any other passthru parameters 
 #' @param return.col string matching the objective of a 'return' objective, on vertical axis
 #' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
@@ -240,6 +225,8 @@
 #' @param ylim set the limit on coordinates for the y-axis
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
+#' @method plot optimize.portfolio.pso
+#' @S3method plot optimize.portfolio.pso
 #' @export
 plot.optimize.portfolio.pso <- function(x, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="PSO.Portfolios", xlim=NULL, ylim=NULL){
   charts.pso(pso=x, return.col=return.col, risk.col=risk.col, chart.assets=FALSE, cex.axis=cex.axis, element.color=element.color, neighbors=neighbors, main=main, xlim=xlim, ylim=ylim, ...=...)

Modified: pkg/PortfolioAnalytics/R/charts.ROI.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.ROI.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/charts.ROI.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -1,6 +1,4 @@
 
-#' @rdname chart.Weights
-#' @export
 chart.Weights.ROI <- function(object, neighbors = NULL, ..., main="Weights", las = 3, xlab=NULL, cex.lab = 1, element.color = "darkgray", cex.axis=0.8){
 
   if(!inherits(object, "optimize.portfolio.ROI")) stop("object must be of class 'optimize.portfolio.ROI'")
@@ -70,13 +68,13 @@
   box(col = element.color)
 }
 
-#' @rdname chart.Weights
+#' @method chart.Weights optimize.portfolio.ROI
+#' @S3method chart.Weights optimize.portfolio.ROI
 #' @export
 chart.Weights.optimize.portfolio.ROI <- chart.Weights.ROI
 
-#' @rdname chart.RiskReward
-#' @export
-chart.Scatter.ROI <- function(object, neighbors=NULL, ..., rp=FALSE, return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL){
+
+chart.Scatter.ROI <- function(object, neighbors=NULL, ..., return.col="mean", risk.col="ES", chart.assets=FALSE, element.color = "darkgray", cex.axis=0.8, xlim=NULL, ylim=NULL, rp=FALSE){
   
   if(!inherits(object, "optimize.portfolio.ROI")) stop("object must be of class 'optimize.portfolio.ROI'")
   
@@ -134,34 +132,16 @@
   box(col = element.color)
 }
 
-#' @rdname chart.RiskReward
+#' @method chart.RiskReward optimize.portfolio.ROI
+#' @S3method chart.RiskReward optimize.portfolio.ROI
 #' @export
 chart.RiskReward.optimize.portfolio.ROI <- chart.Scatter.ROI
 
-#' scatter and weights chart for portfolios
-#' 
-#' The ROI optimizers do not store the portfolio weights like DEoptim or random
-#' portfolios so we will generate random portfolios for the scatter plot. 
-#' 
-#' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
-#' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
-#' 
-#' @param ROI object created by \code{\link{optimize.portfolio}}
-#' @param rp set of weights generated by \code{\link{random_portfolio}}
-#' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
-#' @param return.col string matching the objective of a 'return' objective, on vertical axis
-#' @param ... any other passthru parameters 
-#' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
-#' @param element.color color for the default plot scatter points
-#'  @param neighbors set of 'neighbor' portfolios to overplot
-#' @param main an overall title for the plot: see \code{\link{title}}
-#' @seealso \code{\link{optimize.portfolio}}
-#' @author Ross Bennett
-#' @export
+
 charts.ROI <- function(ROI, rp=FALSE, risk.col="ES", return.col="mean", chart.assets=FALSE, cex.axis=0.8, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", xlim=NULL, ylim=NULL, ...){
   # Specific to the output of the optimize_method=ROI
   op <- par(no.readonly=TRUE)
-  layout(matrix(c(1,2)),height=c(2,1.5),width=1)
+  layout(matrix(c(1,2)),heights=c(2,1.5),widths=1)
   par(mar=c(4,4,4,2))
   chart.Scatter.ROI(object=ROI, rp=rp, return.col=return.col, risk.col=risk.col, ..., chart.assets=chart.assets, element.color=element.color, cex.axis=cex.axis, main=main, xlim=xlim, ylim=ylim)
   par(mar=c(2,4,0,2))
@@ -169,21 +149,25 @@
   par(op)
 }
 
-#' scatter and weights chart for portfolios
+#' plot method for optimize.portfolio.ROI output
 #' 
+#' scatter and weights chart for ROI portfolio optimizations run with trace=TRUE
+#' 
+#' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
+#' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
+#' 
 #' The ROI optimizers do not store the portfolio weights like DEoptim or random
-#' portfolios so we will generate random portfolios for the scatter plot. 
+#' portfolios random portfolios can be generated for the scatter plot. 
 #' 
 #' \code{return.col} must be the name of a function used to compute the return metric on the random portfolio weights
 #' \code{risk.col} must be the name of a function used to compute the risk metric on the random portfolio weights
 #' 
 #' @param x object created by \code{\link{optimize.portfolio}}
 #' @param ... any other passthru parameters 
-#' @param rp set of weights generated by \code{\link{random_portfolio}}
+#' @param rp TRUE/FALSE to plot feasible portfolios generated by \code{\link{random_portfolios}}
 #' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis
 #' @param return.col string matching the objective of a 'return' objective, on vertical axis
 #' @param chart.assets TRUE/FALSE to include risk-return scatter of assets
-#' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}
 #' @param element.color color for the default plot scatter points
 #' @param neighbors set of 'neighbor' portfolios to overplot
 #' @param main an overall title for the plot: see \code{\link{title}}
@@ -191,6 +175,8 @@
 #' @param ylim set the limit on coordinates for the y-axis
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
+#' @method plot optimize.portfolio.ROI
+#' @S3method plot optimize.portfolio.ROI
 #' @export
 plot.optimize.portfolio.ROI <- function(x, ..., rp=FALSE, risk.col="ES", return.col="mean", chart.assets=FALSE, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", xlim=NULL, ylim=NULL){
   charts.ROI(ROI=x, rp=rp, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, main=main, xlim=xlim, ylim=ylim, ...)

Modified: pkg/PortfolioAnalytics/R/charts.RP.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.RP.R	2013-09-05 00:11:33 UTC (rev 2993)
+++ pkg/PortfolioAnalytics/R/charts.RP.R	2013-09-05 01:40:09 UTC (rev 2994)
@@ -10,12 +10,8 @@
 #
 ###############################################################################
 
-#' @rdname chart.Weights
-#' @export
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 2994


More information about the Returnanalytics-commits mailing list