Uses a scatterplot to display the relationship of a set of returns to a market benchmark. Fits a linear model and overlays the resulting model. Also overlays a Loess line for comparison.
chart.Regression(
Ra,
Rb,
Rf = 0,
excess.returns = FALSE,
reference.grid = TRUE,
main = "Title",
ylab = NULL,
xlab = NULL,
xlim = NA,
colorset = 1:12,
symbolset = 1:12,
element.color = "darkgray",
legend.loc = NULL,
ylog = FALSE,
fit = c("loess", "linear", "conditional", "quadratic"),
span = 2/3,
degree = 1,
family = c("symmetric", "gaussian"),
ylim = NA,
evaluation = 50,
legend.cex = 0.8,
cex = 0.8,
lwd = 2,
...
)
a vector of returns to test, e.g., the asset to be examined
a matrix, data.frame, or timeSeries of benchmark(s) to test the asset against
risk free rate, in same period as the returns
logical; should excess returns be used?
if true, draws a grid aligned with the points on the x and y axes
set the chart title, same as in plot
set the y-axis title, same as in plot
set the x-axis title, same as in plot
set the x-axis limit, same as in plot
color palette to use
symbols to use, see also 'pch' in plot
provides the color for drawing chart elements, such as the box lines, axis lines, etc. Default is "darkgray"
places a legend into one of nine locations on the chart: bottomright, bottom, bottomleft, left, topleft, top, topright, right, or center.
Not used
for values of "loess", "linear", or "conditional", plots a line to fit the data. Conditional lines are drawn separately for positive and negative benchmark returns. "Quadratic" is not yet implemented.
passed to loess line fit, as in loess.smooth
passed to loess line fit, as in loess.smooth
passed to loess line fit, as in loess.smooth
set the y-axis limit, same as in plot
passed to loess line fit, as in loess.smooth
set the legend size
set the cex size, same as in plot
set the line width for fits, same as in lines
any other passthru parameters to plot
Peter Carl
Chapter 7 of Ruppert(2004) gives an extensive overview of CAPM, its assumptions and deficiencies.
data(managers)
chart.Regression(managers[, 1:2, drop = FALSE],
managers[, 8, drop = FALSE],
Rf = managers[, 10, drop = FALSE],
excess.returns = TRUE, fit = c("loess", "linear"),
legend.loc = "topleft")
Run the code above in your browser using DataLab