Description Usage Arguments Details Value Author(s) References See Also Examples
A wrapper to create box and whiskers plot with some defaults useful for comparing distributions.
1 2 3 4 5 6 | chart.Boxplot(R, horizontal = TRUE, names = TRUE, as.Tufte = FALSE,
as.Notch = FALSE, sort.by = NULL, sort.base = NULL,
sort.ascending = FALSE, colorset = "black", symbol.color = "red",
mean.symbol = 1, median.symbol = "|", outlier.symbol = 1,
show.data = NULL, add.mean = TRUE, xlab = "Return",
main = "Return Distribution Comparison", element.color = "darkgray", ...)
|
R |
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns |
horizontal |
TRUE/FALSE plot horizontal (TRUE) or vertical (FALSE) |
names |
logical. if TRUE, show the names of each series |
as.Tufte |
logical. default FALSE. if TRUE use method derived for Tufte for limiting chartjunk |
as.Notch |
logical. default FALSE. if TRUE a notch
is drawn in each side of the boxes. See
|
sort.by |
one of the return or risk measure c("NULL", "mean", "median", "variance", "sharp ratio", "mean absolute deviation", "std dev", "sterling ratio", "calmar ratio", "burke ratio", "pain index", "ulcer index","martin ratio", "downside risk", "omega ratio", "sortino ratio", "upside risk","upside potential ratio", "omega sharpe ratio"). default is "NULL". |
sort.base |
one of the return or risk measure as
listed in |
sort.ascending |
logical. If TRUE sort the
distributions by ascending |
colorset |
color palette to use, set by default to rational choices |
symbol.color |
draws the symbols described in
|
mean.symbol |
symbol to use for the mean of the distribution |
median.symbol |
symbol to use for the median of the distribution |
outlier.symbol |
symbol to use for the outliers of the distribution |
show.data |
numerical vector of column numbers to display on top of boxplot, default NULL |
add.mean |
logical. if TRUE, show a line for the mean of all distributions plotted |
xlab |
set the x-axis label, same as in
|
main |
set the chart title, same as in
|
element.color |
specify the color of chart elements. Default is "darkgray" |
... |
any other passthru parameters |
We have also provided controls for all the symbols and
lines in the chart. One default, set by
as.Tufte=TRUE
, will strip chartjunk and draw a
Boxplot per recommendations by Edward Tufte. Another
default, set by as.Notch=TRUE
, will draw a notch in
each side of the boxes. It can also be useful when
comparing several series to sort them in the order of
ascending or descending return or risk measurement by use
of sort.by
and sort.ascending=TRUE
. In
addition, one can compare this with another user specified
order, called base order, e.g., to see the relative change
of the orders of the series between two measurements of
interest.
box plot of returns
Peter Carl
Ke Li kirkli@stat.washington.edu
Tufte, Edward R. The Visual Display of Quantitative Information. Graphics Press. 1983. p. 124-129
1 2 3 4 5 6 | data(edhec)
chart.Boxplot(edhec)
chart.Boxplot(edhec,as.Tufte=TRUE)
chart.Boxplot(R=edhec,sort.by="upside risk",
horizontal=TRUE, sort.base="std dev",
sort.ascending=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.