GenSubidxSD: Generate sub period index based on robust rolling std range...

Description Usage Arguments Value Examples

Description

excluding values that are out of sd range (mean p/n threshold times sd) from the rolling window to get more stable range of changes

Usage

1
2
GenSubidxSD(series, winlen = 36, sd.threshold = 3, smooth.winlen = 3,
  IF.LAG = FALSE)

Arguments

series

xts object, benchmark time series, monthly for now

winlen

numeric, rolling window length for calculating sd and mean

sd.threshold

integer, used for the boundary of standard deviation for the range

smooth.winlen

integer, showing how many true in a row to get a true in the index, used for cleaning fragmental: minimum allowed len for index to be positive

Value

zoo::index, monthly for now, can used by series[idx]

Examples

1
2
3
4
5
6
7
8
9
# to filter the efa's EFA
pcg.SEE <- pe.SEE / xts::lag.xts(pe.SEE) - 1 # pe.SEE is a PE ratio xts dataframe
stable.idx.efa <- pcg.SEE$EFA %>% na.omit %>%
  GenSubidxSD(sd.threshold = 2, IF.LAG = TRUE, smooth.winlen = 3, winlen = 36)
pcg.SEE$EFA %>% na.omit %>%
  PlotFilterCompLine(stable.idx.efa, "Std Filter for EFA")

# partially modify the signal
signal[!(index(signal) %in% stable.idx.efa)] <- 1;

hughshuwang/isocyanate documentation built on May 30, 2019, 7:17 a.m.