Learn R Programming

cpm (version 2.1)

makeChangePointModel: Creates a CPM S4 Object

Description

This function is used to create a change point model (CPM) S4 object. The CPM object can be used to process a sequence of data, one observation at a time. The CPM object maintains its state between each observation, and can be queried to obtain the D_{k,t} statistics, and to test whether a change has been detected. Note that this function is part of the S4 object section of the cpm package, which allows for more precise control over the change detection process. For many simple change detection applications this extra complexity will not be required, and the detectChangePoint and processStream functions should be used instead. 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

makeChangePointModel(cpmType, ARL0=500, startup=20, lambda=NA)

Arguments

Value

A CPM S4 object. The class of this object will depend on the value which has been passed as the cpmType argument.

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, 44:102-116 Ross, G. J., Adams, N. M. (2013) -- Sequential Monitoring of a Proportion, Computational Statistics, 28(2)

Ross, G. J., (2014) -- Sequential Change Detection in the Presence of Unknown Parameters, Statistics and Computing 24:1017-1030 Ross, G. J., (2015) -- Parametric and Nonparametric Sequential Change Detection in R: The cpm Package, Journal of Statistical Software, forthcoming

See Also

processObservation, changeDetected, cpmReset.

Examples

Run this code
#generate a sequence containing a single change point
x <- c(rnorm(100,0,1),rnorm(100,1,1))

#use a Student CPM
cpm <- makeChangePointModel(cpmType="Student", ARL0=500)

for (i in 1:length(x)) {

  #process each observation in turn
  cpm <- processObservation(cpm,x[i])
  
  if (changeDetected(cpm)) {
    print(sprintf("change detected at observation %s",i))
    break
  }
}

Run the code above in your browser using DataLab