Description Usage Arguments Details Value Note Author(s) References Examples
Creates graph of one performance metric vs. another as allocation for two-fund portfolio(s) ranges from 0% to 100%. A common application would be plotting mean vs. standard deviation of daily or monthly investment gains.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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,
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 or matrix of ticker symbols. If a vector, first and second elements are assumed to be first pair, third and fourth are assumed to be the second pair, and so on. If a matrix, should have two rows, and each column should represent a different pair. |
intercepts |
Numeric vector or matrix of values to add to daily gains for each ticker. For
example, if you have two tickers and want to simulate a 1% annual expense ratio
for only the second fund, you would set
|
slopes |
Numeric vector or matrix to multiply daily gains for each ticker by. For
example, if you have two tickers and want to simulate a 2x leveraged version of
the second fund, you would set |
... |
Arguments to pass along with |
benchmark.tickers |
Character vector of length 1 or 2 indicating ticker symbols for benchmark
indexes, to be used if |
reference.tickers |
Character string or vector of ticker symbols to include on the graph as a data point for comparative purposes. |
tickers.gains |
Numeric matrix of gains (daily or otherwise), where each column has gains for a particular fund. First and second column are assumed to be first pair, third and fourth are assumed to be second pair, and so on. |
benchmark.gains |
Numeric vector or matrix of gains for benchmark indexes. Only relevant if either
|
reference.gains |
Numeric vector or matrix of gains for reference funds. |
step.data |
Allocation increments for data used to fit curves. |
step.points |
Allocation increments for data points plotted on top of curves. Set to
|
x.metric |
Character string specifying what performance metric should be plotted on x-axis.
Possible values are as follows: |
y.metric |
Same as |
tickerlabel.offsets |
Either a numeric vector of length 2 giving the x-axis and y-axis offsets for
ticker labels, or a 2-column matrix where each row gives the x-axis offset and
y-axis offset for a particular ticker, following the same order of tickers as in
the |
reflabel.offsets |
Either a numeric vector of length 2 giving the x-axis and y-axis offsets for
reference ticker labels, or a 2-column matrix where each row gives the x-axis
offset and y-axis offset for a particular reference ticker, following the same
order of tickers as in the |
add.plot |
If |
colors |
Character string of colors for each fund pair. |
plot.list |
Optional list of inputs to pass to |
points.list |
Optional list of inputs to pass to |
text.list |
Optional list of inputs to pass to |
pdf.list |
Optional list of inputs to pass to |
bmp.list |
Optional list of inputs to pass to |
jpeg.list |
Optional list of inputs to pass to |
png.list |
Optional list of inputs to pass to |
tiff.list |
Optional list of inputs to pass to |
If tickers
is specified, it gets passed to load.gains
to
load historical prices from Yahoo! Finance using the quantmod package
[1]. If tickers.gains
is specified, performance metrics are calculated
directly from that matrix.
In addition to the graph, a list containing the following items: (1) A list
named portfolio.xy
where each element is a two-column matrix of x- and
y-axis values for a fund pair; (2) a numeric vector named means
of mean
gains for each ticker; and (3) a numeric matrix named corr.matrix
containing a correlation matrix for gains of each ticker.
NA
Dane R. Van Domelen
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.
1 |
Loading required package: rbenchmark
[1] NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.