[R-SIG-Finance] performance attribution output

Bos, Roger roger.bos at rothschild.com
Wed Jun 5 22:17:17 CEST 2013


I have been trying out the performance attribution package and find it very interesting, but I can't figure out how to get the output into a data.frame or other object that would make it easy for me to store it.  Here is some example code:

library(pa)
data(jan)
br.single <- brinson(x = jan, date.var = "date", cat.var = "sector", bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var = "return")
summary(br.single)

Running this example will produce the following output (which looks better in R than it does here)

Period:                              2010-01-01
Methodology:                         Brinson
Securities in the portfolio:         200
Securities in the benchmark:         1000

Exposures 
            Portfolio Benchmark     Diff
Energy          0.085    0.2782 -0.19319
Materials       0.070    0.0277  0.04230
Industrials     0.045    0.0330  0.01201
ConDiscre       0.050    0.0188  0.03124
ConStaples      0.030    0.0148  0.01518
HealthCare      0.015    0.0608 -0.04576
Financials      0.370    0.2979  0.07215
InfoTech        0.005    0.0129 -0.00787
TeleSvcs        0.300    0.1921  0.10792
Utilities       0.030    0.0640 -0.03399

Returns 
$`Attribution by category in bps`
            Allocation Selection Interaction
Energy         110.934    -37.52      26.059
Materials      -41.534      0.48       0.734
Industrials      0.361      1.30       0.473
ConDiscre      -28.688     -4.23      -7.044
ConStaples       5.467     -3.59      -3.673
HealthCare      -6.692     -4.07       3.063
Financials     -43.998     70.13      16.988
InfoTech        -3.255     -5.32       3.255
TeleSvcs       -23.106     41.55      23.348
Utilities       16.544     83.03     -44.108
Total          -13.966    141.77      19.095

$Aggregate
                   2010-01-01
Allocation Effect    -0.00140
Selection Effect      0.01418
Interaction Effect    0.00191
Active Return         0.01469

My question is, how can I, say, save the $Aggregate output into a data.frame?  I have been trying to read about S4 objects, but I am still not able to figure this out.  As long as I am asking, could anyone tell me how to see the code behind the "summary" function being used here?  The following is not very enlightening:

> showMethods("summary", classes="brinson")
Function: summary (package base)
object="brinson"

Thanks in advance for any help!



More information about the R-SIG-Finance mailing list