istar_CUSUM: time index that triggers a symmetric CUSUM filter

Description Usage Arguments Author(s) Examples

View source: R/RcppExports.R

Description

time index that triggers a symmetric CUSUM filter

Usage

1

Arguments

x

a vector of time series to be filtered

h

a vector of the thresholds

Author(s)

Larry Lei Hua

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(1)
x <- runif(100, 1, 3)
h <- rep(1.5, 100)
i_CUSUM <- istar_CUSUM(x,h)
abline(v=i_CUSUM, lty = 2)

## Comparing C and R versions
# set.seed(1)
# x <- runif(1000000, 1, 3)
# h <- rep(1.5, 100)

# start_time <- Sys.time()
# i_CUSUM <- istar_CUSUM(x,h)
# end_time <- Sys.time()
# C_time <- end_time - start_time

# start_time <- Sys.time()
# i_CUSUM_R <- istar_CUSUM_R(x,h)
# end_time <- Sys.time()
# R_time <- end_time - start_time
# cat("C and R time: ", C_time, R_time)
# all(i_CUSUM-i_CUSUM_R==0)

larryleihua/fmlr documentation built on Jan. 31, 2020, 8:55 a.m.