Learn R Programming

changepoint (version 0.3)

segneigh.meanvar.exp: Multiple Changes in Mean and Variance using Segment Neighbourhood method - Exponential Data

Description

Calculates the optimal positioning and number of changepoints for Exponential data using Segment Neighbourhood method. Note that this gives the same results as PELT method but takes more computational time.

Usage

segneigh.meanvar.exp(data, Q=5, pen=0)

Arguments

data
A vector containing the data within which you wish to find changepoints.
Q
Numeric value of the maximum number of segments (number of changepoints +1) you wish to search for, default is 5.
pen
Numeric value of the linear penalty function. This value is used in the final decision as to the optimal number of changepoints, used as k*pen where k is the number of changepoints to be tested.

Value

  • A list is returned containing the following items
  • cpsMatrix containing the changepoint positions for 1,...,Q changepoints.
  • op.cptsThe optimal changepoint locations for the penalty supplied.
  • likeValue of the -2*log(likelihood ratio) + penalty for the optimal number of changepoints selected.

Details

This function is used to find a multiple changes in mean and variance for data that is assumed to be Exponential distributed. The value returned is the result of finding the optimal location of up to Q changepoints using the log of the likelihood ratio statistic. Once all changepoint locations have been calculated, the optimal number of changepoints is decided using k*pen as the penalty function where k is the number of changepoints tested (k in (1,Q)).

References

Change in Exponential model: Chen, J. and Gupta, A. K. (2000) Parametric statistical change point analysis, Birkhauser

Segment Neighbourhoods: Auger, I. E. And Lawrence, C. E. (1989) Algorithms for the Optimal Identification of Segment Neighborhoods, Bulletin of Mathematical Biology 51(1), 39--54

See Also

segneigh.meanvar.norm,segneigh.meanvar.gamma,cpt.meanvar,PELT.meanvar.exp,multiple.meanvar.exp,single.meanvar.exp,binseg.meanvar.exp

Examples

Run this code
# Example of multiple changes in mean and variance at 50,100,150 in simulated Exponential data
set.seed(1)
x=c(rexp(50,rate=1),rexp(50,rate=5),rexp(50,rate=1),rexp(50,rate=10))
segneigh.meanvar.exp(x,Q=5, pen=2*log(200)) # returns optimal number as 3 and the locations as c(50,100,150)
segneigh.meanvar.exp(x,Q=3, pen=2*log(200)) # returns optimal number as 2 as this is the maximum number of changepoints it can find.  If you get the maximum number, you need to increase Q until this is not the case.

# Example no change in mean or variance
set.seed(1)
x=rexp(200,rate=1)
segneigh.meanvar.exp(x,pen=2*log(200)) # returns optimal number as 0

Run the code above in your browser using DataLab