Learn R Programming

PerformanceAnalytics (version 1.0.2.1)

chart.RollingPerformance: wrapper to create a chart of rolling performance metrics in a line chart

Description

A wrapper to create a chart of rolling performance metrics in a line chart

Usage

chart.RollingPerformance(R, width = 12, xaxis = TRUE, legend.loc = NULL, colorset = (1:12), FUN = "Return.annualized", na.pad = TRUE, type = "l", pch = NULL, lty = 1, bg = NULL, cex.axis=0.8, cex.legend = 0.8, cex.labels = 0.7, lwd = 2, xlim = NULL, ylim = NULL, log = "", main = NULL, sub = NULL, xlab = "Date", ylab = NULL, ann = par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, asp = NA, ylog = FALSE, event.lines = NULL, event.labels = NULL, period.areas = NULL, event.color = "darkgray", period.color = "lightgray", element.color = "darkgray", major.ticks='auto', minor.ticks=TRUE, grid.color="lightgray", grid.lty="dotted", ...)

Arguments

R
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns
width
number of periods to apply rolling function window over
FUN
any function that can be evaluated using a single set of returns (e.g., rolling CAPM.beta won't work, but Return.annualized will)
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.
ylog
TRUE/FALSE set the y-axis to logarithmic scale, similar to plot, default FALSE
legend.loc
places a legend into one of nine locations on the chart: bottomright, bottom, bottomleft, left, topleft, top, topright, right, or center.
main
set the chart title, same as in plot
event.lines
If not null, vertical lines will be drawn to indicate that an event happened during that time period. event.lines should be a list of dates (e.g., c("09/03","05/06")) formatted the same as date.format. This function matches the
event.labels
if not null and event.lines is not null, this will apply a list of text labels (e.g., c("This Event", "That Event") to the vertical lines drawn
event.color
draws the event described in event.labels in the color specified
period.areas
these are shaded areas described by start and end dates in the same format as the date.format. This is provided as a list of pairs, e.g., list(c("10/26","11/27"), c("08/29","03/33")) See the examples below.
period.color
draws the shaded region described by period.areas in the color specified
type
set the chart type, same as in plot
xaxis
if true, draws the x axis
ylab
set the y-axis label, same as in plot
xlab
set the x-axis label, same as in plot
xlim
set the x-axis limit, same as in plot
ylim
set the y-axis limit, same as in plot
pch
symbols to use, see also plot
lty
set the line type, same as in plot
lwd
set the line width, same as in plot
colorset
color palette to use, set by default to rational choices
bg
same as in plot
cex
set the y-axis limit, same as in plot
log
not used
sub
same as in plot
ann
same as in plot
axes
same as in plot
frame.plot
same as in plot
panel.first
same as in plot
panel.last
same as in plot
asp
same as in plot
cex.axis
The magnification to be used for axis annotation relative to the current setting of 'cex', same as in plot.
cex.legend
The magnification to be used for sizing the legend relative to the current setting of 'cex'.
cex.labels
The magnification to be used for event line labels relative to the current setting of 'cex'.
major.ticks
Should major tickmarks be drawn and labeled, default 'auto'
minor.ticks
Should minor tickmarks be drawn, default TRUE
grid.color
sets the color for the reference grid
grid.lty
defines the line type for the grid
element.color
provides the color for drawing chart elements, such as the box lines, axis lines, etc. Default is "darkgray"
...
any other passthru parameters to rollapply

See Also

charts.RollingPerformance, rollapply

Examples

Run this code
data(edhec)
chart.RollingPerformance(edhec[, 1:3], width = 24)
chart.RollingPerformance(edhec[, 1:3], FUN = 'mean', width = 24, colorset = rich8equal, lwd = 2, legend.loc = "topleft", main = "Rolling 24-Month Mean Return")
chart.RollingPerformance(edhec[, 1:3], FUN = 'SharpeRatio.annualized', width = 24, colorset = rich8equal, lwd = 2, legend.loc = "topleft", main = "Rolling 24-Month Sharpe Ratio")

Run the code above in your browser using DataLab