chart.RollingRegression: A wrapper to create charts of relative regression performance...

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

Description

A wrapper to create a chart of relative regression performance through time

Usage

1
2
3
4
5
6
7
8
9
chart.RollingQuantileRegression(Ra, Rb, width = 12, Rf = 0,
  attribute = c("Beta", "Alpha", "R-Squared"), main = NULL, na.pad = TRUE,
  ...)

chart.RollingRegression(Ra, Rb, width = 12, Rf = 0, attribute = c("Beta",
  "Alpha", "R-Squared"), main = NULL, na.pad = TRUE, ...)

charts.RollingRegression(Ra, Rb, width = 12, Rf = 0, main = NULL,
  legend.loc = NULL, event.labels = NULL, ...)

Arguments

Ra

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

Rb

return vector of the benchmark asset

Rf

risk free rate, in same period as your returns

width

number of periods to apply rolling function window over

attribute

one of "Beta","Alpha","R-Squared" for which attribute to show

main

set the chart title, same as in plot

na.pad

TRUE/FALSE If TRUE it adds any times that would not otherwise have been in the result with a value of NA. If FALSE those times are dropped.

legend.loc

used to set the position of the legend

event.labels

if not null and event.lines is not null, this will apply a list of text labels to the vertical lines drawn

...

any other passthru parameters to chart.TimeSeries

Details

A group of charts in charts.RollingRegression displays alpha, beta, and R-squared estimates in three aligned charts in a single device.

The attribute parameter is probably the most confusing. In mathematical terms, the different choices yield the following:

Alpha - shows the y-intercept
Beta - shows the slope of the regression line
R-Squared - shows the degree of fit of the regression to the data

chart.RollingQuantileRegression uses rq rather than lm for the regression, and may be more robust to outliers in the data.

Note

Most inputs are the same as "plot" and are principally included so that some sensible defaults could be set.

Author(s)

Peter Carl

See Also

lm
rq

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# First we load the data
data(managers)
chart.RollingRegression(managers[, 1, drop=FALSE],
		managers[, 8, drop=FALSE], Rf = .04/12)
charts.RollingRegression(managers[, 1:6],
		managers[, 8, drop=FALSE], Rf = .04/12,
		colorset = rich6equal, legend.loc="topleft")
dev.new()
chart.RollingQuantileRegression(managers[, 1, drop=FALSE],
		managers[, 8, drop=FALSE], Rf = .04/12)
# not implemented yet
#charts.RollingQuantileRegression(managers[, 1:6],
#		managers[, 8, drop=FALSE], Rf = .04/12,
#		colorset = rich6equal, legend.loc="topleft")

guillermozbta/portafolio-master documentation built on May 11, 2019, 7:20 p.m.