Learn R Programming

PerformanceAnalytics (version 2.0.4)

chart.RollingCorrelation: chart rolling correlation fo multiple assets

Description

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

Usage

chart.RollingCorrelation(
  Ra,
  Rb,
  width = 12,
  xaxis = TRUE,
  legend.loc = NULL,
  colorset = (1:12),
  ...,
  fill = NA
)

Arguments

Ra

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

Rb

return vector of the benchmark asset

width

number of periods to apply rolling function window over

xaxis

if true, draws the x axis

legend.loc

places a legend into one of nine locations on the chart: bottomright, bottom, bottomleft, left, topleft, top, topright, right, or center.

colorset

color palette to use, set by default to rational choices

any other passthru parameters

fill

a three-component vector or list (recycled otherwise) providing filling values at the left/within/to the right of the data range. See the fill argument of na.fill for details.

Details

The previous parameter na.pad has been replaced with fill; use fill = NA instead of na.pad = TRUE, or fill = NULL instead of na.pad = FALSE.

Examples

Run this code
# NOT RUN {
# First we get the data
data(managers)
chart.RollingCorrelation(managers[, 1:6, drop=FALSE], 
		managers[, 8, drop=FALSE], 
		colorset=rich8equal, legend.loc="bottomright", 
		width=24, main = "Rolling 12-Month Correlation")

# }

Run the code above in your browser using DataLab