Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
braverock
GitHub Repository: braverock/portfolioanalytics
Path: blob/master/R/chart.RiskReward.R
1433 views
1
2
3
#' classic risk reward scatter
4
#'
5
#' This function charts the \code{optimize.portfolio} object in risk-return space.
6
#'
7
#' @details
8
#' \code{neighbors} may be specified in three ways.
9
#' The first is as a single number of neighbors. This will extract the \code{neighbors} closest
10
#' portfolios in terms of the \code{out} numerical statistic.
11
#' The second method consists of a numeric vector for \code{neighbors}.
12
#' This will extract the \code{neighbors} with portfolio index numbers that correspond to the vector contents.
13
#' The third method for specifying \code{neighbors} is to pass in a matrix.
14
#' This matrix should look like the output of \code{\link{extractStats}}, and should contain
15
#' \code{risk.col},\code{return.col}, and weights columns all properly named.
16
#'
17
#' @param object optimal portfolio created by \code{\link{optimize.portfolio}}.
18
#' @param neighbors set of 'neighbor' portfolios to overplot, see Details.
19
#' @param \dots any other passthru parameters.
20
#' @param return.col string matching the objective of a 'return' objective, on vertical axis.
21
#' @param risk.col string matching the objective of a 'risk' objective, on horizontal axis.
22
#' @param chart.assets TRUE/FALSE. Includes a risk reward scatter of the assets in the chart.
23
#' @param element.color color for the default plot scatter points.
24
#' @param cex.axis The magnification to be used for axis annotation relative to the current setting of \code{cex}.
25
#' @param xlim set the x-axis limit, same as in \code{\link{plot}}.
26
#' @param ylim set the y-axis limit, same as in \code{\link{plot}}.
27
#' @param rp TRUE/FALSE to generate random portfolios to plot the feasible space
28
#' @param main a main title for the plot.
29
#' @param labels.assets TRUE/FALSE to include the names in the plot.
30
#' @param pch.assets plotting character of the assets, same as in \code{\link{plot}}
31
#' @param cex.assets numerical value giving the amount by which the asset points should be magnified relative to the default.
32
#' @param cex.lab numerical value giving the amount by which the labels should be magnified relative to the default.
33
#' @param colorset color palette or vector of colors to use.
34
#' @seealso \code{\link{optimize.portfolio}}
35
#' @export
36
chart.RiskReward <- function(object, ...){
37
UseMethod("chart.RiskReward")
38
}
39
40
41
###############################################################################
42
# R (https://r-project.org/) Numeric Methods for Optimization of Portfolios
43
#
44
# Copyright (c) 2004-2021 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt
45
#
46
# This library is distributed under the terms of the GNU Public License (GPL)
47
# for full details see the file COPYING
48
#
49
# $Id$
50
#
51
###############################################################################
52
53