| Title: | Performance Attribution for Equity Portfolios |
|---|---|
| Description: | It provides tools for conducting performance attribution for equity portfolios. The package uses two methods: the Brinson method and a regression-based analysis. |
| Authors: | Yang Lu [aut, cre], David Kane [aut] |
| Maintainer: | Yang Lu <[email protected]> |
| License: | GPL-2 |
| Version: | 1.2-4 |
| Built: | 2026-05-25 08:42:17 UTC |
| Source: | https://github.com/cran/pa |
The pa package provides facilities for conducting performance attribution based on the Brinson model and the regression approach.
Yang Lu <[email protected]> David Kane <[email protected]>
Maintainer: Yang Lu <[email protected]>
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.
brinson(x, date.var = "date", cat.var = "sector", bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var = "return")brinson(x, date.var = "date", cat.var = "sector", bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var = "return")
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 |
cat.var |
A character vector which indicates the name of the
column in |
bench.weight |
A character vector which indicates the name of the
column or columns in |
portfolio.weight |
A character vector which indicates the name of the
column or columns in |
ret.var |
A character vector which indicates the name of the
column in |
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.
Yang Lu [email protected]
## 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)## 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)
Class brinson holds the results of an original portfolio, its
benchmark, and the results of Brinson analysis of a single-period
portfolio.
date.var:Object of class "character" storing
the date variable name.
cat.var:Object of class "character" storing the
name(s) of the categories in the Brinson analysis.
bench.weight:Object of class "character"
storing the name of the benchmark weight variable.
portfolio.weight:Object of class "character"
storing the name of the portfolio weight variable in the universe
data frame.
ret.var:Object of class "character" storing
the name of the return variable.
weight.port:Object of class "array" storing the
weights of the input category of the portfolio.
weight.bench:Object of class "array" storing the
weights of the input category of the benchmark.
ret.port:Object of class "array" storing the
returns of the input category of the portfolio.
ret.bench:Object of class "array" storing the
returns of the input category of the benchmark.
q4:Object of class "numeric" storing the
information of the 4th quadrant in the brinson matrix. It refers
to return of the benchmark portfolio.
q3:Object of class "numeric" storing the
information of the 3rd quadrant in the brinson matrix. It refers
to return of the portfolio with benchmark sector weights and
portfolio sector returns.
q2:Object of class "numeric" storing the
information of the 2nd quadrant in the brinson matrix. It refers
to return of the portfolio with portfolio sector weights and
benchmark sector returns.
q1:Object of class "numeric" storing the
information of the 1st quadrant in the brinson matrix. It refers
to return of the original portfolio.
universe:Object of class "data.frame" storing
the data frame on which the Brinson attribution is based.
showsignature(object = "brinson"). Summarize
the essential information about the portfolio.
summarysignature(object = "brinson"). Summarize
the portfolio and the Brinson attribution.
exposuresignature(object = "brinson"). Calculate and
display the exposure of the input category of a portfolio.
returnssignature(object = "brinson"). Calculate the
contribution of various effects based on the Brinson analysis.
plotsignature(x = "brinson", var = "character",
type = "character"). Plot the exposure or the return of a portfolio
class object.
Yang Lu [email protected]
data(jan) ## Single-period brinson analysis p1 <- brinson(x = jan, date.var = "date", cat.var = "sector", bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var = "return") summary(p1) exposure(p1, var = "sector") returns(p1) plot(p1, var = "sector", type = "exposure") plot(p1, var = "sector", type = "return")data(jan) ## Single-period brinson analysis p1 <- brinson(x = jan, date.var = "date", cat.var = "sector", bench.weight = "benchmark", portfolio.weight = "portfolio", ret.var = "return") summary(p1) exposure(p1, var = "sector") returns(p1) plot(p1, var = "sector", type = "exposure") plot(p1, var = "sector", type = "return")
Class "brinsonMulti" holds the results of an original portfolio, its benchmark, and the results of brinson analysis of a multi-period portfolio.
date.var:Object of class character storing all the dates occurred in the universe data frame.
cat.var:Object of class character storing the variable name of the categories in the universe data frame.
bench.weight:Object of class character storing the benchmark weight variable name in the universe data frame.
portfolio.weight:Object of class character storing the portfolio weight variable name in the universe data frame.
ret.var:Object of class character storing the return variable name in the universe data frame.
weight.port:Object of class matrix storing the sector weights of the original portfolio.
weight.bench:Object of class matrix storing the sector weights of the benchmark portfolio.
ret.port:Object of class matrix storing the sector returns of the original portfolio.
ret.bench:Object of class matrix storing the sector returns of the benchmark portfolio.
brinson.mat:Object of class matrix storing the information of the brinson matrix across period.
universe:Data frame storing the universe environment.
showsignature(object = "brinson"). Summarize
the essential information about the portfolio.
summarysignature(object = "brinson"). Summarize
the portfolio and the brinson analysis.
exposuresignature(object = "brinson"). Calculate and
display the sector exposure of a portfolio.
returnssignature(object = "brinson"). Calculate the
contribution of various effects based on the brinson model.
plotsignature(x = "brinson", var = "character",
type = "character"). Plot the exposure or the return of a portfolio
class object.
Yang Lu [email protected]
## 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)## 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)
Calculate and display the exposure of a portfolio based on any given category. Both the portfolio and benchmark exposures are displayed.
exposure(object, var, ...)exposure(object, var, ...)
object |
An object of either class |
var |
Any user-defined category whose exposure is to be displayed. |
... |
Other options. |
Return a matrix if the input object is of class brinson with
portfolio, benchmark exposures, and their differences, and return a
list if the input object is of class brinsonMulti including
portfolio, benchmark exposures, and their differences for each period.
If the input var is categorical, it will show exposure of each
sub-groups within the category. If the input var is continuous,
it will show exposure of the category in quintiles.
Yang Lu [email protected]
## 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") exposure(p1, var = "size") ## 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") exposure(p2, var = "sector")## 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") exposure(p1, var = "size") ## 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") exposure(p2, var = "sector")
A modified version of the data set based on MSCI Barra GEM2 data set in year 2010.
data(jan)data(jan)
A data frame with 3000 observations on the following 15 variables.
barridbarra id of a security
namename of a security
returna numeric vector
datea Date
sectoran ordered factor with levels Energy < Materials < Industrials < ConDiscre < ConStaples < HealthCare < Financials < InfoTech < TeleSvcs < Utilities
momentuma numeric vector
valuea numeric vector
sizea numeric vector
growtha numeric vector
cap.usda numeric vector
yielda numeric vector
countrya factor with levels ARE ARG AUS AUT BEL BHR BRA CAN CHE CHL CHN CHX COL CZE DEU DNK EGY ESP FIN FRA GBR GRC HKG HUN IDN IND IRL ISR ITA JOR JPN KOR KWT MAR MEX MYS NLD NOR NZL OMN PAK PER PHL POL PRT QAT RUS SAU SGP SWE THA TUR TWN USA ZAF
currencya factor with levels AREC ARGC AUSC BHRC BRAC CANC CHEC CHLC CHNC COLC CZEC DNKC EGYC EMUC GBRC HKGC HUNC IDNC INDC ISRC JORC JPNC KORC KWTC MARC MEXC MYSC NORC NZLC OMNC PAKC PERC PHLC POLC QATC RUSC SAUC SGPC SWEC THAC TURC TWNC USAC ZAFC
portfolioa numeric vector
benchmarka numeric vector
A subset of the data set year. jan contains all the
information necessary to conduct a single-period Brinson
analysis. date.var, cat.var, and return identify
the columns containing the date, the factor to be analyzed, and the
return variable, respectively. bench.weight and
portfolio.weight specify the name of the benchmark weight
column and that of the portfolio weight column in the data frame.
data(jan) head(jan)data(jan) head(jan)
This method plots the exposure or return comparison graph of a portfolio and its benchmark based on a portfolio class object.
signature(x = "ANY", y = "ANY")The usual plot method from the base package.
signature(x = "brinsonMulti", y = "missing")The x must be a brinsonMulti class object.
The var can be used to specified the factor whose exposure to
be shown. sector is the default setting where the exposure
comparison graph based on sectors will be shown.
The type can be either exposure or return. The
default setting is exposure. When the type is set to
return, the var option is no longer in use.
signature(x = "brinson", y = "missing")The x must be a brinson class object.
The var can be used to specified the factor whose exposure to
be shown. sector is the default setting where the exposure
comparison graph based on sectors will be shown.
The type can be either exposure or return. The
default setting is exposure. When the type is set to
return, the var option is no longer in use.
signature(x = "regressionMulti", y = "missing")The x must be a regressionMulti class object.
The var can be used to specified the factor whose exposure to
be shown. sector is the default setting where the exposure
comparison graph based on sectors will be shown.
The type can be either exposure or return. The
default setting is exposure. When the type is set to
return, the var option is no longer in use.
signature(x = "regression", y = "missing")The x must be a regression class object.
The var can be used to specified the factor whose exposure to
be shown. sector is the default setting where the exposure
comparison graph based on sectors will be shown.
The type can be either exposure or return. The
default setting is exposure. When the type is set to
return, the var option is no longer in use.
An edited version of the data set based on GEM2 data set in year 2010.
data(quarter)data(quarter)
A data frame with 9000 observations on the following 15 variables.
barridbarra id for a security
namename of a security
returna numeric vector
datea Date
sectoran ordered factor with levels Energy < Materials < Industrials < ConDiscre < ConStaples < HealthCare < Financials < InfoTech < TeleSvcs < Utilities
momentuma numeric vector
valuea numeric vector
sizea numeric vector
growtha numeric vector
cap.usda numeric vector
yielda numeric vector
countrya factor with levels ARE ARG AUS AUT BEL BHR BRA CAN CHE CHL CHN CHX COL CZE DEU DNK EGY ESP FIN FRA GBR GRC HKG HUN IDN IND IRL ISR ITA JOR JPN KOR KWT MAR MEX MYS NLD NOR NZL OMN PAK PER PHL POL PRT QAT RUS SAU SGP SWE THA TUR TWN USA ZAF
currencya factor with levels AREC ARGC AUSC BHRC BRAC CANC CHEC CHLC CHNC COLC CZEC DNKC EGYC EMUC GBRC HKGC HUNC IDNC INDC ISRC JORC JPNC KORC KWTC MARC MEXC MYSC NORC NZLC OMNC PAKC PERC PHLC POLC QATC RUSC SAUC SGPC SWEC THAC TURC TWNC USAC ZAFC
portfolioa numeric vector
benchmarka numeric vector
A subset of the data set year. quarter contains all the
information necessary to conduct a multi-period Brinson
analysis. date.var, cat.var, and return identify
the columns containing the date, the factor to be analyzed, and the
return variable, respectively. bench.weight and
portfolio.weight specify the name of the benchmark weight
column and that of the portfolio weight column in the data frame.
data(quarter) head(quarter)data(quarter) head(quarter)
Conduct regression analysis for equity portfolio attribution. Create
an object of either class regression for a single-period data set or
class regressionMulti for a multi-period data set.
regress(x, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio")regress(x, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio")
x |
A data frame containing the data from which regression analysis will be conducted. |
date.var |
A character vector which indicates the name
of the column in |
ret.var |
A character vector which indicates the name of the
column in |
reg.var |
Input variables to be used as independent variables in the regression analysis. |
benchmark.weight |
A character vector which indicates the name of the
column or columns in |
portfolio.weight |
A character vector which indicates the name of the
column or columns in |
Return an object of class regression when there is only one
unique date in the data frame x. Otherwise, an object of class
regressionMulti is returned.
Yang Lu [email protected]
## Single-period regression analysis data(jan) r1 <-regress(x = jan, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r1) ## Multi-period regression analysis data(quarter) r2 <-regress(x = quarter, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r2)## Single-period regression analysis data(jan) r1 <-regress(x = jan, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r1) ## Multi-period regression analysis data(quarter) r2 <-regress(x = quarter, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r2)
Class "regression" holds the results of an original portfolio, its benchmark, and the results of regression analysis of a single-period portfolio.
date.var:Object of class "character" storing
the name of the date column in the class object.
ret.var:Object of class "character" storing
the name of the return variable.
reg.var:Object of class "character" storing
the name of the regressors.
benchmark.weight:Object of class "character"
storing the name of the benchmark weight variable.
portfolio.weight:Object of class "character"
storing the name of the portfolio weight variable in the universe
dataframe.
coefficients:Object of class "numeric" storing
the estimated coefficients of the regression model.
benchmark.ret:Object of class "matrix" storing
the benchmark return of the input portfolio.
portfolio.ret:Object of class "matrix" storing
the portfolio return of the input portfolio.
act.ret:Object of class "matrix" storing the
active return of the input portfolio.
act.expo:Object of class "numeric" storing the
active exposure according to the regressors.
contrib:Object of class "numeric" storing the
contribution of the regressors according to the input.
universe:Object of class "data.frame" storing
the entire input data frame.
signature(object = "regression"): Calculate
and display the exposure of the input category of a portfolio.
signature(x = "regression", y = "missing"): Plot
the exposure or the return of a regression class object.
signature(object = "regression"): Calculate
the contribution of various effects based on the regression
analysis.
signature(object = "regression"): Summarize the
essential information about the portfolio.
signature(object = "regression"): Summarize
the portfolio and the regression-based attribution.
Yang Lu [email protected]
## Single-period regression analysis data(jan) r1 <-regress(x = jan, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r1)## Single-period regression analysis data(jan) r1 <-regress(x = jan, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r1)
Class "regressionMulti" holds the results of an original portfolio, its benchmark, and the results of regression analysis of a multi-period portfolio.
date.var:Object of class "character" storing
the date(s) in the class object.
ret.var:Object of class "character" storing
the name of the return variable.
reg.var:Object of class "character" storing
the name of the regressors.
benchmark.weight:Object of class "character"
storing the name of the benchmark weight variable.
portfolio.weight:Object of class "character"
storing the name of the portfolio weight variable in the universe
dataframe.
coefficients:Object of class "matrix" storing
the estimated coefficients of the regression model for each time
period.
benchmark.ret:Object of class "matrix" storing
the benchmark return of the input portfolio for each time
period.
portfolio.ret:Object of class "matrix" storing
the portfolio return of the input portfolio for each time
period.
act.ret:Object of class "matrix" storing the
active return of the input portfolio for each time period.
act.expo:Object of class "matrix" storing the
active exposure according to the regressors for each time
period.
contrib:Object of class "matrix" storing the
contribution of the regressors according to the input for each
time period.
universe:Object of class "list" storing
the entire input data frame.
signature(object = "regressionMulti"): Calculate
and display the exposure of the input category of a portfolio.
signature(x = "regressionMulti", y = "missing"):
Plot the exposure or the return of a regressionMulti class object.
signature(object = "regressionMulti"):
Calculate the contribution of various effects based on the
regression analysis.
signature(object = "regressionMulti"): Summarize
the essential information about the portfolio.
signature(object = "regressionMulti"):
Summarize the portfolio and the regression-based attribution.
Yang Lu [email protected]
## Multi-period regression analysis data(quarter) r2 <-regress(x = quarter, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r2)## Multi-period regression analysis data(quarter) r2 <-regress(x = quarter, date.var = "date", ret.var = "return", reg.var = c("sector", "value", "growth"), benchmark.weight = "benchmark", portfolio.weight = "portfolio") summary(r2)
Calculate and display the attribution results. Allocation effect, selection effect, interaction, and active return are displayed for brinson analysis. Returns of user-defined input variables, portfolio return, benchmark return, and active return are shown for regression analysis.
returns(object, ...)returns(object, ...)
object |
An object of either class |
... |
Other options including type which refers to the
type of returns to be shown for regression analysis. They
include |
When the input is an object of class brinson, return a list of
two matrices. The first one is the allocation, selection, and
interaction for each groups in the specified category. The second
matrix has 4 rows including Allocation, Selection,
Interaction, and Active Return.
When the input is an object of class brinsonMulti, return a
list including brison attribution for each individual period and the
aggregate.
When the input is an object of class regression, return a
matrix including contributions of input variables, Portfolio
Return, Benchmark Return, and Active Return.
When the input is an object of class regressionMulti, return a
list including regression analysis for each individual period and the
aggregate.
Yang Lu [email protected]
## 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") returns(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") returns(p2, type = "linking")## 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") returns(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") returns(p2, type = "linking")
Summarize a portfolio and its benchmark. Present the attribution
information including basic portfolio information, expsosures, and
returns. The input can be any of the four class objects including
brinson, brinsonMulti, regression, and
regressionMulti.
summary(object, ...)summary(object, ...)
object |
An object of |
... |
Other options. |
Return relevant information about a portfolio and its benchmark. It includes their exposures based on input categories (for Brinson analysis only) and the results of either Brinson analysis or regression analysis.
Yang Lu [email protected]
## 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)## 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)
An edited version of the data set based on Barra GEM2 data set in year 2010.
data(jan)data(jan)
A data frame with 3000 observations on the following 6 variables.
namename of a security
returna numeric vector
datea Date
sectoran ordered factor with levels Energy < Materials < Industrials < ConDiscre < ConStaples < HealthCare < Financials < InfoTech < TeleSvcs < Utilities
portfolioa numeric vector
benchmarka numeric vector
A edited version of the data set jan. test contains all the
information necessary to conduct a single-period Brinson
analysis. date.var, cat.var, and return identify
the columns containing the date, the factor to be analyzed, and the
return variable, respectively. bench.weight and
portfolio.weight specify the name of the benchmark weight
column and that of the portfolio weight column in the data frame.
In the paper, we use this data set to showcase that the Brinson model is a special case of the regression approach.
In this data set, the universe of the portfolio is assumed to be the same as the benchmark.
data(test) head(test)data(test) head(test)
An edited version of the data set based on Barra GEM2 data set in year 2010.
data(year)data(year)
A data frame with 36000 observations on the following 15 variables.
barridbarra id for a security
namename of a security
returna numeric vector
datea Date
sectoran ordered factor with levels Energy < Materials < Industrials < ConDiscre < ConStaples < HealthCare < Financials < InfoTech < TeleSvcs < Utilities
momentuma numeric vector
valuea numeric vector
sizea numeric vector
growtha numeric vector
cap.usda numeric vector
yielda numeric vector
countrya factor with levels ARE ARG AUS AUT BEL BHR BRA CAN CHE CHL CHN CHX COL CZE DEU DNK EGY ESP FIN FRA GBR GRC HKG HUN IDN IND IRL ISR ITA JOR JPN KOR KWT MAR MEX MYS NLD NOR NZL OMN PAK PER PHL POL PRT QAT RUS SAU SGP SWE THA TUR TWN USA ZAF
currencya factor with levels AREC ARGC AUSC BHRC BRAC CANC CHEC CHLC CHNC COLC CZEC DNKC EGYC EMUC GBRC HKGC HUNC IDNC INDC ISRC JORC JPNC KORC KWTC MARC MEXC MYSC NORC NZLC OMNC PAKC PERC PHLC POLC QATC RUSC SAUC SGPC SWEC THAC TURC TWNC USAC ZAFC
portfolioa numeric vector
benchmarka numeric vector
year contains all the information necessary to conduct a
multi-period Brinson analysis. date.var, cat.var, and
return identify the columns containing the date, the factor to
be analyzed, and the return variable,
respectively. bench.weight and portfolio.weight specify
the name of the benchmark weight column and that of the portfolio
weight column in the data frame.
data(year) head(year)data(year) head(year)