fitTsfmUpDn: Fit a up and down market factor model using time series...

View source: R/fitTsfmUpDn.R

fitTsfmUpDnR Documentation

Fit a up and down market factor model using time series regression

Description

This is a wrapper function to fits a up and down market model for one or more asset returns or excess returns using time series regression. Users can choose between ordinary least squares-LS, discounted least squares-DLS (or) robust regression. An object of class "tsfmUpDn" is returned.

Usage

fitTsfmUpDn(
  asset.names,
  mkt.name,
  rf.name = NULL,
  data = data,
  fit.method = c("LS", "DLS", "Robust"),
  control = fitTsfm.control(...),
  ...
)

Arguments

asset.names

Vector containing syntactically valid names of assets, whose returns or excess returns are the dependent variable.

mkt.name

Syntactically valid name for market returns. Required for an up/down market model.

rf.name

Syntactically valid name of the risk free rate to calculate excess returns for all assets (in asset.names) and the market factor (in mkt.name). Default is NULL, and no action is taken.

data

vector, matrix, data.frame, xts, timeSeries or zoo object containing column(s) named in asset.names, factor.names and optionally, mkt.name and rf.name.

fit.method

the estimation method, one of "LS", "DLS" or "Robust". See details. Default is "LS".

control

list of control parameters. The default is constructed by the function fitTsfm.control. See the documentation for fitTsfm.control for details.

...

arguments passed to fitTsfm.control

Details

fitTsfmUpDn will use fitTsfm to fit a time series model for up and down market respectively. If risk free rate is provided, the up market is the excess market returns which is no less than 0. The goal of up and down market model is to capture two different market Betas in the up and down markets.

Value

fitTsfmUpDn returns an object tsfmUpDn. It supports generic function such as summary, predict, plot and print.

It is also a list object containing Up and Dn. Both Up and Dn are class of "tsfm". As a result, for each list object, The generic function such as print, plot, predict and summary methods exist for both Up and Dn. Also, the generic accessor functions coef, fitted, residuals and fmCov can be applied as well.

An object of class "tsfmUpDn" is a list containing Up and Dn:

Up

An object of tsfm fitted by fitTsfm for the up market;

Dn

An object of tsfm fitted by fitTsfm for the down market;

and others useful items:

call

Function call.

data

Original data used but converted to xts class.

Each object of tsfm contains :

asset.fit

list of fitted objects for each asset. Each object is of class lm if fit.method="LS" or "DLS", class lmRob if the fit.method="Robust"

alpha

length-N vector of estimated alphas.

beta

N x 1 matrix of estimated betas.

r2

length-N vector of R-squared values.

resid.sd

length-N vector of residual standard deviations.

call

the matched function call.

data

xts data object containing the assets and factors.

asset.names

asset.names as input.

factor.names

factor.names as input.

fit.method

fit.method as input.

Where N is the number of assets and T is the number of time periods.

Author(s)

Yi-An Chen.

References

Christopherson, J. A., Carino, D. R., & Ferson, W. E. (2009). Portfolio performance measurement and benchmarking. McGraw Hill Professional.

See Also

The tsfmUpDn methods for generic functions: plot.tsfmUpDn, predict.tsfmUpDn, print.tsfmUpDn and summary.tsfmUpDn.

The original time series function fitTsfm and its generic functions application.

Examples

 # load data
data(managers, package = 'PerformanceAnalytics')

# example: Up and down market factor model with LS fit
fitUpDn <- fitTsfmUpDn(asset.names = colnames(managers[,(1:6)]),
                       mkt.name = "SP500 TR",
                       data = managers, 
                       fit.method = "LS")
 
 print(fitUpDn)
 summary(fitUpDn)
 
 # A list object
 fitUpDn
 summary(fitUpDn$Up)
 summary(fitUpDn$Dn)


braverock/factorAnalytics documentation built on Dec. 16, 2024, 1:05 p.m.