This function creates a table of statistics from vectors of functions and labels passed in. The resulting table is formatted such that metrics are calculated separately for each column of returns in the data object.

table.Arbitrary(R, metrics = c("mean", "sd"),
  metricsNames = c("Average Return", "Standard Deviation"), ...)

Arguments

R

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

metrics

lisdt of functions to apply

metricsNames

column names for each function

any other passthru parameters

Details

Assumes an input of period returns. Scale arguements can be used to specify the number of observations during a year (e.g., 12 = monthly returns).

The idea here is to be able to pass in sets of metrics and values, like:

metrics = c(DownsideDeviation(x,MAR=mean(x)), sd(subset(x,x>0)), sd(subset(x,x<0)), DownsideDeviation(x,MAR=MAR), DownsideDeviation(x,MAR=Rf=0), DownsideDeviation(x,MAR=0),maxDrawdown(x))

metricsNames = c("Semi Deviation", "Gain Deviation", "Loss Deviation", paste("Downside Deviation (MAR=",MAR*scale*100," paste("Downside Deviation (rf=",rf*scale*100," Deviation (0

Here's how it's working right now: > table.Arbitrary(monthlyReturns.ts,metrics=c("VaR","mean"), metricsNames=c("modVaR","mean"),p=.95)

 Actual S&P500TR modVaR
0.04186461 0.06261451 mean 0.00945000 0.01013684 

Passing in two different sets of attributes to the same function doesn't quite work currently. The issue is apparent in: > table.Arbitrary(edhec,metrics=c("VaR", "VaR"), metricsNames=c("Modified VaR","Traditional VaR"), modified=c(TRUE,FALSE))

Convertible.Arbitrage CTA.Global Distressed.Securities Modified VaR
0.04081599 0.0456767 0.1074683 Traditional VaR 0.04081599 0.0456767
0.1074683 Emerging.Markets Equity.Market.Neutral Event.Driven Modified VaR
0.1858624 0.01680917 0.1162714 Traditional VaR 0.1858624 0.01680917
0.1162714 Fixed.Income.Arbitrage Global.Macro Long.Short.Equity Modified VaR
0.2380379 0.03700478 0.04661244 Traditional VaR 0.2380379 0.03700478
0.04661244 Merger.Arbitrage Relative.Value Short.Selling Funds.of.Funds
Modified VaR 0.07510643 0.04123920 0.1071894 0.04525633 Traditional VaR
0.07510643 0.04123920 0.1071894 0.04525633 

In the case of this example, you would simply call VaR as the second function, like so: > table.Arbitrary(edhec,metrics=c("VaR", "VaR"),metricsNames=c("Modified VaR","Traditional VaR"))

Convertible.Arbitrage CTA.Global Distressed.Securities Modified VaR
0.04081599 0.04567670 0.10746831 Traditional VaR 0.02635371 0.04913361
0.03517855 Emerging.Markets Equity.Market.Neutral Event.Driven Modified VaR
0.18586240 0.01680917 0.11627142 Traditional VaR 0.07057278 0.01746554
0.03563019 Fixed.Income.Arbitrage Global.Macro Long.Short.Equity Modified
VaR 0.23803787 0.03700478 0.04661244 Traditional VaR 0.02231236 0.03692096
0.04318713 Merger.Arbitrage Relative.Value Short.Selling Funds.of.Funds
Modified VaR 0.07510643 0.04123920 0.1071894 0.04525633 Traditional VaR
0.02510709 0.02354012 0.0994635 0.03502065 

but we don't know of a way to compare the same function side by side with different parameters for each. Suggestions Welcome.

Examples

data(edhec) table.Arbitrary(edhec,metrics=c("VaR", "ES"), metricsNames=c("Modified VaR","Modified Expected Shortfall"))
#> Convertible Arbitrage CTA Global #> Modified VaR -0.03247395 -0.03380228 #> Modified Expected Shortfall -0.09954768 -0.04284185 #> Distressed Securities Emerging Markets #> Modified VaR -0.02749240 -0.06363081 #> Modified Expected Shortfall -0.06087217 -0.12788702 #> Equity Market Neutral Event Driven #> Modified VaR -0.01134637 -0.02812515 #> Modified Expected Shortfall -0.04290042 -0.05909659 #> Fixed Income Arbitrage Global Macro #> Modified VaR -0.02467910 -0.01548247 #> Modified Expected Shortfall -0.05951833 -0.01983308 #> Long/Short Equity Merger Arbitrage Relative Value #> Modified VaR -0.03037494 -0.01486869 -0.01926435 #> Modified Expected Shortfall -0.04709136 -0.03326371 -0.04888118 #> Short Selling Funds of Funds #> Modified VaR -0.07431463 -0.02502852 #> Modified Expected Shortfall -0.09022777 -0.04618555