Description Usage Arguments Value References Examples
View source: R/twofunds_graph.R
Useful for visualizing performance of twofund portfolios, typically by plotting a measure of growth vs. a measure of volatility. First two investments are used as the first twofund pair, next two as the second twofund pair, and so on.
1 2 3 4 5 6 7 8  twofunds_graph(tickers = NULL, intercepts = NULL, slopes = NULL, ...,
benchmark.tickers = NULL, reference.tickers = NULL,
tickers.gains = NULL, benchmark.gains = NULL, reference.gains = NULL,
step.data = 0.0025, step.points = 0.1, x.metric = "sd",
y.metric = "mean", tickerlabel.offsets = NULL, reflabel.offsets = NULL,
add.plot = FALSE, colors = NULL, lty = 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)

tickers 
Character vector of ticker symbols that Yahoo! Finance recognizes, if you want to download data on the fly. 
intercepts 
Numeric vector of values to add to daily gains for each ticker. 
slopes 
Numeric vector of values to multiply daily gains for each ticker by. Slopes are multiplied prior to adding intercepts. 
... 
Arguments to pass along with 
benchmark.tickers 
Character vector of length 1 or 2 indicating ticker
symbols for benchmark indexes. Only used if 
reference.tickers 
Character vector of ticker symbols to include on graph as data points for comparative purposes. 
tickers.gains 
Numeric matrix of gains, where each column has gains for a particular fund. 
benchmark.gains 
Numeric vector or matrix of gains for 1 or 2 benchmark
indexes. Only used if 
reference.gains 
Numeric vector or matrix of gains for funds to include on graph as data points for comparative purposes. 
step.data 
Numeric value specifying allocation increments for plotting curves. 
step.points 
Numeric value specifying allocation increments for adding
data points on top of curves. Set to 
x.metric 
Character string specifying xaxis performance metric. Choices are:

y.metric 
Same as 
tickerlabel.offsets 
Either a numeric vector of length 2 giving the x and yaxis offsets for all ticker labels, or a 2column matrix where each row gives the x and yaxis offsets for a ticker. 
reflabel.offsets 
Either a numeric vector of length 2 giving the x and yaxis offsets for all reference ticker labels, or a 2column matrix where each row gives the x and yaxis offsets for a reference 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. 
lty 
Numeric vector specifying line types for each curve. 
plot.list 
List of arguments to pass to 
points.list 
List of arguments to pass to

text.list 
List of arguments to pass to 
pdf.list 
List of arguments to pass to 
bmp.list 
List of arguments to pass to 
jpeg.list 
List of arguments to pass to 
png.list 
List of arguments to pass to 
tiff.list 
List of arguments to pass to 
In addition to the graph, a list containing:
List named portfolio.xy
where each element is a twocolumn
matrix of x and yaxis values for a fund pair.
Numeric vector named means
with mean gains for each fund.
Numeric matrix named corr.matrix
with a correlation matrix for
gains for each fund.
Ryan, J.A. and Ulrich, J.M. (2017) quantmod: Quantitative Financial Modelling Framework. R package version 0.412, https://CRAN.Rproject.org/package=quantmod.
1 2 3 4 5 6 7 8 9 10 11  ## Not run:
# Plot mean vs. SD for UPRO/VBLTX portfolio, and compare to VFINX and BRKB
fig1 < twofunds_graph(tickers = c("UPRO", "VBLTX"),
reference.tickers = c("VFINX", "BRKB"))
# Same funds, but annualized growth vs. maximum drawdown
fig2 < twofunds_graph(tickers = c("UPRO", "VBLTX"),
reference.tickers = c("VFINX", "BRKB"),
x.metric = "mdd", y.metric = "cagr")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.