TrackingError {PerformanceAnalytics} | R Documentation

## Calculate Tracking Error of returns against a benchmark

### Description

A measure of the unexplained portion of performance relative to a benchmark.

### Usage

    TrackingError(Ra, Rb, scale = 12)

### Arguments

`Ra` | a vector, matrix, data frame, timeSeries or zoo object of asset returns
`Rb` | return vector of the benchmark asset
`scale` | number of periods in a year (daily scale = 252, monthly scale = 12, quarterly scale = 4)

### Details

Tracking error is calculated by taking the square root of the average of the squared deviations between the investment's returns and the benchmark's returns, then multiplying the result by the square root of the scale of the returns.

TrackingError = sqrt(sum(Ra - Rb)^2 / (length(Ra) - 1)) * sqrt(scale)

### Value

Tracking Error (number)

### Note

### Author(s)

Peter Carl

### References

Sharpe, W.F. The Sharpe Ratio,Journal of Portfolio Management,Fall 1994, 49-58.

### See Also

`InformationRatio` `TrackingError`

### Examples

    # First we load 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)

    # Now we have to align it 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")

    TrackingError(data.zoo[, 1, drop=FALSE], data.zoo[, 2, drop=FALSE])

[Package PerformanceAnalytics version 0.9.5 Index]