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

View source: R/regress.R

regressR Documentation

Create an object of either class regress or class regressMulti

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


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 Yang.Lu@williams.edu

Examples


## 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 Aug. 21, 2023, 5:06 p.m.