Description Usage Arguments Note Author(s) Examples
A wrapper to create a scatter chart of annualized returns versus annualized risk (standard deviation) for comparing manager performance. Also puts a box plot into the margins to help identify the relative performance quartile.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | chart.RiskReturnScatter(
R,
Rf = 0,
main = "Annualized Return and Risk",
add.names = TRUE,
xlab = "Annualized Risk",
ylab = "Annualized Return",
method = "calc",
geometric = TRUE,
scale = NA,
add.sharpe = c(1, 2, 3),
add.boxplots = FALSE,
colorset = 1,
symbolset = 1,
element.color = "darkgray",
legend.loc = NULL,
xlim = NULL,
ylim = NULL,
cex.legend = 1,
cex.axis = 0.8,
cex.main = 1,
cex.lab = 1,
...
)
|
R |
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns |
Rf |
risk free rate, in same period as your returns |
main |
set the chart title, same as in |
add.names |
plots the row name with the data point. default TRUE. Can be removed by setting it to NULL |
xlab |
set the x-axis label, as in |
ylab |
set the y-axis label, as in |
method |
if set as "calc", then the function will calculate values from the set of returns passed in. If method is set to "nocalc" then we assume that R is a column of return and a column of risk (e.g., annualized returns, annualized risk), in that order. Other method cases may be set for different risk/return calculations. |
geometric |
utilize geometric chaining (TRUE) or simple/arithmetic chaining (FALSE) to aggregate returns, default TRUE |
scale |
number of periods in a year (daily scale = 252, monthly scale = 12, quarterly scale = 4) |
add.sharpe |
this draws a Sharpe ratio line that indicates Sharpe ratio
levels of |
add.boxplots |
TRUE/FALSE adds a boxplot summary of the data on the axis |
colorset |
color palette to use, set by default to rational choices |
symbolset |
from |
element.color |
provides the color for drawing chart elements, such as the box lines, axis lines, etc. Default is "darkgray" |
legend.loc |
places a legend into one of nine locations on the chart: bottomright, bottom, bottomleft, left, topleft, top, topright, right, or center. |
xlim |
set the x-axis limit, same as in |
ylim |
set the y-axis limit, same as in |
cex.legend |
The magnification to be used for sizing the legend relative to the current setting of 'cex'. |
cex.axis |
The magnification to be used for axis annotation relative to
the current setting of 'cex', same as in |
cex.main |
The magnification to be used for sizing the title relative to the current setting of 'cex'. |
cex.lab |
The magnification to be used for x and y labels relative to the current setting of 'cex'. |
... |
any other passthru parameters to |
Code inspired by a chart on: http://zoonek2.free.fr/UNIX/48_R/03.html
Peter Carl
1 2 3 | data(edhec)
chart.RiskReturnScatter(edhec, Rf = .04/12)
chart.RiskReturnScatter(edhec, Rf = .04/12, add.boxplots = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.