chart.RollingCorrelation {PerformanceAnalytics} | R Documentation

## 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), na.pad = FALSE, ...)

### Arguments

`Ra` | a 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
`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.
`...` | any other passthru parameters

### Details

### Value

chart rolling period correlations of one or more assets

### Note

### Author(s)

Peter Carl

### References

### See Also

### Examples

    # First we get the data
    data(edhec)
    edhec.length = dim(edhec)[1]
    start = rownames(edhec[1,])
    start
    end = rownames(edhec[edhec.length,])

    edhec.zoo = zoo(edhec, order.by = rownames(edhec))
    sp500.zoo = download.SP500PriceReturns(start = "1996-12-31", end = end)

    # Then align the dates as "monthly" data
    time(edhec.zoo) = as.yearmon(time(edhec.zoo))
    time(sp500.zoo) = as.yearmon(time(sp500.zoo))
    data.zoo = merge(edhec.zoo[,9,drop=FALSE],sp500.zoo)
    time(data.zoo) = as.Date(time(data.zoo),format="%b %Y")

    # Finally, plot it
    chart.RollingCorrelation(data.zoo[, 1, drop=FALSE], data.zoo[, 2, drop=FALSE], colorset=rich8equal, legend.loc="bottomright", lwd=2, width=24)

[Package PerformanceAnalytics version 0.9.5 Index]