[Returnanalytics-commits] r2907 - in pkg/PortfolioAnalytics: R man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 27 21:56:32 CEST 2013


Author: rossbennett34
Date: 2013-08-27 21:56:32 +0200 (Tue, 27 Aug 2013)
New Revision: 2907

Modified:
   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.efficient.frontier.R
   pkg/PortfolioAnalytics/R/constraints.R
   pkg/PortfolioAnalytics/R/extractstats.R
   pkg/PortfolioAnalytics/R/random_portfolios.R
   pkg/PortfolioAnalytics/man/add.constraint.Rd
   pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd
   pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.Rd
   pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.rebalancing.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.pso.Rd
   pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd
   pkg/PortfolioAnalytics/man/return_constraint.Rd
   pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw
Log:
Cleaning up documentation and generic methods

Modified: pkg/PortfolioAnalytics/R/charts.DE.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.DE.R	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/charts.DE.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -338,11 +338,14 @@
 #' \code{risk.col},\code{return.col}, and weights columns all properly named.  
 #' @param x set of portfolios created by \code{\link{optimize.portfolio}}
 #' @param ... any other passthru parameters 
+#' @param return.col string name of column to use for returns (vertical axis)
 #' @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 chart.assets TRUE/FALSE to include risk-return scatter of assets
 #' @param neighbors set of 'neighbor portfolios to overplot
 #' @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
 #' @export
