backtest.Ngroup: backtest.Ngroup

Description Usage Arguments Value Author(s) Examples

Description

backtesting the factor with some tables and charts using the 'Ngroup' method.

Usage

 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
seri.Ngroup.rtn(TSFR, N = 5, relative = FALSE, include_univ = FALSE,
  sectorNe = NULL, bysector = NULL)

seri.Ngroup.spread(TSFR, N = 5, sectorNe = NULL,
  rtn_type = c("long-short", "long-univ"))

seri.Ngroup.turnover(TSFR, N = 5, sectorNe = NULL)

seri.Ngroup.size(TSFR, N = 5, include_univ = FALSE, sectorNe = NULL,
  fl = fl_cap(log = TRUE, var = "float_cap"))

table.Ngroup.overall(TSFR, N = 5, relative = FALSE, sectorNe = NULL,
  bysector = NULL, fee = 0, rtn_type = c("long-short", "long-univ"))

table.Ngroup.spread(TSFR, N = 5, sectorNe = NULL, fee = 0,
  rtn_type = c("long-short", "long-univ"))

chart.Ngroup.overall(TSFR, N = 5, relative = TRUE, sectorNe = NULL,
  bysector = NULL)

chart.Ngroup.seri_point(TSFR, N = 5, relative = TRUE, Nbin = "day",
  sectorNe = NULL)

chart.Ngroup.violin(TSFR, N = 5, sectorNe = NULL, jitter = TRUE)

chart.Ngroup.box(TSFR, N = 5, sectorNe = NULL)

chart.Ngroup.seri_bar(TSFR, N = 5, relative = TRUE, Nbin = "day",
  sectorNe = NULL, bysector = NULL)

chart.Ngroup.seri_line(TSFR, N = 5, relative = TRUE, include_univ = TRUE,
  sectorNe = NULL)

chart.Ngroup.spread(TSFR, N = 5, sectorNe = NULL,
  rtn_type = c("long-short", "long-univ"))

chart.Ngroup.turnover(TSFR, N = 5, group = 1, sectorNe = NULL)

chart.Ngroup.size(TSFR, N = 5, include_univ = TRUE, sectorNe = NULL,
  fl = fl_cap(log = TRUE, var = "float_cap"))

MF.chart.Ngroup.spread(mTSFR, N = 5, sectorNe = NULL,
  rtn_type = c("long-short", "long-univ"), relative = FALSE,
  facet_by = c("none", "date", "fname"), Nbin = "year")

MF.chart.Ngroup.size_spread(mTSFR, N = 5, type = c("long-short",
  "long-univ"), fl = fl_cap(log = TRUE, var = "float_cap"))

MC.table.Ngroup.overall(TSFRs, N = 5, sectorNe = NULL, fee = 0,
  rtn_type = c("long-short", "long-univ"))

MC.chart.Ngroup.overall(TSFRs, N = 5, relative = TRUE, sectorNe = NULL,
  bysector = NULL, ncol = NULL)

MC.chart.Ngroup.spread(TSFRs, N = 5, sectorNe = NULL,
  rtn_type = c("long-short", "long-univ"), relative = FALSE,
  fillNA = TRUE, facet = FALSE)

MC.chart.Ngroup.size_spread(TSFRs, N = 5, type = c("long-short",
  "long-univ"), fl = fl_cap(log = TRUE, var = "float_cap"))

Arguments

TSFR

a TSFR object

N

the number of the groups the universe is cut to

sectorNe

NULL, "existing", or a sectorAttr

fee

a numeric, giving the (one side) fee

Nbin

the number of the groups the timespan is cut to, when plotting the "date.grp".It could also be character of interval specification,See cut.Date for detail. the default value is "day",which means no cutting, The value of every date are ploted.

group

a integer, indicating the group whose turnover be plotted

mTSFR

a mTSFR object. See getMultiFactor.

TSFRs

a list of object TSFR. See Model.TSFR.

ncol

a integer, specificate the number of cols of the multi-charts.

sectorAttr

NULL, "existing", or a sectorAttr

Value

seri.Ngroup.rtn return a xts object, which giving the rtn seri of each group

seri.Ngroup.spread return a xts, which giving the spread return seri of "long-short" or "long-univ"

seri.Ngroup.turnover return a xts, which giving the (one side) num or wgt turnover seri of each group

seri.Ngroup.size return a xts, which giving the mean market-cap seri of each group.

table.Ngroup.overall return a matrix which giving the statistics of the rtn of each group, as well as the rtn of top-bottom spread.

table.Ngroup.spread return a matrix which giving the statistics of the rtn of top-bottom spread in each year.

chart.Ngroup.overall return a ggplot object of "Annualized return of each group"

chart.Ngroup.seri_point return a ggplot object of "return time series of the groups" with geom_point

chart.Ngroup.seri_bar return a ggplot object of "return time series of the groups" with geom_bar

chart.Ngroup.seri_line return a ggplot object of "Cumulated return of each group" with geom_line

chart.Ngroup.spread return and print a recordedplot object of "Performance Summary of top-bottom spread" .

chart.Ngroup.turnover return a ggplot object of "Turnover Rate of each rebalancing point"

chart.Ngroup.turnover return a line chart of "Mean mkt-cap of each group at each rebalancing point"

MC.table.Ngroup.overall return a matrix, which giving the statistics of the top-bottom spread of each TSFR.

Author(s)

Ruifei.Yin

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
modelPar <- modelPar.default()
TSFR <- Model.TSFR(modelPar)
re <- seri.Ngroup.rtn(TSFR,5)
re2 <- seri.Ngroup.rtn(TSFR,5,include_univ=TRUE)
re <- seri.Ngroup.spread(TSFR,5)
re <- seri.Ngroup.turnover(TSFR,5)
re <- seri.Ngroup.size(tsf,fl=buildFactorList("gf.amt"))
chart.Ngroup.size(tsf,fl = buildFactorList("gf.amt",factorPar = list(log=TRUE)))
re <- table.Ngroup.overall(TSFR,5,fee=0.002)
re2 <- table.Ngroup.overall(TSFR, rtn_type = "long-univ")
re <- table.Ngroup.spread(TSFR,5,fee=0.002)
re2 <- table.Ngroup.spread(TSFR, rtn_type = "long-univ")
chart.Ngroup.overall(TSFR,5)
chart.Ngroup.seri_point(TSFR,5,"3 month")
chart.Ngroup.seri_bar(TSFR,5,"3 month")
chart.Ngroup.seri_line(TSFR,5)
chart.Ngroup.spread(TSFR,5)
chart.Ngroup.spread(TSFR, rtn_type = "long-univ")
chart.Ngroup.turnover(TSFR,5)
mTSFR <- getMultiFactor(TSR)
MF.chart.Ngroup.spread(mTSFR)
mp = modelPar.default()
factorIDs <- c("F000001","F000002","F000005")
FactorLists <- buildFactorLists_lcfs(factorIDs)
mps <- getMPs_FactorLists(FactorLists,modelPar=mp)
TSR <- Model.TSR(mp)
TSFRs <- Model.TSFs_byTS(MPs=mps,TS=TSR)
MC.table.Ngroup.overall(TSFRs)
MC.chart.Ngroup.overall(TSFRs)

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