onemetric_overtime_graph: Graph Performance Metric Over Time

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

Description

Create plot comparing a performance metric across several investments over a period of time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
onemetric.overtime.graph(tickers = NULL, ...,
                         gains = NULL,
                         prices = NULL,
                         y.metric = "cagr",
                         window.units = 50,
                         add.plot = FALSE,
                         colors = NULL,
                         plot.list = NULL,
                         points.list = NULL,
                         legend.list = NULL,
                         pdf.list = NULL,
                         bmp.list = NULL,
                         jpeg.list = NULL,
                         png.list = NULL,
                         tiff.list = NULL)

Arguments

tickers

Character vector of ticker symbols. If y.metric requires a benchmark index, the first ticker is taken to be the benchmark.

...

Arguments to pass along with tickers to load.gains function, if you wish to load data on the fly rather than specify gains or prices.

gains

Numeric matrix of gains (daily or otherwise), where each column has gains for a particular investment. If y.metric requires a benchmark index, the first column should be gains for the benchmark.

prices

Numeric matrix of prices (daily or otherwise), where each column has prices for a particular investment. If y.metric requires a benchmark index, the first column should be prices for the benchmark.

y.metric

Character string specifying what performance metric should be plotted. Possible values are as follows: "mean" for mean of gains; "sd" for standard deviation of gains; "growth" for total growth; "cagr" for compound annualized growth rate; "mdd" for maximum drawdown; "sharpe" for Sharpe ratio; "sortino" for Sortino ratio; "alpha" or "beta" for alpha and beta from capital assets pricing model theory; "r.squared" for R-squared from regression on benchmark fund; "pearson" or "spearman" for Pearson or Spearman correlation with benchmark fund; or "auto.pearson" or "auto.spearman" for Pearson or Spearman autocorrelation, defined as the correlation between subsequent gains.

window.units

Numeric value indicating the width of the moving window. For example, if time.scale = "daily" and window.units = 50, the plot will show the performance metric for each 50-gain (51-day) interval spanning the time period of interest.

add.plot

If TRUE, data is plotted on current plot frame rather than a new one.

colors

Character string of colors for each fund.

plot.list

Optional list of inputs to pass to plot function.

points.list

Optional list of inputs to pass to points function.

legend.list

Optional list of inputs to pass to legend function.

pdf.list

Optional list of inputs to pass to pdf function. If not NULL, .pdf file is created.

bmp.list

Optional list of inputs to pass to bmp function. If not NULL, .bmp file is created.

jpeg.list

Optional list of inputs to pass to jpeg function. If not NULL, .jpg file is created.

png.list

Optional list of inputs to pass to png function. If not NULL, .png file is created.

tiff.list

Optional list of inputs to pass to tiff function. If not NULL, .tif file is created.

Details

If tickers is specified, it gets passed to load.gains to load historical prices from Yahoo! Finance using the quantmod package [1]. If gains or prices is specified, the performance metric is calculated directly from that information.

Value

In addition to the graph, a numeric matrix where each column contains the performance metric over time for a particular fund.

Note

NA

Author(s)

Dane R. Van Domelen

References

1. Jeffrey A. Ryan (2016). quantmod: Quantitative Financial Modelling Framework. R package version 0.4-6, https://cran.r-project.org/package=quantmod.

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

onemetric.graph, twometrics.graph

Examples

1

Example output

Loading required package: rbenchmark
[1] NA

stocks documentation built on May 2, 2019, 5:22 p.m.