twometrics_graph: Graph One Performance Metric vs. Another for Various...

Description Usage Arguments Value References Examples

Description

Useful for visualizing the performance of a group of investments. The first investment is used as the benchmark if x.metric or y.metric require one benchmark, and the first two investments are used as benchmarks if x.metric and y.metric require different benchmarks.

Usage

1
2
3
4
5
twometrics_graph(tickers = NULL, ..., gains = NULL, prices = NULL,
  x.metric = "mdd", y.metric = "cagr", tickerlabel.offsets = NULL,
  add.plot = FALSE, colors = NULL, plot.list = NULL, points.list = NULL,
  text.list = NULL, pdf.list = NULL, bmp.list = NULL, jpeg.list = NULL,
  png.list = NULL, tiff.list = NULL)

Arguments

tickers

Character vector of ticker symbols that Yahoo! Finance recognizes, if you want to download data on the fly.

...

Arguments to pass along with tickers to load_gains.

gains

Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one).

prices

Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one).

x.metric

Character string specifying x-axis performance metric. Choices are:

"mean" or "sd" for mean or standard deviation of gains.

"growth" or "cagr" for total or annualized growth.

"mdd" for maximum drawdown.

"sharpe" or "sortino" for Sharpe or Sortino ratio.

"alpha", "beta", or "r.squared" for those metrics from a fitted linear regression on benchmark fund.

"pearson" or "spearman" for Pearson or Spearman correlation with benchmark fund.

"alpha2", "beta2", "r.squared2", "pearson2", or "spearman2" for same as previously described, but using the second benchmark index.

"auto.pearson" or "auto.spearman" for Pearson or Spearman autocorrelation, defined as the correlation between subsequent gains.

y.metric

Same as x.metric, but for the y-axis.

tickerlabel.offsets

Either a numeric vector of length 2 giving the x- and y-axis offsets for all ticker labels, or a 2-column matrix where each row gives the x- and y-axis offsets for a ticker.

add.plot

Logical value for whether to add plot data to current plot frame rather than open a new one.

colors

Character vector of colors for each curve.

plot.list

List of arguments to pass to plot.

points.list

List of arguments to pass to points.

text.list

List of arguments to pass to text.

pdf.list

List of arguments to pass to pdf.

bmp.list

List of arguments to pass to bmp.

jpeg.list

List of arguments to pass to jpeg.

png.list

List of arguments to pass to png.

tiff.list

List of arguments to pass to tiff.

Value

In addition to the graph, a data frame containing the performance metrics for each investment.

References

Ryan, J.A. and Ulrich, J.M. (2017) quantmod: Quantitative Financial Modelling Framework. R package version 0.4-12, https://CRAN.R-project.org/package=quantmod.

Examples

1
2
3
4
5
## Not run: 
# Plot annualized growth vs. maximum drawdown for VFINX, SSO, and UPRO
fig <- twometrics_graph(tickers = c("VFINX", "SSO", "UPRO"))

## End(Not run)

stocks documentation built on May 2, 2019, 9:43 a.m.