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

View source: R/LocationStability.R

Plots the middle detail level of the changepoint location stability according to the influence measure.

1 2 3 4 |

`original.cpts` |
An ordered vector of the changepoint locations found by your favourite changepoint method. |

`influence` |
The influence as calculated the |

`expected.class` |
Only needed for |

`type` |
The type of Location Stability plot, can be |

`data` |
A vector containing the data on which you have run your changepoint method. |

`include.data` |
Is a plot of the data to be included above the histogram. Default is |

`cpt.lwd` |
The line width to be used when plotting the |

`cpt.col` |
Colour of the |

`cpt.lty` |
Line type of the |

`ylab, xlab` |
The labels for the x- and y-axis, character vector expected. |

`...` |
Any other arguments to be passed to the |

This function creates a more granular graphic to display the results of a changepoint influence analysis on the location of the changepoints. The graphic is a histogram of the observed segmentations under the "delete" or "outlier" Influence analysis. The colour and line type of the bars at the `original.cpts`

locations reflect their stability. The first value of their arguments denotes a stable changepoint - which appears at the same location in all influence segmentations. The second argument denotes an unstable changepoint - which doesn't appear at the same location in all influence segmentations, either it moves or is deleted. The third argument denotes changepoint locations which are deemed outliers as two changepoints occur at consecutive locations (surrounding the outlying observation). Please note that the `type="Global"`

only uses colour and not line type.

`type="Difference"`

gives the difference between the observed and expected changepoint segmentations under the "delete" or "outlier" Influence analysis. A positive value can only occur where a changepoint is contained in the observed segmentations but is not present in the expected (an additional changepoint time). A negative value can only occur at the original changepoint location where the changepoint is not present in atleast one of the observed segmentations. Note that the expected segmentations take into account the fact that a changepoint at a timepoint, say 100, will move (to 99) when a timepoint prior to it is deleted.

`type="Global"`

histograms the observed segmentations. Colour is added to the original changepoint locations and a horizontal (light grey) line is added to the plot to denote the maximum count. Any original changepoint bars that do not meet this grey line indicates that the changepoint is unstable as it either moves or is deleted in atleast one of the observed segmentations. For large datasets this can be difficult to view what is going on at any locations that appear as black bars as these are typically small counts. Hence the inclusion of the "Local" option.

`type="Local"`

histograms the observed segmentations with the original changepoint locations removed. This is to allow users to see the smaller counts that can be masked in larger datasets. These are the locations where either original changepoints move to or additional changepoints are added.

The function returns plot(s) and a list containing the labels of the `original.cpts`

as either "stable", "unstable", or "outlier". If `type="Difference"`

and `expected.class=NULL`

then the expected class is also returned as the first element of the list.

Rebecca Killick

Wilms I, Killick R, Matteson DS (2021) Graphical Influence Diagnostics for Changepoint Models, *ArxiV: 2107.10572*

`influence`

, `StabilityOverview`

,`ParameterStability`

,`InfluenceMap`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
#### 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)
#### Location Stability Difference plot ####
exp.class=LocationStability(cpts(xcpt), type = 'Difference', x.inf, cpt.lwd = 4, las = 1)
# note that the expected.class is also returned
#### Location Stability Global plot ####
exp.class=LocationStability(cpts(xcpt), type = 'Global', x.inf, cpt.lwd = 4, las = 1)
#### Location Stability Local plot ####
exp.class=LocationStability(cpts(xcpt), type = 'Local', x.inf, cpt.lwd = 4, las = 1)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.