[R] Changepoints estimation in a data series

Achim Zeileis Achim.Zeileis at uibk.ac.at
Tue Mar 2 10:05:47 CET 2010


On Mon, 1 Mar 2010, FMH wrote:

> Dear All,
>
> I'm trying to find changepoints in a data series  which only consist of  11 measurements of altitude(x) and temperature(y), respectively, in which the data are as followed:
>
> y = 16.3, 16.2, 16.1, 15.6, 14.2, 10, 8.2,  8.0, 7.5, 7.3, 7.2
> x = 1,  2,  5, 10, 15, 20, 25, 30, 40, 50, 60
>
> From the above series, i reckon there is more than one changepoint and  
> presuming there is a package in R which might enable the estimation on 
> such changepoints.

It depends what exactly you mean by changepoint, especially because the 
curve looks more sigmoidal than with a clear-cut change. Maybe these have 
been averaged already.

In any case, some useful methods might include:
   o maxstat_test() in package "coin" for changepoint estimation via
     maximally selected statistics
   o breakpoints() in package "strucchange" for OLS estimation of two
     separate constant means
   o segmented() in package "segmented" for OLS estimation of a broken
     line trend

If you are looking for two separate constant means, I would probably 
employ the maximally selected statistics in this situation:

## data
x <- c(1, 2, 5, 10, 15, 20, 25, 30, 40, 50, 60)
y <- c(16.3, 16.2, 16.1, 15.6, 14.2, 10, 8.2, 8.0, 7.5, 7.3, 7.2)
plot(y ~ x, type = "b")

## test
library("coin")
maxstat_test(y ~ x)

## add estimated changepoint
abline(v = 15, lty = 2)

hth,
Z

> Could someone please advice me on this matter by using R?
>
> Cheers,
> FMH
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


More information about the R-help mailing list