statsTable       package:PerformanceAnalytics       R Documentation

_w_r_a_p_p_e_r _f_u_n_c_t_i_o_n _f_o_r _c_o_m_b_i_n_i_n_g _a_r_b_i_t_r_a_r_y _f_u_n_c_t_i_o_n _l_i_s_t _i_n_t_o _a _t_a_b_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     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.

     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).

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       R: a 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 

_D_e_t_a_i_l_s:

     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),
     DownsideDeviation(x,MAR=0),maxDrawdown(x))

     metricsNames = c("Semi Deviation", "Gain Deviation", "Loss
     Deviation", paste("Downside Deviation (MAR=",MAR*scale*100,"%)",
     sep=""), paste("Downside Deviation (rf=",rf*scale*100,"%)",
     sep=""), paste("Downside Deviation (0%)", sep=""), "Maximum
     Drawdown" )

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


                Actual   S&P500TR
     modVaR 0.04186461 0.06261451
     mean   0.00945000 0.01013684

     Passing in attributes doesn't quite work corrently.  The issue is
     apparent in: >
     statsTable(monthlyReturns.ts,metrics=c("VaR.CornishFisher",
     "VaR.CornishFisher"), metricsNames=c("Modified VaR","Traditional
     VaR"), modified=c(TRUE,FALSE))


                         Actual   S&P500TR
     Modified VaR    0.06340849 0.09334976
     Traditional VaR 0.06340849 0.09334976

     Warning messages: 1: the condition has length > 1 and only the
     first element will be used in: if (modified) 2: the condition has
     length > 1 and only the first element will be used in: if
     (modified) 3: the condition has length > 1 and only the first
     element will be used in: if (modified) 4: the condition has length
     > 1 and only the first element will be used in: if (modified)

_V_a_l_u_e:

     A table with calculated metrics for each column

_A_u_t_h_o_r(_s):

     Peter Carl

_R_e_f_e_r_e_n_c_e_s:

_E_x_a_m_p_l_e_s:

