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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 8 01:57:59 CET 2015


Author: rossbennett34
Date: 2015-02-08 01:57:59 +0100 (Sun, 08 Feb 2015)
New Revision: 3598

Added:
   pkg/PortfolioAnalytics/man/chart.EF.Weights.Rd
Removed:
   pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd
Modified:
   pkg/PortfolioAnalytics/DESCRIPTION
   pkg/PortfolioAnalytics/NAMESPACE
   pkg/PortfolioAnalytics/R/charts.efficient.frontier.R
   pkg/PortfolioAnalytics/demo/demo_efficient_frontier.R
   pkg/PortfolioAnalytics/man/PortfolioAnalytics-package.Rd
Log:
/s/chart.Weights.EF/chart.EF.Weights to avoid clashing with other S3 method chart.Weights.*

bump version to match rev number

Modified: pkg/PortfolioAnalytics/DESCRIPTION
===================================================================
--- pkg/PortfolioAnalytics/DESCRIPTION	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/DESCRIPTION	2015-02-08 00:57:59 UTC (rev 3598)
@@ -11,7 +11,7 @@
   , person(given="Guy",family="Yollin",role="ctb")
   , person(given="R. Douglas",family="Martin",role="ctb")
   )
-Version: 0.9.3585
+Version: 0.9.3598
 Date: $Date$
 Maintainer: Brian G. Peterson <brian at braverock.com>
 Description: Portfolio optimization and analysis routines and graphics.

Modified: pkg/PortfolioAnalytics/NAMESPACE
===================================================================
--- pkg/PortfolioAnalytics/NAMESPACE	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/NAMESPACE	2015-02-08 00:57:59 UTC (rev 3598)
@@ -19,8 +19,8 @@
 S3method(chart.Weights,optimize.portfolio.pso)
 S3method(chart.Weights,optimize.portfolio.random)
 S3method(chart.Weights,optimize.portfolio.rebalancing)
-S3method(chart.Weights.EF,efficient.frontier)
-S3method(chart.Weights.EF,optimize.portfolio)
+S3method(chart.EF.Weights,efficient.frontier)
+S3method(chart.EF.Weights,optimize.portfolio)
 S3method(extractObjectiveMeasures,opt.list)
 S3method(extractObjectiveMeasures,opt.rebal.list)
 S3method(extractObjectiveMeasures,optimize.portfolio)
@@ -94,7 +94,7 @@
 export(chart.RiskBudget)
 export(chart.RiskReward)
 export(chart.Weights)
-export(chart.Weights.EF)
+export(chart.EF.Weights)
 export(combine.optimizations)
 export(combine.portfolios)
 export(constrained_objective)

Modified: pkg/PortfolioAnalytics/R/charts.efficient.frontier.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2015-02-08 00:57:59 UTC (rev 3598)
@@ -286,17 +286,17 @@
 #' @param element.color provides the color for drawing less-important chart elements, such as the box lines, axis lines, etc.
 #' @param legend.loc NULL, "topright", "right", or "bottomright". If legend.loc is NULL, the legend will not be plotted.
 #' @author Ross Bennett
-#' @rdname chart.Weights.EF
+#' @rdname chart.EF.Weights
 #' @export
