calculate metrics on up and down markets for the benchmark asset
Source:R/UpDownRatios.R
UpDownRatios.RdCalculate metrics on how the asset in R performed in up and down markets, measured by periods when the benchmark asset was up or down.
Arguments
- Ra
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns
- Rb
return vector of the benchmark asset
- method
"Capture", "Number", or "Percent" to indicate which measure to return
- side
"Up" or "Down" market statistics
- geometric
utilize geometric chaining (TRUE) or simple/arithmetic chaining (FALSE) to aggregate returns, default TRUE
Details
This is a function designed to calculate several related metrics:
Up (Down) Capture Ratio: this is a measure of an investment's compound return when the benchmark was up (down) divided by the benchmark's compound return when the benchmark was up (down). The greater (lower) the value, the better.
Up (Down) Number Ratio: similarly, this is a measure of the number of periods that the investment was up (down) when the benchmark was up (down), divided by the number of periods that the Benchmark was up (down).
Up (Down) Percentage Ratio: this is a measure of the number of periods that the investment outperformed the benchmark when the benchmark was up (down), divided by the number of periods that the benchmark was up (down). Unlike the prior two metrics, in both cases a higher value is better.
References
Bacon, C. Practical Portfolio Performance Measurement and
Attribution. Wiley. 2004. p. 47
Examples
data(managers)
UpDownRatios(managers[, 1, drop = FALSE], managers[, 8, drop = FALSE])
#> HAM1
#> SP500 TR Up Capture 0.3215403
#> SP500 TR Down Capture 0.3770993
#> SP500 TR Up Number 0.8941176
#> SP500 TR Down Number 0.5106383
#> SP500 TR Up Percent 0.2941176
#> SP500 TR Down Percent 0.8085106
UpDownRatios(managers[, 1:6, drop = FALSE], managers[, 8, drop = FALSE])
#> HAM1 HAM2 HAM3 HAM4 HAM5
#> SP500 TR Up Capture 0.3215403 0.3462609 0.5261779 0.7675136 0.3678574
#> SP500 TR Down Capture 0.3770993 0.1090224 0.5866868 0.8732973 0.4979231
#> SP500 TR Up Number 0.8941176 0.6835443 0.8705882 0.7647059 0.7083333
#> SP500 TR Down Number 0.5106383 0.6956522 0.7659574 0.6595745 0.7241379
#> SP500 TR Up Percent 0.2941176 0.3670886 0.4235294 0.4588235 0.3958333
#> SP500 TR Down Percent 0.8085106 0.8695652 0.8085106 0.5319149 0.8275862
#> HAM6
#> SP500 TR Up Capture 0.7182325
#> SP500 TR Down Capture 0.3113680
#> SP500 TR Up Number 0.8372093
#> SP500 TR Down Number 0.5238095
#> SP500 TR Up Percent 0.5348837
#> SP500 TR Down Percent 0.7142857
UpDownRatios(managers[, 1, drop = FALSE], managers[, 8, drop = FALSE], method = "Capture")
#> HAM1
#> SP500 TR Up Capture 0.3215403
#> SP500 TR Down Capture 0.3770993
# Up Capture:
UpDownRatios(managers[, 1, drop = FALSE], managers[, 8, drop = FALSE],
side = "Up", method = "Capture"
)
#> [1] 0.3215403
# Down Capture:
UpDownRatios(managers[, 1, drop = FALSE], managers[, 8, drop = FALSE],
side = "Down", method = "Capture"
)
#> [1] 0.3770993