Learn R Programming

changepoint (version 1.1.5)

segneigh.var.css: Multiple Changes in Variance using Segment Neighbourhood method - Cumulative Sums of Squares

Description

Calculates the optimal positioning and number of changepoints for Cumulative Sums of Sqaures test statistic using Segment Neighbourhood method.

Usage

segneigh.var.css(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.

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.

Details

This function is used to find a multiple changes in variance for data that is not assumed to have a particular distribution. The value returned is the result of finding the optimal location of up to Q changepoints using the cumulative sums of squares test statistic. Once all changepoint locations have been calculated, the optimal number of changepoints is decided using pen as the penalty function.

References

C. Inclan, G. C. Tiao (1994) Use of Cumulative Sums of Squares for Retrospective Detection of Changes of Variance, Journal of the American Statistical Association 89(427), 913--923

R. L. Brown, J. Durbin, J. M. Evans (1975) Techniques for Testing the Constancy of Regression Relationships over Time, Journal of the Royal Statistical Society B 32(2), 149--192

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.var.norm,cpt.var,multiple.var.css,single.var.css,binseg.var.css

Examples

Run this code
# Example of multiple changes in variance at 50,100,150 in simulated normal data
set.seed(10)
x=c(rnorm(50,0,1),rnorm(50,0,10),rnorm(50,0,5),rnorm(50,0,1))
segneigh.var.css(x,Q=5, pen=1.368) # returns optimal number as 3 and the locations as c(52,100,149)
segneigh.var.css(x,Q=3, pen=1.368) # 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.
# 1.358 is the asymptotic value of the penalty for 95% confidence

# Example no change in variance
set.seed(1)
x=rnorm(200,0,1)
segneigh.var.css(x,Q=5, pen=1.368) # returns optimal number as 0

Run the code above in your browser using DataLab