chart.Boxplot2: box whiskers plot wrapper

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

A wrapper to create box and whiskers plot with some defaults useful for comparing distributions.

Usage

1
2
3
4
5
6
7
chart.Boxplot2(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",
  ...)

Arguments

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 boxplot

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.by, add the base order number next to the labels sorted by sort.by

sort.ascending

logical. If TRUE sort the distributions by ascending sort.by and sort.base

colorset

color palette to use, set by default to rational choices

symbol.color

draws the symbols described in mean.symbol,median.symbol,outlier.symbol in the color specified

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 plot

main

set the chart title, same as in plot

element.color

specify the color of chart elements. Default is "darkgray"

...

any other passthru parameters

Details

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.

Value

box plot of returns

Author(s)

Peter Carl

Ke Li kirkli@stat.washington.edu

References

Tufte, Edward R. The Visual Display of Quantitative Information. Graphics Press. 1983. p. 124-129

See Also

boxplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(MASS)
library(PerformanceAnalytics)
data(edhec)

# Panel 1: vertical box, sort by Sortino ratio

chart.Boxplot2(R=edhec ,sort.by="Sortino ratio",
horizontal=FALSE , as.Tufte=TRUE)


# Panel 2: horizontal box, sort by Sortino ratio 

chart.Boxplot2(R=edhec ,sort.by="Sortino ratio",
horizontal=TRUE, as.Notch=TRUE)

# Panel 3: vertical box, sort by mean, with base order variance

chart.Boxplot2(R=edhec ,sort.by="mean", horizontal=FALSE
, sort.base="variance", sort.ascending=TRUE)

# Panel 4: horizontal box, sort by mean, with base order variance
# descending sort

chart.Boxplot2(R=edhec ,sort.by="mean", horizontal=FALSE
, sort.base="variance", sort.ascending=FALSE)

kecoli/mpo documentation built on May 20, 2019, 8:34 a.m.