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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 31 22:51:16 CEST 2013


Author: rossbennett34
Date: 2013-07-31 22:51:16 +0200 (Wed, 31 Jul 2013)
New Revision: 2690

Added:
   pkg/PortfolioAnalytics/man/chart.Scatter.ROI.Rd
   pkg/PortfolioAnalytics/man/chart.Weights.ROI.Rd
   pkg/PortfolioAnalytics/man/charts.ROI.Rd
Modified:
   pkg/PortfolioAnalytics/R/charts.ROI.R
Log:
adding plot method and documentation for ROI charts

Modified: pkg/PortfolioAnalytics/R/charts.ROI.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.ROI.R	2013-07-31 20:30:18 UTC (rev 2689)
+++ pkg/PortfolioAnalytics/R/charts.ROI.R	2013-07-31 20:51:16 UTC (rev 2690)
@@ -220,8 +220,34 @@
   op <- par(no.readonly=TRUE)
   layout(matrix(c(1,2)),height=c(2,1.5),width=1)
   par(mar=c(4,4,4,2))
-  chart.Scatter.ROI(ROI, R, rp=rp, portfolio=NULL, return.col=return.col, risk.col=risk.col, ..., element.color=element.color, cex.axis=cex.axis, main=main)
+  chart.Scatter.ROI(ROI, R, rp=rp, portfolio=portfolio, return.col=return.col, risk.col=risk.col, ..., element.color=element.color, cex.axis=cex.axis, main=main)
   par(mar=c(2,4,0,2))
   chart.Weights.ROI(ROI, neighbors=neighbors, ..., main="", las=3, xlab=NULL, cex.lab=1, element.color=element.color, cex.axis=ce.axis)
   par(op)
 }
+
+#' 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 R an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns, used to recalulate the risk and return metric
+#' @param rp set of weights generated by \code{\link{random_portfolio}}
+#' @param portfolio pass in a different portfolio object used in set.portfolio.moments
+#' @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
+plot.optimize.portfolio.ROI <- function(ROI, R, rp=NULL, portfolio=NULL, risk.col="StdDev", return.col="mean", element.color="darkgray", neighbors=NULL, main="ROI.Portfolios", ...){
+  charts.ROI(ROI=ROI, R=R, rp=rp, portfolio=portfolio, risk.col=risk.col, return.col=return.col, main=main, ...)
+}

Added: pkg/PortfolioAnalytics/man/chart.Scatter.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.Scatter.ROI.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/chart.Scatter.ROI.Rd	2013-07-31 20:51:16 UTC (rev 2690)
@@ -0,0 +1,54 @@
+\name{chart.Scatter.ROI}
+\alias{chart.Scatter.ROI}
+\title{classic risk return scatter of random portfolios}
+\usage{
+  chart.Scatter.ROI(ROI, R, rp = NULL, portfolio = NULL,
+    return.col = "mean", risk.col = "StdDev", ...,
+    element.color = "darkgray", cex.axis = 0.8, main = "")
+}
+\arguments{
+  \item{ROI}{object created by
+  \code{\link{optimize.portfolio}}}
+
+  \item{R}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns, used to recalulate the
+  risk and return metric}
+
+  \item{rp}{set of weights generated by
+  \code{\link{random_portfolio}}}
+
+  \item{portfolio}{pass in a different portfolio object
+  used in set.portfolio.moments}
+
+  \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{cex.axis}{The magnification to be used for axis
+  annotation relative to the current setting of \code{cex}}
+
+  \item{element.color}{color for the default plot scatter
+  points}
+}
+\description{
+  The ROI optimizers do not store the portfolio weights
+  like DEoptim or random portfolios so we will generate
+  random portfolios for the scatter plot.
+}
+\details{
+  \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
+}
+\author{
+  Ross Bennett
+}
+\seealso{
+  \code{\link{optimize.portfolio}}
+}
+

Added: pkg/PortfolioAnalytics/man/chart.Weights.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.Weights.ROI.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/chart.Weights.ROI.Rd	2013-07-31 20:51:16 UTC (rev 2690)
@@ -0,0 +1,47 @@
+\name{chart.Weights.ROI}
+\alias{chart.Weights.ROI}
+\title{boxplot of the weights in the portfolio}
+\usage{
+  chart.Weights.ROI(ROI, neighbors = NULL, ...,
+    main = "Weights", las = 3, xlab = NULL, cex.lab = 1,
+    element.color = "darkgray", cex.axis = 0.8)
+}
+\arguments{
+  \item{ROI}{object created by
+  \code{\link{optimize.portfolio}}}
+
+  \item{neighbors}{set of 'neighbor' portfolios to
+  overplot}
+
+  \item{las}{numeric in \{0,1,2,3\}; the style of axis
+  labels \describe{ \item{0:}{always parallel to the axis
+  [\emph{default}],} \item{1:}{always horizontal,}
+  \item{2:}{always perpendicular to the axis,}
+  \item{3:}{always vertical.} }}
+
+  \item{xlab}{a title for the x axis: see
+  \code{\link{title}}}
+
+  \item{cex.lab}{The magnification to be used for x and y
+  labels relative to the current setting of \code{cex}}
+
+  \item{cex.axis}{The magnification to be used for axis
+  annotation relative to the current setting of \code{cex}}
+
+  \item{element.color}{color for the default plot lines}
+
+  \item{...}{any other passthru parameters}
+
+  \item{main}{an overall title for the plot: see
+  \code{\link{title}}}
+}
+\description{
+  boxplot of the weights in the portfolio
+}
+\author{
+  Ross Bennett
+}
+\seealso{
+  \code{\link{optimize.portfolio}}
+}
+

Added: pkg/PortfolioAnalytics/man/charts.ROI.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.ROI.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/charts.ROI.Rd	2013-07-31 20:51:16 UTC (rev 2690)
@@ -0,0 +1,61 @@
+\name{charts.ROI}
+\alias{charts.ROI}
+\title{scatter and weights chart for portfolios}
+\usage{
+  charts.ROI(ROI, R, rp = NULL, portfolio = NULL,
+    risk.col = "StdDev", return.col = "mean",
+    cex.axis = 0.8, element.color = "darkgray",
+    neighbors = NULL, main = "ROI.Portfolios", ...)
+}
+\arguments{
+  \item{ROI}{object created by
+  \code{\link{optimize.portfolio}}}
+
+  \item{R}{an xts, vector, matrix, data frame, timeSeries
+  or zoo object of asset returns, used to recalulate the
+  risk and return metric}
+
+  \item{rp}{set of weights generated by
+  \code{\link{random_portfolio}}}
+
+  \item{portfolio}{pass in a different portfolio object
+  used in set.portfolio.moments}
+
+  \item{risk.col}{string matching the objective of a 'risk'
+  objective, on horizontal axis}
+
+  \item{return.col}{string matching the objective of a
+  'return' objective, on vertical axis}
+
+  \item{...}{any other passthru parameters}
+
+  \item{cex.axis}{The magnification to be used for axis
+  annotation relative to the current setting of \code{cex}}
+
+  \item{element.color}{color for the default plot scatter
+  points}
+
+  \item{neighbors}{set of 'neighbor' portfolios to
+  overplot}
+
+  \item{main}{an overall title for the plot: see
+  \code{\link{title}}}
+}
+\description{
+  The ROI optimizers do not store the portfolio weights
+  like DEoptim or random portfolios so we will generate
+  random portfolios for the scatter plot.
+}
+\details{
+  \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
+}
+\author{
+  Ross Bennett
+}
+\seealso{
+  \code{\link{optimize.portfolio}}
+}
+



More information about the Returnanalytics-commits mailing list