lastCptTest {fastOnlineCpt}R Documentation

Return the last result of the changepoint test performed with the function "checkCpt" as a vector.

Description

Return the last result of the changepoint test performed with the function "checkCpt" as a vector.

Usage

lastCptTest(obj)

## S4 method for signature 'fastOnlineCpt'
lastCptTest(obj)

Arguments

obj

An object of the class "fastOnlineCpt".

Value

A 5-dimensional vector containing the number of the test, the value of the Z-statistic, the p-value, the available testing level, and the changepoint location if a changepoint has been detected or NA otherwise. If no previous test has been performed, NA is returned.

References

Hahn, G. (2021). Online multivariate changepoint detection with type I error control and constant time/memory updates per series. Under review.

Examples

library(fastOnlineCpt)
alpha <- 0.01
halfspent <- 100
spending_sequence <- function(n) { (n/(n+halfspent) - (n-1)/(n-1+halfspent)) * alpha }
obj <- fastOnlineCpt(spending_sequence)
p <- 10
n <- 50
data <- matrix(rnorm(p*n,mean=0),ncol=n)
obj <- addData(obj,data)
obj <- checkCpt(obj)
print(lastCptTest(obj))
data <- matrix(rnorm(p*n,mean=1),ncol=n)
obj <- addData(obj,data)
obj <- checkCpt(obj)
print(lastCptTest(obj))


[Package fastOnlineCpt version 1.0 Index]