factor_select: factor_select

Description Usage Arguments Value Examples

Description

reg.factor_select select alpha or risk factors using regression method. factor_VIF caculate factor's VIF.

Usage

1
2
3
reg.factor_select(TSFR, sectorAttr = defaultSectorAttr(), forder)

factor_VIF(TSF, sectorAttr = defaultSectorAttr())

Arguments

TSFR

a TSFR object.

sectorAttr

a sector-attribute list or NULL or 'existing'. If a list, regress with the sectors specified by sectorAttr;if "existing", use the existing sector data in TSF(Make sure they are already exist!); if null, not regress with sectors.

forder

self defined factor importance order,can be missing,can be set of character or number,length of forder can be shorter than factors.

TSF

is a TSF object.

testf

is test factor name, can be missing.

Value

data frame of VIF and residual.

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
RebDates <- getRebDates(as.Date('2014-01-31'),as.Date('2016-09-30'))
TS <- getTS(RebDates,indexID = 'EI000905')
factorIDs <- c("F000006","F000008","F000012","F000015",
"F000016")
tmp <- buildFactorLists_lcfs(factorIDs,factorRefine=refinePar_default("scale"))
factorLists <- buildFactorLists(
  buildFactorList(factorFun="gf.NP_YOY",
                  factorPar=list(),
                  factorDir=1),
  buildFactorList(factorFun="gf.ln_mkt_cap",
                  factorPar=list(),
                  factorDir=-1),
  buildFactorList(factorFun="gf.G_MLL_Q",
                  factorPar=list(),
                  factorDir=1),
  factorRefine=refinePar_default("scale"))
factorLists <- c(tmp,factorLists)
TSF <- getMultiFactor(TS,FactorLists = factorLists)
----------------------VIF----------------------
VIF <- factor_VIF(TSF)

TSFR <- getTSR(TSF)
re <- reg.factor_select(TSFR)
re <- reg.factor_select(TSFR,sectorAttr=NULL)
nstock <- length(factorLists)
re <- reg.factor_select(TSFR,forder=sample(1:nstock,nstock))

raphael210/RFactorModel documentation built on May 26, 2019, 11:06 p.m.