mcusum_test | R Documentation |
Apply change point test by \insertCiteHorvath_etal_2017;textualfuntimes
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 \insertCiteLyubchich_etal_2020_changepointsfuntimes.
mcusum_test(
e,
k,
m = length(k),
B = 1000,
shortboot = FALSE,
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. |
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 |
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
\insertCiteLyubchich_etal_2020_changepointsfuntimes.
In the current implementation, the bootstrapped p
-value is calculated using equation 4.10 of
\insertCiteDavison_Hinkley_1997;textualfuntimes: 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
.
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: |
Vyacheslav Lyubchich
##### 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.