-chart.Weights.EF <- function(object, ...){
-  UseMethod("chart.Weights.EF")
+chart.EF.Weights <- function(object, ...){
+  UseMethod("chart.EF.Weights")
 }
 
 
-#' @rdname chart.Weights.EF
-#' @method chart.Weights.EF efficient.frontier
-#' @S3method chart.Weights.EF efficient.frontier
-chart.Weights.EF.efficient.frontier <- function(object, ..., colorset=NULL, n.portfolios=25, by.groups=FALSE, match.col="ES", main="", cex.lab=0.8, cex.axis=0.8, cex.legend=0.8, legend.labels=NULL, element.color="darkgray", legend.loc="topright"){
+#' @rdname chart.EF.Weights
+#' @method chart.EF.Weights efficient.frontier
+#' @S3method chart.EF.Weights efficient.frontier
+chart.EF.Weights.efficient.frontier <- function(object, ..., colorset=NULL, n.portfolios=25, by.groups=FALSE, match.col="ES", main="", cex.lab=0.8, cex.axis=0.8, cex.legend=0.8, legend.labels=NULL, element.color="darkgray", legend.loc="topright"){
   # using ideas from weightsPlot.R in fPortfolio package
   
   if(!inherits(object, "efficient.frontier")) stop("object must be of class 'efficient.frontier'")
@@ -418,16 +418,16 @@
   box(col=element.color)
 }
 
-#' @rdname chart.Weights.EF
-#' @method chart.Weights.EF optimize.portfolio
-#' @S3method chart.Weights.EF optimize.portfolio
-chart.Weights.EF.optimize.portfolio <- function(object, ..., colorset=NULL, n.portfolios=25, by.groups=FALSE, match.col="ES", main="", cex.lab=0.8, cex.axis=0.8, cex.legend=0.8, legend.labels=NULL, element.color="darkgray", legend.loc="topright"){
+#' @rdname chart.EF.Weights
+#' @method chart.EF.Weights optimize.portfolio
+#' @S3method chart.EF.Weights optimize.portfolio
+chart.EF.Weights.optimize.portfolio <- function(object, ..., colorset=NULL, n.portfolios=25, by.groups=FALSE, match.col="ES", main="", cex.lab=0.8, cex.axis=0.8, cex.legend=0.8, legend.labels=NULL, element.color="darkgray", legend.loc="topright"){
   # chart the weights along the efficient frontier of an objected created by optimize.portfolio
   
   if(!inherits(object, "optimize.portfolio")) stop("object must be of class optimize.portfolio")
   
   frontier <- extractEfficientFrontier(object=object, match.col=match.col, n.portfolios=n.portfolios)
-  chart.Weights.EF(object=frontier, colorset=colorset, ..., 
+  chart.EF.Weights(object=frontier, colorset=colorset, ..., 
                    match.col=match.col, by.groups=by.groups, main=main, cex.lab=cex.lab, 
                    cex.axis=cex.axis, cex.legend=cex.legend, 
                    legend.labels=legend.labels, element.color=element.color,

Modified: pkg/PortfolioAnalytics/demo/demo_efficient_frontier.R
===================================================================
--- pkg/PortfolioAnalytics/demo/demo_efficient_frontier.R	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/demo/demo_efficient_frontier.R	2015-02-08 00:57:59 UTC (rev 3598)
@@ -70,19 +70,19 @@
                         tangent.line=FALSE, labels.assets=FALSE, pch.assets=1)
 
 #' Chart the asset weights along the efficient frontier.
-chart.Weights.EF(meanvar.ef, colorset=bluemono, match.col="StdDev")
+chart.EF.Weights(meanvar.ef, colorset=bluemono, match.col="StdDev")
 
 #' Chart the group weights along the efficient frontier.
-chart.Weights.EF(meanvar.ef, colorset=bluemono, by.groups=TRUE, match.col="StdDev")
+chart.EF.Weights(meanvar.ef, colorset=bluemono, by.groups=TRUE, match.col="StdDev")
 
 #' The labels for Mean, Weight, and StdDev can be increased or decreased with
 #' the cex.lab argument. The default is cex.lab=0.8.
-chart.Weights.EF(meanvar.ef, colorset=bluemono, match.col="StdDev", main="", cex.lab=1)
+chart.EF.Weights(meanvar.ef, colorset=bluemono, match.col="StdDev", main="", cex.lab=1)
 
 #' If you have a lot of assets and they don't fit with the default legend, you
 #' can set legend.loc=NULL and customize the plot.
 par(mar=c(8, 4, 4, 2)+0.1, xpd=TRUE)
-chart.Weights.EF(meanvar.ef, colorset=bluemono, match.col="StdDev", legend.loc=NULL)
+chart.EF.Weights(meanvar.ef, colorset=bluemono, match.col="StdDev", legend.loc=NULL)
 legend("bottom", legend=colnames(R), inset=-1, fill=bluemono, bty="n", ncol=3, cex=0.8)
 par(mar=c(5, 4, 4, 2)+0.1, xpd=FALSE)
 
@@ -105,9 +105,9 @@
 
 #' The weights along the efficient frontier can be plotted by passing in the
 #' optimize.portfolio output object.
-chart.Weights.EF(opt_meanvar, match.col="StdDev")
+chart.EF.Weights(opt_meanvar, match.col="StdDev")
 
-chart.Weights.EF(opt_meanvar, match.col="StdDev", by.groups=TRUE)
+chart.EF.Weights(opt_meanvar, match.col="StdDev", by.groups=TRUE)
 
 #' Extract the efficient frontier and then plot it.
 #' Note that if you want to do multiple charts of the efficient frontier from
@@ -116,8 +116,8 @@
 ef <- extractEfficientFrontier(object=opt_meanvar, match.col="StdDev", n.portfolios=15)
 ef
 summary(ef, digits=5)
-chart.Weights.EF(ef, match.col="StdDev", colorset=bluemono)
-chart.Weights.EF(ef, match.col="StdDev", colorset=bluemono, by.groups=TRUE)
+chart.EF.Weights(ef, match.col="StdDev", colorset=bluemono)
+chart.EF.Weights(ef, match.col="StdDev", colorset=bluemono, by.groups=TRUE)
 
 #' Compute the mean-ES efficient frontier.
 meanetl.ef <- create.EfficientFrontier(R=R, portfolio=init, type="mean-ES")
@@ -127,14 +127,14 @@
 
 #' Chart the mean-ES efficient frontier.
 chart.EfficientFrontier(meanetl.ef, match.col="ES", main="mean-ETL Efficient Frontier", type="l", col="blue", RAR.text="STARR")
-chart.Weights.EF(meanetl.ef, colorset=bluemono, match.col="ES")
-chart.Weights.EF(meanetl.ef, by.groups=TRUE, colorset=bluemono, match.col="ES")
+chart.EF.Weights(meanetl.ef, colorset=bluemono, match.col="ES")
+chart.EF.Weights(meanetl.ef, by.groups=TRUE, colorset=bluemono, match.col="ES")
 
 #' Compute the mean-ES efficient frontier using random portfolios to solve
 #' the optimization problem.
 meanetl.rp.ef <- create.EfficientFrontier(R=R, portfolio=meanetl.portf, type="random", match.col="ES")
 chart.EfficientFrontier(meanetl.rp.ef, match.col="ES", main="mean-ETL RP Efficient Frontier", type="l", col="blue", rf=0)
-chart.Weights.EF(meanetl.rp.ef, colorset=bluemono, match.col="ES")
+chart.EF.Weights(meanetl.rp.ef, colorset=bluemono, match.col="ES")
 
 # mean-etl efficient frontier with optimize.portfolio output
 opt_meanetl <- optimize.portfolio(R=R, portfolio=meanetl.portf, optimize_method="random", search_size=2000, trace=TRUE)

Modified: pkg/PortfolioAnalytics/man/PortfolioAnalytics-package.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/PortfolioAnalytics-package.Rd	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/man/PortfolioAnalytics-package.Rd	2015-02-08 00:57:59 UTC (rev 3598)
@@ -84,7 +84,7 @@
 
 \code{\link{chart.Weights}} plots the weights of the optimal portfolio. \code{\link{chart.RiskReward}} plots the optimal portfolio in risk-reward space. The random portfolios, DEoptim, and pso solvers will return trace portfolio information at each iteration when \code{\link{optimize.portfolio}} is run with \code{trace=TRUE}. If this is the case, \code{\link{chart.RiskReward}} will plot these portfolios so that the feasible space can be easily visualized. Although the GenSA and ROI solvers do not return trace portfolio information, random portfolios can be be generated with the argument \code{rp=TRUE} in \code{\link{chart.RiskReward}}. A \code{plot} function is provided that will plot the weights and risk-reward scatter chart. The component risk contribution can be charted for portfolio optimization problems with risk budget objectives with \code{\link{chart.RiskBudget}}. Neighbor portfolios can be plotted in \code{\link{chart.RiskBudget}}, \code{\link{chart.Weights}}, and \code{\link{chart.RiskReward}}.
 
-Efficient frontiers can be extracted from \code{optimize.portfolio} objects or created from a \code{portfolio} object. The efficient frontier can be charted in risk-reward space with \code{\link{chart.EfficientFrontier}}. The weights along the efficient frontier can be charted with \code{\link{chart.Weights.EF}}.
+Efficient frontiers can be extracted from \code{optimize.portfolio} objects or created from a \code{portfolio} object. The efficient frontier can be charted in risk-reward space with \code{\link{chart.EfficientFrontier}}. The weights along the efficient frontier can be charted with \code{\link{chart.EF.Weights}}.
 
 Multiple objects created via \code{\link{optimize.portfolio}} can be combined with \code{\link{combine.optimizations}} for visual comparison. The weights of the optimal portfolios can be plotted with \code{\link{chart.Weights}}. The optimal portfolios can be compared in risk-reward space with \code{\link{chart.RiskReward}}. The portfolio component risk contributions of the multiple optimal portfolios can be plotted with \code{\link{chart.RiskBudget}}.
 }

Added: pkg/PortfolioAnalytics/man/chart.EF.Weights.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.EF.Weights.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/chart.EF.Weights.Rd	2015-02-08 00:57:59 UTC (rev 3598)
@@ -0,0 +1,54 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/charts.efficient.frontier.R
+\name{chart.EF.Weights}
+\alias{chart.EF.Weights}
+\alias{chart.EF.Weights.efficient.frontier}
+\alias{chart.EF.Weights.optimize.portfolio}
+\title{Chart weights along an efficient frontier}
+\usage{
+chart.EF.Weights(object, ...)
+
+\method{chart.EF.Weights}{efficient.frontier}(object, ..., colorset = NULL,
+  n.portfolios = 25, by.groups = FALSE, match.col = "ES", main = "",
+  cex.lab = 0.8, cex.axis = 0.8, cex.legend = 0.8, legend.labels = NULL,
+  element.color = "darkgray", legend.loc = "topright")
+
+\method{chart.EF.Weights}{optimize.portfolio}(object, ..., colorset = NULL,
+  n.portfolios = 25, by.groups = FALSE, match.col = "ES", main = "",
+  cex.lab = 0.8, cex.axis = 0.8, cex.legend = 0.8, legend.labels = NULL,
+  element.color = "darkgray", legend.loc = "topright")
+}
+\arguments{
+\item{object}{object of class \code{efficient.frontier} or \code{optimize.portfolio}.}
+
+\item{colorset}{color palette or vector of colors to use.}
+
+\item{n.portfolios}{number of portfolios to extract along the efficient frontier.}
+
+\item{by.groups}{TRUE/FALSE. If TRUE, the group weights are charted.}
+
+\item{match.col}{string name of column to use for risk (horizontal axis). Must match the name of an objective.}
+
+\item{main}{title used in the plot.}
+
+\item{cex.lab}{the magnification to be used for x-axis and y-axis labels relative to the current setting of 'cex'.}
+
+\item{cex.axis}{the magnification to be used for sizing the axis text relative to the current setting of 'cex', similar to \code{\link{plot}}.}
+
+\item{cex.legend}{the magnification to be used for sizing the legend relative to the current setting of 'cex', similar to \code{\link{plot}}.}
+
+\item{legend.labels}{character vector to use for the legend labels.}
+
+\item{element.color}{provides the color for drawing less-important chart elements, such as the box lines, axis lines, etc.}
+
+\item{legend.loc}{NULL, "topright", "right", or "bottomright". If legend.loc is NULL, the legend will not be plotted.}
+
+\item{\dots}{passthru parameters to \code{barplot}.}
+}
+\description{
+This function produces a stacked barplot of weights along an efficient frontier.
+}
+\author{
+Ross Bennett
+}
+

Deleted: pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd	2015-02-08 00:25:24 UTC (rev 3597)
+++ pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd	2015-02-08 00:57:59 UTC (rev 3598)
@@ -1,54 +0,0 @@
-% Generated by roxygen2 (4.1.0): do not edit by hand
-% Please edit documentation in R/charts.efficient.frontier.R
-\name{chart.Weights.EF}
-\alias{chart.Weights.EF}
-\alias{chart.Weights.EF.efficient.frontier}
-\alias{chart.Weights.EF.optimize.portfolio}
-\title{Chart weights along an efficient frontier}
-\usage{
-chart.Weights.EF(object, ...)
-
-\method{chart.Weights.EF}{efficient.frontier}(object, ..., colorset = NULL,
-  n.portfolios = 25, by.groups = FALSE, match.col = "ES", main = "",
-  cex.lab = 0.8, cex.axis = 0.8, cex.legend = 0.8, legend.labels = NULL,
-  element.color = "darkgray", legend.loc = "topright")
-
-\method{chart.Weights.EF}{optimize.portfolio}(object, ..., colorset = NULL,
-  n.portfolios = 25, by.groups = FALSE, match.col = "ES", main = "",
-  cex.lab = 0.8, cex.axis = 0.8, cex.legend = 0.8, legend.labels = NULL,
-  element.color = "darkgray", legend.loc = "topright")
-}
-\arguments{
-\item{object}{object of class \code{efficient.frontier} or \code{optimize.portfolio}.}
-
-\item{colorset}{color palette or vector of colors to use.}
-
-\item{n.portfolios}{number of portfolios to extract along the efficient frontier.}
-
-\item{by.groups}{TRUE/FALSE. If TRUE, the group weights are charted.}
-
-\item{match.col}{string name of column to use for risk (horizontal axis). Must match the name of an objective.}
-
-\item{main}{title used in the plot.}
-
-\item{cex.lab}{the magnification to be used for x-axis and y-axis labels relative to the current setting of 'cex'.}
-
-\item{cex.axis}{the magnification to be used for sizing the axis text relative to the current setting of 'cex', similar to \code{\link{plot}}.}
-
-\item{cex.legend}{the magnification to be used for sizing the legend relative to the current setting of 'cex', similar to \code{\link{plot}}.}
-
-\item{legend.labels}{character vector to use for the legend labels.}
-
-\item{element.color}{provides the color for drawing less-important chart elements, such as the box lines, axis lines, etc.}
-
-\item{legend.loc}{NULL, "topright", "right", or "bottomright". If legend.loc is NULL, the legend will not be plotted.}
-
-\item{\dots}{passthru parameters to \code{barplot}.}
-}
-\description{
-This function produces a stacked barplot of weights along an efficient frontier.
-}
-\author{
-Ross Bennett
-}
-



More information about the Returnanalytics-commits mailing list