pa package in R - performance attribution

I'm not familiar with the package, but it looks like the arguments for brinson() have specific requirements:

  • x A data frame containing the data from which brinson analysis will be conducted.
  • date.var A character vector which indicates the name of the column in x to be used as a date for each observation. If the unique number of levels of date.var is one, a class object of brinson will be formed. If it is more than one, a class object of brinsonMulti will be formed.
  • cat.var A character vector which indicates the name of the column in x to be used as categorical variables.
  • bench.weight A character vector which indicates the name of the column or columns in x to be used as benchmark weight.
  • portfolio.weight A character vector which indicates the name of the column or columns in x to be used as portfolio weight.
  • ret.var A character vector which indicates the name of the column in x to be used as return variable.

I'm able to create a reproducible example from the vignette, so the package itself seems to be working as it should:

library(pa)
#> Loading required package: grid
data(jan)
br.single <- brinson(x = jan, date.var = "date",
                     cat.var = "sector",
                     bench.weight = "benchmark",
                     portfolio.weight = "portfolio",
                     ret.var = "return")
br.single
#> Period:                              2010-01-01
#> Methodology:                         Brinson
#> Securities in the portfolio:         200
#> Securities in the benchmark:         1000

Created on 2019-02-14 by the reprex package (v0.2.1.9000)

Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

install.packages("reprex")

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")

For pointers specific to the community site, check out the reprex FAQ.

1 Like