mcusum_test {funtimes} | R Documentation |
Change Point Test for Regression
Description
Apply change point test by Horvath et al. (2017)
for detecting at-most-m
changes in regression coefficients, where
test statistic is a modified cumulative sum (CUSUM), and
critical values are obtained with sieve bootstrap (Lyubchich et al. 2020).
Usage
mcusum_test(
e,
k,
m = length(k),
B = 1000,
shortboot = FALSE,
ksm = FALSE,
ksm.arg = list(kernel = "gaussian", bw = "sj"),
...
)
Arguments
e |
vector of regression residuals (a stationary time series). |
k |
an integer vector or scalar with hypothesized change point location(s) to test. |
m |
an integer specifying the maximum 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. |
shortboot |
if |
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 |
Details
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 bootstrap-based p
-values for the test
(Lyubchich et al. 2020).
In the current implementation, the bootstrapped p
-value is calculated using equation 4.10 of
Davison and Hinkley (1997): p.value
= (1 + n
) / (B
+ 1),
where n
is number of bootstrapped statistics greater or equal to the observed statistic.
The test statistic corresponds to the maximal value of the modified CUSUM over
up to m
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 the parameter
.
Value
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 |
alternative |
alternative hypothesis. |
estimate |
list with elements: |
Author(s)
Vyacheslav Lyubchich
References
Davison AC, Hinkley DV (1997).
Bootstrap Methods and Their Application.
Cambridge University Press, Cambridge.
Horvath L, Pouliot W, Wang S (2017).
“Detecting at-most-m
changes in linear regression models.”
Journal of Time Series Analysis, 38, 552–590.
doi:10.1111/jtsa.12228.
Lyubchich V, Lebedeva TV, Testa JM (2020).
“A data-driven approach to detecting change points in linear regression models.”
Environmetrics, 31(1), e2591.
doi:10.1002/env.2591.
Examples
##### 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)