# Comparing means of two simple time series

I'm trying to look for difference in timing (ie. earlier/later) in a variable measured at regular intervals between two groups.

This seems like a simple experimental design, and working in R, I'm able to visualize the data in a way that makes sense to me, but somehow I'm getting confused when it comes to testing for significance.

The data consist of weekly measurements of number of flowers for each individual, within and outside of the greenhouse. To take a small example:

expand.grid(week=(1:6),treatment=c("greenhouse","outside"),individual=1:2)->df
c(0,3,10,2,0,0,0,0,0,2,18,0,0,1,19,0,0,0,0,0,1,2,15,1)->flowers
data.frame(cbind(df,flowers))->df


Visually,

qplot(week,flowers,data=df,facets=treatment~.)


If my interest is simply to determine whether there's a significant difference in the time of flowering between the treatments; should I be doing a repeated measures ANOVA and looking at the interaction?

Simplifying (?) the problem even further, what if I remove the quantity of flowers, and just consider how many individuals are flowering? So the summarized data would be

ddply(df, .(treatment,week), function(d) length(d[d\$flowers>0,"flowers"]))->indiv


Which looks like this:

 qplot(week,V1,data=indiv,facets=treatment~.)


Here, my first thought was that I can just think of these as two distributions, and compare with a t-test; however, only individuals and not individualsxweek are independent, so perhaps this should also be a repeated measures ANOVA? Or do I need to venture into the world of more complex time-series math?

Edit As an update, I'm now also considering failure-time / survival analysis as a possible appropriate method.

-

My answer to Tools to detect jumps in a linear time series could be of interest as it lays out strategies for testing the hypothesis of a constant mean when faced with two time series.What you are proposing is called Intervention Modelling where you know a priori when the series may have shifted and you want to test the hypothesis.Piggyback series2 behind series1: identify the ARIMA model within each series;Estimate a combined causal (0,0,.0,1,1.1) & the ARIMA structure.The test for the hypothesis isthe test for the 0/1 causal series. –

-