Learn R Programming

pa (version 1.2-1)

brinson: Creating an object of either class brinson or class brinsonMulti

Description

Conduct Brinson analysis for equity portfolio attribution. Create a class object of either brinson for a single-period data set or brinsonMulti for a multi-period data set.

Usage

brinson(x, date.var = "date", cat.var = "sector", bench.weight =
"benchmark", portfolio.weight = "portfolio", ret.var = "return")

Arguments

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.

Value

Return an object of class brinson when there is only one unique date in the data frame x. Otherwise, an object of class brinsonMulti is returned.

Examples

Run this code
# NOT RUN {
## Single-period brinson analysis

data(jan)

p1 <- brinson(x = jan, date.var = "date", cat.var = "sector",
bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var =
"return")

summary(p1)

## Multi-period brinson analysis

data(quarter)

p2 <- brinson(x = quarter, date.var = "date", cat.var = "sector",
bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var =
"return")

summary(p2)

# }

Run the code above in your browser using DataLab