gains.graph {stocks} | R Documentation |
Creates scatterplot of gains (daily or otherwise) for one or more investments vs. another.
gains.graph(tickers = NULL, ..., gains = NULL, prices = NULL, orders = 1, 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)
tickers |
Character vector of ticker symbols. Gains for the first ticker are plotted on the x-axis, and gains for all other tickers are plotted on the y-axis. |
... |
Arguments to pass along with |
gains |
Numeric matrix of gains (daily or otherwise), where each column has gains for a particular investment. Gains from the first column are plotted on the x-axis, and gains for all other columns are plotted on the y-axis. |
prices |
Numeric matrix of prices (daily or otherwise), where each column has prices for a particular investment. Gains derived from the first column are plotted on the x-axis, and gains derived from all other columns are plotted on the y-axis. |
orders |
Numeric value or vector of values specifying the order of linear regression
models for each y-axis fund. Set to |
add.plot |
If |
colors |
Character string of colors for each y-axis investment. |
plot.list |
Optional list of inputs to pass to |
points.list |
Optional list of inputs to pass to |
legend.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
input 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 graph is based directly
on that information. Either way, the first fund's gains are plotted on the
x-axis, and all the others are plotted on the y-axis.
In addition to the graph, a list containing fitted linear regression models
returned by the lm
function for each y-axis fund vs. the x-axis
fund.
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.
NA