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")
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.
A data frame containing the data from which regression analysis will be conducted.
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 regression
will be formed. If it is more than
one, a class object of regressionMulti
will be formed.
A character vector which indicates the name of the
column in x
to be used as the return variable.
Input variables to be used as independent variables in the regression analysis.
A character vector which indicates the name of the
column or columns in x
to be used as benchmark weight.
A character vector which indicates the name of the
column or columns in x
to be used as portfolio weight.
Yang Lu Yang.Lu@williams.edu
## 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)
Run the code above in your browser using DataLab