4
$\begingroup$

I'm familiar with post-hoc testing with ANOVA for exploring differences between a sequence of groups, but recently I've been reading about Change Point Analysis (especially the R packages bcp, changepoint and strucchange).

It looks like those packages only handle data where there is one data point per unit of time. I'm curious if they can be used with data where there are multiple data points per unit of time. Here's some example data representing the measurement of a single continuous variable on a number of specimens that have been dated to specific moments in time (no repeated measurements):

a<-data.frame(time="1000",x=rnorm(10,12,3))
b<-data.frame(time="2000",x=rnorm(50,13,4))
c<-data.frame(time="3500",x=rnorm(50,12,4))
d<-data.frame(time="5000",x=rnorm(7,14,5))
e<-data.frame(time="7000",x=rnorm(20,10,3))
f<-data.frame(time="7500",x=rnorm(15,11,3))
g<-data.frame(time="9000",x=rnorm(15,10,5))
h<-data.frame(time="9500",x=rnorm(35,30,2))
i<-data.frame(time="10000",x=rnorm(30,28,4))
a2i<-rbind(a,b,c,d,e,f,g,h,i) 

library(ggplot2)
a2i$time<-as.numeric(levels(a2i$time))[a2i$time] 
ggplot(a2i,aes(time,x))+stat_smooth()+geom_point()

enter image description here

Here's what I'd be most grateful for some advice on...

Q1. Would it be valid to do the Change Point Analysis on a vector like the means or medians of the groups? That would allow me to start with a 'one data point per unit of time' input format which would suit the R packages, as I understand them. I've seen it done with environmental data like monthly gas concentrations (from daily observations), but I thought I'd check.

Q2. Is there a kind of Change Point Analysis that I can do on the raw data in a2g that will give me some measures of the probabilities of changes across the sequence? For example, something that will detect the change from time=9000 to time=9500, using all the data points in the sample? I'm guessing that if it was possible, someone would already have implemented and I just need a pointer to the relevant function.

Q3. In case Q2 can be answered 'yes', would the method change if the distribution of each group's values was non-normal (unlike my sample data)?

Q4. If Change Point Analysis is completely the wrong approach here, please let me know. I'm basically just curious about methods other than ANOVA for these kinds of data. Any other suggestions would be most welcome.

$\endgroup$
1
$\begingroup$

To answer one of your questions:

  1. Yes you can do changepoint analysis on a vector. I think that the only package that can currently do this in R is the ecp package:

http://cran.r-project.org/web/packages/ecp/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.