Description Usage Arguments Details Value Examples
View source: R/pelt.bck.R View source: R/pelt.R
Calculates the optimal positioning and number of changepoints using PELT.
Calculates the optimal positioning and number of changepoints using PELT.
1 2 3 4 5 6 7 | pelt(data, pen = 2 * log(length(data)), min.dist = 2,
cost = pelt.norm.meanvar.cost, sum.stat = pelt.norm.sum,
initial.likelihood.value = 0)
pelt(data, pen = 2 * log(length(data)), min.dist = 2,
cost = pelt.norm.meanvar.cost, sum.stat = pelt.norm.sum,
initial.likelihood.value = 0)
|
data |
A vector of length |
pen |
Numeric value of the linear penalty function. This value is used in the decision for each individual changepoint so that in total the penalty is k*pen where k is the optimal number of changepoints detected. |
min.dist |
The minimum distance allowed between any two changepoints. Required to have an integer value of at least 1 for changes in mean, or at least 2 for changes in variance. |
cost |
The function used to calculate the cost of a given segment of data. The choice of this function dictates the assumed distribution and the type(s) of changes being detected (or simply the generic cost of data if non-parametric). See Details for possible choices. |
sum.stat |
The function used to generate the summary statistics used by |
initial.likelihood.value |
The initial value of the likelihood/cost function. |
data |
A vector of length |
pen |
Numeric value of the linear penalty function. This value is used in the decision for each individual changepoint so that in total the penalty is k*pen where k is the optimal number of changepoints detected. |
min.dist |
The minimum distance allowed between any two changepoints. Required to have an integer value of at least 1 for changes in mean, or at least 2 for changes in variance. |
cost |
The function used to calculate the cost of a given segment of data. The choice of this function dictates the assumed distribution and the type(s) of changes being detected (or simply the generic cost of data if non-parametric). See Details for possible choices. |
sum.stat |
The function used to generate the summary statistics used by |
initial.likelihood.value |
The initial value of the likelihood/cost function. |
This method uses the PELT algorithm to obtain the optimal number and location of changepoints within a univariate time series. This is done via the minimisation of a penalised cost function using dynamic programming. Inequality-based pruning is used to reduce computation whilst retaining optimality. A range of different cost functions and penalty values can be used.
This method uses the PELT algorithm to obtain the optimal number and location of changepoints within a univariate time series. This is done via the minimisation of a penalised cost function using dynamic programming. Inequality-based pruning is used to reduce computation whilst retaining optimality. A range of different cost functions and penalty values can be used.
The vector of changepoint locations detected by PELT.
The vector of changepoint locations detected by PELT.
1 2 3 4 5 6 7 8 9 10 | # Normal observations, multiple change in mean.
data = c( rnorm(100, mean=0, sd=1), rnorm(100, mean=5, sd=1), rnorm(100, mean=-1, sd=1), rnorm(100, mean=2, sd=1) )
# plot.ts(data)
n = length(data)
pelt.results = pelt(data=data, pen=2*log(n), cost=pelt.norm.mean.cost, sum.stat=pelt.norm.sum)
# Normal observations, multiple change in mean.
data = c( rnorm(100, mean=0, sd=1), rnorm(100, mean=5, sd=1), rnorm(100, mean=-1, sd=1), rnorm(100, mean=2, sd=1) )
# plot.ts(data)
n = length(data)
pelt.results = pelt(data=data, pen=2*log(n), cost=pelt.norm.mean.cost, sum.stat=pelt.norm.sum)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.