Learn R Programming

cpm (version 2.0)

detectChangePoint: Detect a Single Change Point in a Sequence

Description

This function is used to detect a single change point in a sequence of observations using the Change Point Model (CPM) framework for sequential (Phase II) change detection. The observations are processed in order, starting with the first, and a decision is made after each observation whether a change point has occurred. If a change point is detected, the function returns with no further observations being processed. A full description of the CPM framework can be found in the papers cited in the reference section. For a fuller overview of this function including a description of the CPM framework and examples of how to use the various functions, please consult the package manual "Parametric and Nonparametric Sequential Change Detection in R: The cpm Package" available from www.gordonjross.co.uk

Usage

detectChangePoint(x, cpmType, ARL0=500, startup=20, lambda=NA)

Arguments

Value

xThe sequence of observations which was processed.changeDetectedTRUE if any $D_t$ exceeds the value of $h_t$ associated with the chosen $ARL_0$, otherwise FALSE.detectionTimeThe observation after which the change point was detected, defined as the first observation after which $D_t$ exceeded the test threshold. If no change is detected, this will be equal to 0.changePointThe best estimate of the change point location. If the change is detected after the $t^{th}$ observation, then the change estimate is the value of $k$ which maximises $D_{k,t}$. If no change is detected, this will be equal to 0.DsThe sequence of maximised $D_t$ statistics, starting from the first observation until the observation after which the change point was detected

References

Hawkins, D. , Zamba, K. (2005) -- A Change-Point Model for a Shift in Variance, Journal of Quality Technology, 37, 21-31 Hawkins, D. , Zamba, K. (2005b) -- Statistical Process Control for Shifts in Mean or Variance Using a Changepoint Formulation, Technometrics, 47(2), 164-173 Hawkins, D., Qiu, P., Kang, C. (2003) -- The Changepoint Model for Statistical Process Control, Journal of Quality Technology, 35, 355-366. Ross, G. J., Tasoulis, D. K., Adams, N. M. (2011) -- A Nonparametric Change-Point Model for Streaming Data, Technometrics, 53(4) Ross, G. J., Adams, N. M. (2012) -- Two Nonparametric Control Charts for Detecting Arbitary Distribution Changes, Journal of Quality Technology, In Press Ross, G. J., Adams, N. M. (2013) -- Sequential Monitoring of a Proportion, Computational Statistics, 28(2)

Ross, G. J., (2013) -- Sequential Change Detection in the Presence of Unknown Parameters (to appear)

See Also

processStream, detectChangePointBatch.

Examples

Run this code
## Use a Student-t CPM to detect a mean shift in a stream of Gaussian 
     ## random variables which occurs after the 100th observation
     x <- c(rnorm(100,0,1),rnorm(1000,1,1))
     detectChangePoint(x,"Student",ARL0=500,startup=20)


     ## Use a Mood CPM to detect a scale shift in a stream of Student-t 
     ## random variables which occurs after the 100th observation
     x <- c(rt(100,5),rt(100,5)*2)
     detectChangePoint(x,"Mood",ARL0=500,startup=20)

     ## Use a FET CPM to detect a parameter shift in a stream of Bernoulli 
     ##observations. In this case, the lambda parameter acts to reduce the 
     ##discreteness of the test statistic.
     x <- c(rbinom(100,1,0.2), rbinom(1000,1,0.5))
     detectChangePoint(x,"FET",ARL0=500,startup=20,lambda=0.3)

Run the code above in your browser using DataLab