# How to compare difference between two time series?

I am working on my thesis where I'm examining how strong emotion people show to different events. My problem is (1) that I have VERY little experience with statistics and math, so I'm kind of lost with all different methods and would be really happy if a 'easy' answer could be given (without lots of algorithms and stuff).

So the main question:

In the graphs below I want to check if the yellow line is significant different in the second graph compared to the first, and also how different. How is this done in the easiest way?

I have searched for an answer for two days, but not being able to find something that could help me. So I hope that someone can help me on the right way!

• I'm interested in hearing other solutions to this myself, particularly from the more statistically literate users here. – Eoin Jul 18 '14 at 15:30

Researchers dealing with mouse-trajectory data have been grappling with the same kind of issues for a few years now.

Hehman et al (in press) have a pretty comprehensive review of the methodology coming out soon, but I'll summarise some of the points which might be of use to you here. I'm sure there are other solutions as well, but these have the advantages of being a) relatively simple, and b) established in the psychological literature.

Probably the simplest way, and a method that's been used since the original mouse-tracking paper (Spivey et al, 2005), is to just run a separate t test for every time step (101 of them in mouse-tracking), and report the period for which your two conditions differed significantly, which I'm guessing to be around 37,139 to 39,288 in your example. If your experiment is more than just a comparison of two groups, Scherbaum et al (2010) have done something similar with 101 regression models, allowing them to show the influence of different factors at different points in time.

## Growth Curves/Polynomial regression

An alternative, complimentary approach is to use growth curve analysis, otherwise known as a polynomial regression. This method is traditionally used to analyse the shape of longitudinal growth curves (hence the name) in things like bacterial populations, or the heights of children over time, is popular in eye-tracking research, and has also been adopted to mouse-tracking. In essence, instead of fitting a regular linear regression:

$$Prop_{suprised} = \alpha + \beta_1*Condition + \epsilon$$

where $\beta_1$ tells you the effect of $Condition$ on $Prop_{suprised}$, you add a coefficient for $Time$, and $Time^2$, and $Time^3$, and so on:

$$Prop_{suprised} = \alpha + \beta_1Condition + \beta_2Time + \beta_3Time*Condition + \beta_4Time^2 + \beta_5Time^2*Condition + [...] + \epsilon$$

While obviously more complicated, this lets you draw conclusions about the shape of each curve, rather than just the fact that one is higher than the other.

Dan Mirman has a great tutorial (and a book) on this, which is specifically about eye-tracking data, but can be applied elsewhere.

## The statistical big guns - generalized additive mixed models

McKeown and Sneddon (2014) (preprint available here) have just published a paper on exactly what you want to do, or, in their words: "hold constant shared components of responses that are due to perceived emotion across time, while enabling inference concerning linear differences between groups".

I mention this for completeness, but the maths involved here is very hard indeed (I've set aside a while next week to try and figure it out myself), so while I don't think this will be appropriate for your thesis, it's definitely something to be aware of, and impress people by citing.