# Test for significance in a time series using R

I've got a time series data set that looks at population numbers on a yearly basis, and I would like to know if there is a significant difference between certain years, and if so- which years are statistically similar to each other. I'm using R, so I'm hoping to get some advice on R code to do this.

Here is simplified example time series looking at a population by year:

Year<-c(2001,2002,2003,2004,2005,2006)
Pop<-c(1,4,7,9,20,21)
DF<-data.frame(Year,Pop)


So given the above data, ideally I would hope for some method that would calculate if there is a significant trend over time (p value) and which years are statistically different from each other (I'm guessing 2001-04 would be in one grouping and 2005-06 would be in a second).

• It is not entirely clear to me whether you are looking for a trend (which you can assess with summary(lm(Pop~Year,DF))) or for structural breaks. Could you clarify your question? The strucchange R package offers ways to assess structural breaks, if that is what you are looking for: cran.r-project.org/web/packages/strucchange/index.html – Stephan Kolassa Feb 11 '13 at 8:43