R/ChangePointModel.R

Defines functions updateWindowStatistic getTestStatistics

#S4 class for change point model object
setClass(
	Class="ChangePointModel",
		representation=representation(
            windowStatistic='list',
			hs='numeric',
			n='numeric',
			startup='numeric',
            changeDetected='logical'
		),
		prototype(
			n=0,
			startup=20,
			changeDetected=FALSE,
			hs=numeric()
		)
)

#returns D_{k,t} statistics
getTestStatistics <- function(cpm) {
	standardGeneric("getTestStatistics")	
}

#updates the CPM given an observation
updateWindowStatistic <- function(cpm,x) {
	standardGeneric("updateWindowStatistic")	
}


setGeneric(name='getTestStatistics',def=getTestStatistics)
setGeneric(name='updateWindowStatistic',def=updateWindowStatistic)

Try the cpm package in your browser

Any scripts or data that you put into this service are public.

cpm documentation built on Nov. 16, 2020, 9:13 a.m.