influence-methods: ~~ Methods for Function influence ~~

Description Usage Arguments Details Value Methods See Also Examples

Description

~~ Methods for function influence ~~

Usage

1
2
3
influence(model,...)
## S4 method for signature 'cpt'
influence(model,method=c("delete","outlier"),pos=TRUE,same=FALSE,sd=0.01)

Arguments

model

Depending on the class of model depends on the method used (and if one exists). For cpt objects this is the original output from a call to the cpt.*() suite of functions in the "changepoint" package.

method

Either "delete" or "outlier". These control what happens to the individual observations when the data is perturbed. See details for further information on the difference between the two.

pos

For method="outlier" this is whether the outlier is positive (TRUE) or negative (FALSE).

same

For method="outlier" and multiple outliers, this is whether we want the outliers to have the same mean (TRUE) (takes the first outlier, adds 2*range(data), then jitters the others around this value) or whether we add 2*range(data) to the existing value of each datapoint (FALSE).

sd

For method="outlier", the standard deviation of the jitter, see same argument.

Details

Calculates the influence of the data on the observed segmentation. There are currently two methods implemented for this method="delete" and method="outlier".

Both methods sequentially take each data point, modify it and then run the same changepoint algorithm on the modified data as the original data. We record the new segmentations in an nxn matrix output of the segment number for each location 1,...,n for each of the 1,...,n data modifications.

If a datapoint has no undue influence on the overall segmentation then the segmentation with that datapoint modified will be the same as the original segmentation. We define undue influence as any unexpected variation in the segmentations when data points are modified.

The method="delete" modifies a datapoint by deleting it. This is recorded as an NA value in the returned nxn matrix to preserve indexing. The method="outlier" modifies a datapoint by making it an outlier (+/- 2*range(data)). When we make a datapoint an outlier we force it to be in its own segment and thus expect to introduce two new changepoints to the resulting segmentation.

Value

A list containing the following elements:

$delete, if the modify="delete" $class.del, an nxn matrix of the class at each time point (NA along the diagonal) $param.del, an nxn matrix of the parameter at each time point (NA along the diagonal) $outlier, if the modify="outlier" $class.out, an nxn matrix of the class at each time point (NA along the diagonal) $param.out, an nxn matrix of the parameter at each time point (NA along the diagonal)

Methods

signature(model = "cpt",method=c("delete","outlier"),pos=TRUE,same=FALSE,sd=0.01)

For model="cpt" objects this is the original output from a call to the cpt.*() suite of functions in the "changepoint" package.

See Also

StabilityOverview, LocationStability,ParameterStability,InfluenceMap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#### Generate Simulated data example ####
set.seed(30)
x = c(rnorm(50), rnorm(50, mean = 5), rnorm(1, mean = 15), rnorm(49, mean = 5), rnorm(50, mean = 4))
xcpt = cpt.mean(x,method='PELT') # Get the changepoints via PELT

#### Get the influence for both delete and outlier options ####
x.inf = influence(xcpt)

#### Get the influence using delete method ####
x.inf = influence(xcpt, method="delete")

#### Get the influence using outlier method ####
x.inf = influence(xcpt, method="outlier", pos=FALSE,same=FALSE) 
# no sd required as no jitter used.

changepoint.influence documentation built on Aug. 4, 2021, 5:06 p.m.