-plot.optimize.portfolio.DEoptim <- function(x, ..., return.col='mean', risk.col='ES',  chart.assets=FALSE, neighbors=NULL, xlim=NULL, ylim=NULL, main='optimized portfolio plot') {
+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-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/charts.GenSA.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -170,18 +170,21 @@
 #' \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 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 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 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 neighbors set of 'neighbor' portfolios to overplot
 #' @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
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.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, ...){
-  charts.GenSA(GenSA=GenSA, 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, ...=...)
+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-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/charts.PSO.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -228,16 +228,19 @@
 #' \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 ... 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 ... any other passthru parameters 
+#' @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 neighbors set of 'neighbor' portfolios to overplot
 #' @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
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.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, ...){
-  charts.pso(pso=pso, 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, ...=...)
+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-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/charts.ROI.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -177,18 +177,21 @@
 #' \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 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 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 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 neighbors set of 'neighbor' portfolios to overplot
 #' @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
 #' @seealso \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-plot.optimize.portfolio.ROI <- function(ROI, rp=FALSE, risk.col="ES", return.col="mean", chart.assets=chart.assets, element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", xlim=NULL, ylim=NULL, ...){
-  charts.ROI(ROI=ROI, rp=rp, risk.col=risk.col, return.col=return.col, chart.assets=chart.assets, main=main, xlim=xlim, ylim=ylim, ...)
+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.efficient.frontier.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -47,6 +47,7 @@
 #' @param rf risk free rate. If \code{rf} is not null, the maximum Sharpe Ratio or modified Sharpe Ratio tangency portfolio will be plotted
 #' @param cex.legend A numerical value giving the amount by which the legend should be magnified relative to the default.
 #' @param RAR.text Risk Adjusted Return ratio text to plot in the legend
+#' @param chart.assets TRUE/FALSE to include risk-return scatter of assets
 #' @author Ross Bennett
 #' @export
 chart.EfficientFrontier <- function(object, match.col="ES", n.portfolios=25, xlim=NULL, ylim=NULL, cex.axis=0.8, element.color="darkgray", main="Efficient Frontier", ...){
@@ -356,7 +357,7 @@
 
 #' @rdname chart.EfficientFrontier
 #' @export
-chart.EfficientFrontier.efficient.frontier <- function(object, chart.assets=TRUE, match.col="ES", n.portfolios=NULL, xlim=NULL, ylim=NULL, cex.axis=0.8, element.color="darkgray", main="Efficient Frontier", ..., RAR.text="Modified Sharpe", rf=0, cex.legend=0.8){
+chart.EfficientFrontier.efficient.frontier <- function(object, match.col="ES", n.portfolios=NULL, xlim=NULL, ylim=NULL, cex.axis=0.8, element.color="darkgray", main="Efficient Frontier", ..., RAR.text="Modified Sharpe", rf=0, chart.assets=TRUE, cex.legend=0.8){
   if(!inherits(object, "efficient.frontier")) stop("object must be of class 'efficient.frontier'")
   
   # get the returns and efficient frontier object

Modified: pkg/PortfolioAnalytics/R/constraints.R
===================================================================
--- pkg/PortfolioAnalytics/R/constraints.R	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/constraints.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -236,7 +236,7 @@
 #' # Add box constraints
 #' pspec <- add.constraint(portfolio=pspec, type="box", min=0.05, max=0.4)
 #' 
-#' min and max can also be specified per asset
+#' # min and max can also be specified per asset
 #' pspec <- add.constraint(portfolio=pspec, type="box", min=c(0.05, 0, 0.08, 0.1), max=c(0.4, 0.3, 0.7, 0.55))
 #' # A special case of box constraints is long only where min=0 and max=1
 #' # The default action is long only if min and max are not specified
@@ -244,7 +244,7 @@
 #' pspec <- add.constraint(portfolio=pspec, type="long_only")
 #' 
 #' # Add group constraints
-#' pspec <- add.constraint(portfolio=pspec, type="group", groups=c(3, 1), group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1))
+#' pspec <- add.constraint(portfolio=pspec, type="group", groups=list(c(1, 2, 1), 4), group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1))
 #' 
 #' # Add position limit constraint such that we have a maximum number of three assets with non-zero weights.
 #' pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3)
@@ -820,7 +820,7 @@
 #' 
 #' pspec <- portfolio.spec(assets=colnames(ret))
 #' 
-#' pspec <- add.constraint(portfolio=pspec, type="return", div_target=mean(colMeans(ret)))
+#' pspec <- add.constraint(portfolio=pspec, type="return", return_target=mean(colMeans(ret)))
 #' @export
 return_constraint <- function(type="return", return_target, enabled=TRUE, message=FALSE, ...){
   Constraint <- constraint_v2(type, enabled=enabled, constrclass="return_constraint", ...)

Modified: pkg/PortfolioAnalytics/R/extractstats.R
===================================================================
--- pkg/PortfolioAnalytics/R/extractstats.R	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/extractstats.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -173,12 +173,13 @@
 
 #' extract weights from output of optimize.portfolio
 #' 
-#' @param object object of type optimize.portfolio to extract weights from
+#' @param object object of class \code{optimize.portfolio} to extract weights from
+#' @param ... passthrough parameters. Not currently used
 #' @seealso 
 #' \code{\link{optimize.portfolio}}
 #' @author Ross Bennett
 #' @export
-extractWeights.optimize.portfolio <- function(object){
+extractWeights.optimize.portfolio <- function(object, ...){
   if(!inherits(object, "optimize.portfolio")){
     stop("object must be of class 'optimize.portfolio'")
   }
@@ -192,28 +193,28 @@
 #' 
 #' The output list is indexed by the dates of the rebalancing periods, as determined by \code{endpoints}
 #' 
-#' @param RebalResults object of type optimize.portfolio.rebalancing to extract weights from
+#' @param object object of class \code{optimize.portfolio.rebalancing} to extract weights from
 #' @param ... any other passthru parameters
 #' @seealso 
 #' \code{\link{optimize.portfolio.rebalancing}}
 #' @export
-extractWeights.optimize.portfolio.rebalancing <- function(RebalResults, ...){
+extractWeights.optimize.portfolio.rebalancing <- function(object, ...){
 # @TODO: add a class check for the input object
 # FIXED
-  if(!inherits(RebalResults, "optimize.portfolio.rebalancing")){
+  if(!inherits(object, "optimize.portfolio.rebalancing")){
     stop("Object passed in must be of class 'optimize.portfolio.rebalancing'")
   }
   
-  numColumns = length(RebalResults[[1]]$weights)
-  numRows = length(RebalResults)
+  numColumns = length(object[[1]]$weights)
+  numRows = length(object)
 
   result <- matrix(nrow=numRows, ncol=numColumns)
 
   for(i in 1:numRows)
-    result[i,] = unlist(RebalResults[[i]]$weights)
+    result[i,] = unlist(object[[i]]$weights)
 
-  colnames(result) = names(unlist(RebalResults[[1]]$weights))
-  rownames(result) = names(RebalResults)
+  colnames(result) = names(unlist(object[[1]]$weights))
+  rownames(result) = names(object)
   result = as.xts(result)
   return(result)
 }

Modified: pkg/PortfolioAnalytics/R/random_portfolios.R
===================================================================
--- pkg/PortfolioAnalytics/R/random_portfolios.R	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/R/random_portfolios.R	2013-08-27 19:56:32 UTC (rev 2907)
@@ -171,7 +171,7 @@
 #' @export
 #' @examples
 #' rpconstraint<-constraint(assets=10, min_mult=-Inf, max_mult=Inf, min_sum=.99, max_sum=1.01, min=.01, max=.4, weight_seq=generatesequence())
-#' rp<- random_portfolios(rpconstraints=rpconstraint,permutations=1000)
+#' rp<- random_portfolios_v1(rpconstraints=rpconstraint,permutations=1000)
 #' head(rp)
 random_portfolios_v1 <- function (rpconstraints,permutations=100,...)
 { # 

Modified: pkg/PortfolioAnalytics/man/add.constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/add.constraint.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/add.constraint.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -81,7 +81,7 @@
 # Add box constraints
 pspec <- add.constraint(portfolio=pspec, type="box", min=0.05, max=0.4)
 
-min and max can also be specified per asset
+# min and max can also be specified per asset
 pspec <- add.constraint(portfolio=pspec, type="box", min=c(0.05, 0, 0.08, 0.1), max=c(0.4, 0.3, 0.7, 0.55))
 # A special case of box constraints is long only where min=0 and max=1
 # The default action is long only if min and max are not specified
@@ -89,7 +89,7 @@
 pspec <- add.constraint(portfolio=pspec, type="long_only")
 
 # Add group constraints
-pspec <- add.constraint(portfolio=pspec, type="group", groups=c(3, 1), group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1))
+pspec <- add.constraint(portfolio=pspec, type="group", groups=list(c(1, 2, 1), 4), group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1))
 
 # Add position limit constraint such that we have a maximum number of three assets with non-zero weights.
 pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3)

Modified: pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -25,11 +25,12 @@
     RAR.text = "Modified Sharpe", rf = 0, cex.legend = 0.8)
 
   chart.EfficientFrontier.efficient.frontier(object,
-    chart.assets = TRUE, match.col = "ES",
-    n.portfolios = NULL, xlim = NULL, ylim = NULL,
-    cex.axis = 0.8, element.color = "darkgray",
+    match.col = "ES", n.portfolios = NULL, xlim = NULL,
+    ylim = NULL, cex.axis = 0.8,
+    element.color = "darkgray",
     main = "Efficient Frontier", ...,
-    RAR.text = "Modified Sharpe", rf = 0, cex.legend = 0.8)
+    RAR.text = "Modified Sharpe", rf = 0,
+    chart.assets = TRUE, cex.legend = 0.8)
 }
 \arguments{
   \item{object}{optimal portfolio created by
@@ -72,6 +73,9 @@
 
   \item{RAR.text}{Risk Adjusted Return ratio text to plot
   in the legend}
+
+  \item{chart.assets}{TRUE/FALSE to include risk-return
+  scatter of assets}
 }
 \description{
   This function charts the efficient frontier and

Modified: pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -2,11 +2,13 @@
 \alias{extractWeights.optimize.portfolio}
 \title{extract weights from output of optimize.portfolio}
 \usage{
-  extractWeights.optimize.portfolio(object)
+  extractWeights.optimize.portfolio(object, ...)
 }
 \arguments{
-  \item{object}{object of type optimize.portfolio to
-  extract weights from}
+  \item{object}{object of class \code{optimize.portfolio}
+  to extract weights from}
+
+  \item{...}{passthrough parameters. Not currently used}
 }
 \description{
   extract weights from output of optimize.portfolio

Modified: pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.rebalancing.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.rebalancing.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/extractWeights.optimize.portfolio.rebalancing.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -2,12 +2,13 @@
 \alias{extractWeights.optimize.portfolio.rebalancing}
 \title{extract time series of weights from output of optimize.portfolio.rebalancing}
 \usage{
-  extractWeights.optimize.portfolio.rebalancing(RebalResults,
+  extractWeights.optimize.portfolio.rebalancing(object,
     ...)
 }
 \arguments{
-  \item{RebalResults}{object of type
-  optimize.portfolio.rebalancing to extract weights from}
+  \item{object}{object of class
+  \code{optimize.portfolio.rebalancing} to extract weights
+  from}
 
   \item{...}{any other passthru parameters}
 }

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.DEoptim.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -4,8 +4,9 @@
 \usage{
   plot.optimize.portfolio.DEoptim(x, ...,
     return.col = "mean", risk.col = "ES",
-    chart.assets = FALSE, neighbors = NULL, xlim = NULL,
-    ylim = NULL, main = "optimized portfolio plot")
+    chart.assets = FALSE, neighbors = NULL,
+    main = "optimized portfolio plot", xlim = NULL,
+    ylim = NULL)
 }
 \arguments{
   \item{x}{set of portfolios created by
@@ -13,16 +14,23 @@
 
   \item{...}{any other passthru parameters}
 
+  \item{return.col}{string name of column to use for
+  returns (vertical axis)}
+
   \item{risk.col}{string name of column to use for risk
   (horizontal axis)}
 
-  \item{return.col}{string name of column to use for
-  returns (vertical axis)}
+  \item{chart.assets}{TRUE/FALSE to include risk-return
+  scatter of assets}
 
   \item{neighbors}{set of 'neighbor portfolios to overplot}
 
   \item{main}{an overall title for the plot: see
   \code{\link{title}}}
+
+  \item{xlim}{set the limit on coordinates for the x-axis}
+
+  \item{ylim}{set the limit on coordinates for the y-axis}
 }
 \description{
   scatter and weights chart for DEoptim portfolio

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.GenSA.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -2,17 +2,18 @@
 \alias{plot.optimize.portfolio.GenSA}
 \title{scatter and weights chart for portfolios}
 \usage{
-  plot.optimize.portfolio.GenSA(GenSA, rp = FALSE,
+  plot.optimize.portfolio.GenSA(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,
-    ...)
+    main = "GenSA.Portfolios", xlim = NULL, ylim = NULL)
 }
 \arguments{
-  \item{GenSA}{object created by
+  \item{x}{object created by
   \code{\link{optimize.portfolio}}}
 
+  \item{...}{any other passthru parameters}
+
   \item{rp}{set of weights generated by
   \code{\link{random_portfolio}}}
 
@@ -22,7 +23,8 @@
   \item{risk.col}{string matching the objective of a 'risk'
   objective, on horizontal axis}
 
-  \item{...}{any other passthru parameters}
+  \item{chart.assets}{TRUE/FALSE to include risk-return
+  scatter of assets}
 
   \item{cex.axis}{The magnification to be used for axis
   annotation relative to the current setting of \code{cex}}
@@ -35,6 +37,10 @@
 
   \item{main}{an overall title for the plot: see
   \code{\link{title}}}
+
+  \item{xlim}{set the limit on coordinates for the x-axis}
+
+  \item{ylim}{set the limit on coordinates for the y-axis}
 }
 \description{
   \code{return.col} must be the name of a function used to

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.ROI.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -2,16 +2,18 @@
 \alias{plot.optimize.portfolio.ROI}
 \title{scatter and weights chart for portfolios}
 \usage{
-  plot.optimize.portfolio.ROI(ROI, rp = FALSE,
+  plot.optimize.portfolio.ROI(x, ..., rp = FALSE,
     risk.col = "ES", return.col = "mean",
-    chart.assets = chart.assets,
-    element.color = "darkgray", neighbors = NULL,
-    main = "ROI.Portfolios", xlim = NULL, ylim = NULL, ...)
+    chart.assets = FALSE, element.color = "darkgray",
+    neighbors = NULL, main = "ROI.Portfolios", xlim = NULL,
+    ylim = NULL)
 }
 \arguments{
-  \item{ROI}{object created by
+  \item{x}{object created by
   \code{\link{optimize.portfolio}}}
 
+  \item{...}{any other passthru parameters}
+
   \item{rp}{set of weights generated by
   \code{\link{random_portfolio}}}
 
@@ -21,7 +23,8 @@
   \item{return.col}{string matching the objective of a
   'return' objective, on vertical axis}
 
-  \item{...}{any other passthru parameters}
+  \item{chart.assets}{TRUE/FALSE to include risk-return
+  scatter of assets}
 
   \item{cex.axis}{The magnification to be used for axis
   annotation relative to the current setting of \code{cex}}
@@ -34,6 +37,10 @@
 
   \item{main}{an overall title for the plot: see
   \code{\link{title}}}
+
+  \item{xlim}{set the limit on coordinates for the x-axis}
+
+  \item{ylim}{set the limit on coordinates for the y-axis}
 }
 \description{
   The ROI optimizers do not store the portfolio weights

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.pso.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -2,22 +2,25 @@
 \alias{plot.optimize.portfolio.pso}
 \title{scatter and weights chart for portfolios}
 \usage{
-  plot.optimize.portfolio.pso(pso, return.col = "mean",
+  plot.optimize.portfolio.pso(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, ...)
+    main = "PSO.Portfolios", xlim = NULL, ylim = NULL)
 }
 \arguments{
   \item{pso}{object created by
   \code{\link{optimize.portfolio}}}
 
+  \item{...}{any other passthru parameters}
+
   \item{return.col}{string matching the objective of a
   'return' objective, on vertical axis}
 
   \item{risk.col}{string matching the objective of a 'risk'
   objective, on horizontal axis}
 
-  \item{...}{any other passthru parameters}
+  \item{chart.assets}{TRUE/FALSE to include risk-return
+  scatter of assets}
 
   \item{cex.axis}{The magnification to be used for axis
   annotation relative to the current setting of \code{cex}}
@@ -30,6 +33,10 @@
 
   \item{main}{an overall title for the plot: see
   \code{\link{title}}}
+
+  \item{xlim}{set the limit on coordinates for the x-axis}
+
+  \item{ylim}{set the limit on coordinates for the y-axis}
 }
 \description{
   \code{return.col} must be the name of a function used to

Modified: pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -25,7 +25,7 @@
 }
 \examples{
 rpconstraint<-constraint(assets=10, min_mult=-Inf, max_mult=Inf, min_sum=.99, max_sum=1.01, min=.01, max=.4, weight_seq=generatesequence())
-rp<- random_portfolios(rpconstraints=rpconstraint,permutations=1000)
+rp<- random_portfolios_v1(rpconstraints=rpconstraint,permutations=1000)
 head(rp)
 }
 \author{

Modified: pkg/PortfolioAnalytics/man/return_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/return_constraint.Rd	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/man/return_constraint.Rd	2013-08-27 19:56:32 UTC (rev 2907)
@@ -28,7 +28,7 @@
 
 pspec <- portfolio.spec(assets=colnames(ret))
 
-pspec <- add.constraint(portfolio=pspec, type="return", div_target=mean(colMeans(ret)))
+pspec <- add.constraint(portfolio=pspec, type="return", return_target=mean(colMeans(ret)))
 }
 \author{
   Ross Bennett

Modified: pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw
===================================================================
--- pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw	2013-08-27 18:29:05 UTC (rev 2906)
+++ pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw	2013-08-27 19:56:32 UTC (rev 2907)
@@ -156,7 +156,9 @@
 box_constr <- box_constraint(assets=pspec$assets, min=0, max=1)
 
 # group constraint
-group_constr <- group_constraint(assets=pspec$assets, groups=c(3, 1),
+group_constr <- group_constraint(assets=pspec$assets, 
+                                 groups=list(c(1, 2, 3),
+                                             4),
                                  group_min=c(0.1, 0.15), 
                                  group_max=c(0.85, 0.55),
                                  group_labels=c("GroupA", "GroupB"))



More information about the Returnanalytics-commits mailing list