fitFundamentalFactorModel: fit fundamental factor model by classic OLS or Robust...

Description Usage Arguments Details Value Author(s) References Examples

Description

fit fundamental factor model or cross-sectional factor model by classic OLS or Robust regression. Fundamental factor models use observable asset specific characteristics (fundamentals) like industry classification, market capitalization, style classification (value, growth) etc. to calculate the common risk factors. The function creates the class "FundamentalFactorModel".

Usage

1
2
3
4
5
  fitFundamentalFactorModel(data, exposure.names, datevar,
    returnsvar, assetvar, wls = TRUE,
    regression = "classic", covariance = "classic",
    full.resid.cov = FALSE, robust.scale = FALSE,
    standardized.factor.exposure = FALSE, weight.var)

Arguments

data

data.frame, data must have assetvar, returnvar, datevar , and exposure.names. Generally, data has to look like panel data. It needs firm variabales and time variables. Data has to be a balanced panel.

exposure.names

a character vector of exposure names for the factor model

wls

logical flag, TRUE for weighted least squares, FALSE for ordinary least squares

regression

A character string, "robust" for regression via lmRob, "classic" for regression with lm()

covariance

A character string, "robust" for covariance matrix computed with covRob(), "classic" for covariance matrix with covClassic() in robust package.

full.resid.cov

logical flag, TRUE for full residual covariance matrix calculation, FALSE for diagonal residual covarinace matrix

robust.scale

logical flag, TRUE for exposure scaling via robust scale and location, FALSE for scaling via mean and sd

returnsvar

A character string giving the name of the return variable in the data.

datevar

A character string gives the name of the date variable in the data.

assetvar

A character string gives the name of the asset variable in the data.

standardized.factor.exposure

logical flag. Factor exposure will be standardized to regression weighted mean 0 and standardized deviation to 1 if TRUE. Default is FALSE. See Detail.

weight.var

A character strping gives the name of the weight used for standarizing factor exposures.

Details

If style factor exposure is standardized to regression-weighted mean zero, this makes style factors orthogonal to the world factor (intercept term), which in turn facilitted interpretation of the style factor returns. See Menchero 2010.

The original function was designed by Doug Martin and originally implemented in S-PLUS by a number of UW Ph.D. students: Christopher Green, Eric Aldrich, and Yindeng Jiang. Guy Yullen re-implemented the function in R. Yi-An Chen from University of Washington re-writes the codes and finalizes the function.

Value

an S3 object containing

Author(s)

Guy Yullen and Yi-An Chen

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# BARRA type factor model
data(Stock.df)
# there are 447 assets
exposure.names <- c("BOOK2MARKET", "LOG.MARKETCAP")
test.fit <- fitFundamentalFactorModel(data=stock,exposure.names=exposure.names,
                                       datevar = "DATE", returnsvar = "RETURN",
                                       assetvar = "TICKER", wls = TRUE,
                                       regression = "classic",
                                       covariance = "classic", full.resid.cov = TRUE,
                                       robust.scale = TRUE)

names(test.fit)
test.fit$returns.cov
test.fit$resids.cov
names(test.fit$cov.factor)
test.fit$factor.cov$cov
test.fit$factor
test.fit$resid.variance
test.fit$resids
test.fit$tstats
test.fit$call

# BARRA type Industry Factor Model
exposure.names <- c("GICS.SECTOR")
# the rest keep the same
test.fit2 <- fitFundamentalFactorModel(data=stock,exposure.names=exposure.names,
                                       datevar = "DATE", returnsvar = "RETURN",
                                       assetvar = "TICKER", wls = TRUE,
                                       regression = "classic",
                                       covariance = "classic", full.resid.cov = TRUE,
                                       robust.scale = TRUE)

names(test.fit2)
test.fit2$cov.returns
test.fit2$cov.resids
names(test.fit2$cov.factor)
test.fit2$cov.factor$cov
test.fit2$factor
test.fit2$resid.variance
test.fit2$resids
test.fit2$tstats
test.fit2$call

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