influence-methods | R Documentation |
~~ Methods for function influence
~~
## S4 method for signature 'cpt'
influence(model,method=c("delete","outlier"),pos=TRUE,same=FALSE,sd=0.01)
model |
Depending on the class of |
method |
Either |
pos |
For |
same |
For |
sd |
For |
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.
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)
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.
StabilityOverview
, LocationStability
,ParameterStability
,InfluenceMap
#### 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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.