regress: Create an object of either class regress or class...

Description Usage Arguments Value Author(s) Examples

View source: R/regress.R

Description

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.

Usage

1
2
3
regress(x, date.var = "date", ret.var = "return", reg.var = c("sector",
"value", "growth"), benchmark.weight = "benchmark", portfolio.weight =
"portfolio")

Arguments

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 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.

ret.var

A character vector which indicates the name of the column in x to be used as the return variable.

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 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.

Value

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.

Author(s)

Yang Lu [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## 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)

pa documentation built on May 29, 2017, 11:44 a.m.