fitTimeseriesFactorModel: Fit time series factor model by time series regression...

Description Usage Arguments Details Value Author(s) References Examples

Description

Fit time series factor model by time series regression techniques for single or multiple assets. Classic OLS, Robust regression can be chosen and several model selection methods can be applied. Class "TimeSeriesFactorModel" will be created too.

Usage

1
2
3
4
5
6
7
8
  fitTimeSeriesFactorModel(assets.names, factors.names,
    data = data, num.factor.subset = 1,
    fit.method = c("OLS", "DLS", "Robust"),
    variable.selection = "none", decay.factor = 0.95,
    nvmax = 8, force.in = NULL,
    subsets.method = c("exhaustive", "backward", "forward", "seqrep"),
    lars.criteria = "Cp", add.up.market.returns = FALSE,
    add.quadratic.term = FALSE, excess.market.returns.name)

Arguments

assets.names

names of assets returns.

factors.names

names of factors returns.

num.factor.subset

scalar. Number of factors selected by all subsets.

data

a vector, matrix, data.frame, xts, timeSeries or zoo object with assets.names and factors.names or excess.market.returns.name if necassary.

fit.method

"OLS" is ordinary least squares method, "DLS" is discounted least squares method. Discounted least squares (DLS) estimation is weighted least squares estimation with exponentially declining weights that sum to unity. "Robust"

variable.selection

"none" will not activate variables sellection. Default is "none". "stepwise" is traditional forward/backward #' stepwise OLS regression, starting from the initial set of factors, that adds factors only if the regression fit as measured by the Bayesian Information Criteria (BIC) or Akaike Information Criteria (AIC) can be done using the R function step() from the stats package. If "Robust" is chosen, the function step.lmRob in Robust package will be used. "all subsets" is Traditional all subsets regression can be done using the R function regsubsets() from the package leaps. "lar" , "lasso" is based on package "lars", linear angle regression. If "lar" or "lasso" is chose. fit.method will be ignored.

decay.factor

for DLS. Default is 0.95.

nvmax

control option for all subsets. maximum size of subsets to examine

force.in

control option for all subsets. The factors that should be in all models.

subsets.method

control option for all subsets. se exhaustive search, forward selection, backward selection or sequential replacement to search.

lars.criteria

either choose minimum "cp": unbiased estimator of the true rist or "cv" 10 folds cross-validation. Default is "Cp". See detail.

add.up.market.returns

Logical. If TRUE, max(0,Rm-Rf) will be added as a regressor. Default is FALSE. excess.market.returns.nam is required if TRUE. See Detail.

add.quadratic.term

Logical. If TRUE, (Rm-Rf)^2 will be added as a regressor. excess.market.returns.name is required if TRUE. Default is FALSE.

excess.market.returns.name

colnames market returns minus risk free rate. (Rm-Rf).

Details

add.up.market.returns adds a max(0,Rm-Rf) term in the regression as suggested by Merton-Henriksson Model (1981) to measure market timing. The coefficient can be interpreted as number of free put options.

If Robust is chosen, there is no subsets but all factors will be used. Cp is defined in http://www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf. p17.

Value

an S3 object containing

Author(s)

Eric Zivot and Yi-An Chen.

References

  1. Efron, Hastie, Johnstone and Tibshirani (2002) "Least Angle Regression" (with discussion) Annals of Statistics; see also http://www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf.

  2. Hastie, Tibshirani and Friedman (2008) Elements of Statistical Learning 2nd edition, Springer, NY.

  3. Christopherson, Carino and Ferson (2009). Portfolio Performance Measurement and Benchmarking, McGraw Hill.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# load data from the database
data(managers.df)
fit <- fitTimeSeriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
                                factors.names=c("EDHEC.LS.EQ","SP500.TR"),
                                data=managers.df,fit.method="OLS")
# summary of HAM1
summary(fit$asset.fit$HAM1)
# plot actual vs. fitted over time for HAM1
# use chart.TimeSeries() function from PerformanceAnalytics package
dataToPlot = cbind(fitted(fit$asset.fit$HAM1), na.omit(managers.df$HAM1))
colnames(dataToPlot) = c("Fitted","Actual")
chart.TimeSeries(dataToPlot, main="FM fit for HAM1",
                 colorset=c("black","blue"), legend.loc="bottomleft")
 
## End(Not run)

R-Finance/FactorAnalytics documentation built on May 8, 2019, 3:51 a.m.