changepoints_lin2_cl: Change-point detection for a linear AR(1) model with...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/changepoints_lin2_cl.R

Description

This function detects change points for parameter changes of a linear AR(1) model with intercept based on simplicial depth. The model is defined by

Y_n = θ_1 Y_{n-1} + θ_0 + E_n

with med(E_n)=0. The main idea is based on estimators and confidence intervals based on simplicial depth as proposed by Kustosz (2016). Further, a preselection of candidates by a simplified depth notion is used. This is a version which uses a preset cluster which hast to be passed as argument when calling the function.

Usage

1
changepoints_lin2_cl(y, level, bw, sw, plots, method, cluster, mincper, mincp)

Arguments

y

An observed AR(1) process with intercept.

level

The level for which the confidence intervals for the phase change detection are calculated.

bw

A bandwidth defining the sample size for sub-samples which are evaluated in the detection algorithm.

sw

A step-width to reduce the candidate points in which the change points are evaluated.

plots

A switch (TRUE and FALSE) to determine if plots shall be produced for each tested candidate

method

This parameter determines the method to detect change points. If method = "m1" is selected a candidate is marked as change, if the confidence intervals do not overlap. For method = "m2" the change point is marked, if the estimates are not inside of the non respective confidence intervals.

cluster

Initialized cluster for parallel computing.

mincper

Percentage to define relevant change-point clusters based on the length of the 'mincp' longest detected cluster.

mincp

The 'mincp' longest cluster is used to define a threshold for detected clusters which are considered for final break-point estimates. This implies, that (if enough clusters exist), the number also defines the minimal amount of detected breakpoints.

Details

For details see Kustosz (2016).

Value

candidates

A vector of observation indices in which the algorithm tested for change points.

changepoints

A vector indicating, if a change point was detected in the respective candidate.

Author(s)

Kustosz, Christoph

References

Kustosz, C. (2016). Depth based estimators and tests for autoregressive processes with application. Ph. D. thesis. TU Dortmund.

See Also

RandomARMod_lin2, lin2_CI_cl, convex_hull_plot, convex_hull_intersect, est_lin2, dS_lin2, dS_lin2_test, dS1_lin2_test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
int1 <- 0.1
int2 <- 0.3
arp1 <- 1.015
arp2 <- 1.001

set.seed(123)
y1 <- RandomARMod_lin2(50, int1, arp1, 15, "0")
y2 <- RandomARMod_lin2(50, int2, arp2, y1[length(y1)], "0")
y <- c(y1,y2)





## Not run: 
cl <- makeCluster(2)

CP1 <- changepoints_lin2_cl(y, 0.99, 25, 5, plots = FALSE, method = "m1", cl = cl)
CP2 <- changepoints_lin2_cl(y, 0.99, 25, 5, plots = FALSE, method = "m2", cl = cl)


stopCluster(cl)

par(mfrow = c(2, 1))
plot(y, type="l")
abline(v=CP1$candidates[CP1$changepoints==1], col=4,lty=4)
abline(v=CP2$candidates[CP2$changepoints==1], col=5,lty=5)

plot(y, type="l")
abline(v=CP1$rjumps, col=4,lty=4,lwd=2)
abline(v=CP2$rjumps, col=5,lty=5,lwd=3)

## End(Not run)

ChrisKust/rexpar documentation built on May 6, 2019, 11:48 a.m.