PELT.online.initialise: PELT.online.initiliase (Pruned Exact Linear Time) - Only...

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

View source: R/wrapper.R

Description

Implements the PELT method for identifying changepoints in a given set of summary statistics for a specified cost function and penalty.

This function is called by ocpt.mean.initialise, ocpt.var.initialise and ocpt.var.initialise when method="PELT". This is not intended for use by regular users of the package. It is exported for developers to call directly for speed increases or to fit alternative cost functions.

WARNING: No checks on arguments are performed!

Usage

1
2
PELT.online.initialise(sumstat, pen=0, 
cost_func = "mean.norm", shape = 1, minseglen = 1)

Arguments

sumstat

A matrix containing the summary statistics of data within which you wish to find a changepoint. Currently assumes 3 columns and uses the number of rows as the length of the data +1 (initial value of 0).

pen

Default choice is 0, this should be evaluated elsewhere and a numerical value entered. This should be positive - this isn't checked but results are meaningless if it isn't.

cost_func

The friendly name of the cost function to be called in C. If using your own cost function, this must be the name of the C function to use.

shape

Only required for cost_func="Gamma",default is 1. Must be a positive value, this isn't checked.

minseglen

Positive integer giving the minimum segment length (no. of observations between changes), default is 1. No checks are performed on the input value so it could be larger than feasible to have changes in the data.

Details

This function is used as a wrapper function to implement the PELT algorithm in C. It simply creates the necessary worker vectors, ensures all inputs are the correct type, and passes everything to the C function.

This function is exported for developer use only. It does not perform any checks on inputs (other than type coersion) and is simply a wrapper function for the C code.

Value

A list is returned with elements:

cost_func

The cost function that has been used.

sumstat

The summary statistics for the time series.

ndone

Length of the time series when analysis begins.

nupdate

Length of the time series to be analysed in this update.

penalty

Penalty used to decide if a changepoint is significant.

cptsout

Vector of locations of the identified changepoints up to (ndone+nupdate).

error

0 by default, nonzero indicates error in code.

shape

Only used when cost_func is the gamma likelihood. Otherwise 1.

minseglen

Minimum segment length.

lastchangelike

Vector of lenght n containing the likelihood of the optimal segmentation up to each timepoint.

lastchangecpts

Vector of length n containing the last changepoint prior to each timepoint.

checklist

Vector of locations of the potential last changepoint for next iteration (to be updated), max length=(ndone+nupdate).

nchecklist

Number in the checklist currently (to be updated).

numchangecpts

Stores the current number of changepoints detected.

Author(s)

Andrew Connell, Rebecca Killick

References

PELT Algorithm: Killick R, Fearnhead P, Eckley IA (2012) Optimal detection of changepoints with a linear computational cost, JASA 107(500), 1590–1598

CROPS: Haynes K, Eckley IA, Fearnhead P (2014) Efficient penalty search for multiple changepoint problems (in submission), arXiv:1412.3617

See Also

PELT.online,PELT.online.update,ocpt

Examples

1
2
#This function should only be used by developers, 
#see its use in ocpt.mean.initialise and ocpt.mean.initialize.

rkillick/changepoint.online documentation built on Sept. 26, 2020, 11:01 p.m.