Description Usage Arguments Details Value Author(s) References Examples
Apply change point test by \insertCiteHorvath_etal_2017;textualfuntimes for detecting atmostm changes in regression coefficients, where test statistic is a modified cumulative sum (CUSUM), and critical values are obtained with sieve bootstrap \insertCiteLyubchich_etal_2020_changepointsfuntimes.
1 2 3 4 5 6 7 8  mcusum_test(
e,
k,
B = 1000,
ksm = FALSE,
ksm.arg = list(kernel = "gaussian", bw = "sj"),
...
)

e 
vector of regression residuals (a stationary time series). 
k 
an integer vector or scalar with hypothesized change point location(s) to
test. The length of this vector is treated as m, that is, the number of change
points being confirmed as statistically significant (from those
specified in 
B 
number of bootstrap simulations to obtain empirical critical values. Default is 1000. 
ksm 
logical value indicating whether a kernel smoothing to innovations in sieve
bootstrap shall be applied (default is 
ksm.arg 
used only if 
... 
additional arguments passed to 
The sieve bootstrap is applied by approximating regression residuals e
with an AR(p) model using function ARest
,
where the autoregressive coefficients are estimated with ar.method
,
and order p is selected based on ar.order
and BIC
settings
(see ARest
). At the next step, B
autoregressive processes
are simulated under the null hypothesis of no change points.
The distribution of test statistics M_T computed on each of those
bootstrapped series is used to obtain bootstrapbased pvalues for the test
\insertCiteLyubchich_etal_2020_changepointsfuntimes.
The test statistic corresponds to the maximal value of the modified CUSUM over
all combinations of hypothesized change points specified in k
. The change
points that correspond to that maximum are reported in estimate$khat
,
and their number is reported as parameter
.
A list of class "htest"
containing the following components:
method 
name of the method. 
data.name 
name of the data. 
statistic 
obseved value of the test statistic. 
parameter 

p.value 
bootstrapped pvalue of the test. 
alternative 
alternative hypothesis. 
estimate 
list with elements: 
Vyacheslav Lyubchich
1 2 3 4 5 6 7 8 9 10 11 12 13  ##### Model 1 with normal errors, by Horvath et al. (2017)
T < 100 #length of time series
X < rnorm(T, mean = 1, sd = 1)
E < rnorm(T, mean = 0, sd = 1)
SizeOfChange < 1
TimeOfChange < 50
Y < c(1 * X[1:TimeOfChange] + E[1:TimeOfChange],
(1 + SizeOfChange)*X[(TimeOfChange + 1):T] + E[(TimeOfChange + 1):T])
ehat < lm(Y ~ X)$resid
mcusum_test(ehat, k = c(30, 50, 70))
#Same, but with bootstrapped innovations obtained from a kernel smoothed distribution:
mcusum_test(ehat, k = c(30, 50, 70), ksm = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.