AuePolyReg_test: Testing for Change Points in Time Series via Polynomial...

View source: R/AuePolyReg_test.R

AuePolyReg_testR Documentation

Testing for Change Points in Time Series via Polynomial Regression

Description

The function uses a nonlinear polynomial regression model in which it tests for the null hypothesis of structural stability in the regression parameters against the alternative of a break at an unknown time. The method is based on the extreme value distribution of a maximum-type test statistic which is asymptotically equivalent to the maximally selected likelihood ratio. The resulting testing approach is easily tractable and delivers accurate size and power of the test, even in small samples \insertCiteAue_etal_2008funtimes.

Usage

AuePolyReg_test(
  y,
  a.order,
  alpha = 0.05,
  crit.type = c("asymptotic", "bootstrap"),
  bootstrap.method = c("nonparametric", "parametric"),
  num.bootstrap = 1000
)

Arguments

y

a vector that contains univariate time series observations. Missing values are not allowed.

a.order

order of the autoregressive model which must be a non-negative integer number.

alpha

significance level for testing hypothesis of no change point. Default value is 0.05.

crit.type

method of obtaining critical values: "asymptotic" (default) or "bootstrap".

bootstrap.method

type of bootstrap if crit.type = "bootstrap": "nonparametric" (default) or "parametric".

num.bootstrap

number of bootstrap replications if crit.type = "bootstrap". Default number is 1000.

Value

A list with the following components:

index

time point where the change point has occurred.

stat

test statistic.

crit.val

critical region value (CV(alpha, n)).

p.value

p-value of the change point test.

Author(s)

Palina Niamkova, Dorcas Ofori-Boateng, Yulia R. Gel

References

\insertAllCited

See Also

mcusum.test change point test for regression

Examples

## Not run: 
#Example 1:

#Simulate some time series:
set.seed(23450)
series_1 = rnorm(137, 3, 5)
series_2 = rnorm(213, 0, 1)
series_val = c(series_1, series_2)
AuePolyReg_test(series_1, 1) # no change (asymptotic)
AuePolyReg_test(series_val,1) # one change (asymptotic)

#Example 2:

#Consider a time series with annual number of world terrorism incidents from 1970 till 2016:
c.data = Ecdat::terrorism["incidents"]
incidents.ts <- ts(c.data, start = 1970, end = 2016)

#Run a test for change points:
AuePolyReg_test(incidents.ts, 2) # one change (asymptotic)
AuePolyReg_test(incidents.ts, 2, 0.05,"bootstrap", "parametric", 200) 
# one change (bootstrap)
incidents.ts[44] #number of victims at the value of change point
year <- 197 + 44 - 1  # year when the change point occurred
plot(incidents.ts) # see the visualized data

#The structural change point occurred at the 44th value which corresponds to 2013, 
#with 11,990 identified incidents in that year. These findings can be explained with 
#a recent rise of nationalism and  extremism due to appearance of the social media, 
#Fisher (2019): White Terrorism Shows 'Stunning' Parallels to Islamic State's Rise. 
#The New York Times.

## End(Not run)


funtimes documentation built on March 31, 2023, 7:35 p.m.