# What methods of statistical analysis can be used for time series data?

I have done many 1-sample T-tests before, but I can't figure out if I am able to use one in this situation. In our experiment, we took 12 individual insects and placed them in a chamber where they could choose to be on whatever side they pleased (One side had sugar in it and the other did not). We recorded the number of insects on each side at 30 second intervals for 20 minutes.

Is it possible to use a 1-sample T test here? It seems the data wouldn't be random, violating one of the fundamental assumptions for the test. The number of insects on one side at any time strongly influences the number that will be there at the time of the next reading.

What exactly is data like this called? How can I analyze it and potentially reject the null hypothesis that the insects have no preference to the side with sugar vs. the side without?

• What does your control run look like? You know, the one where neither side had sugar (or where both sides had sugar). – whuber Oct 11 '11 at 23:32
• @whuber Whoops, that's the problem, we never did one where both sides were the same (using the T-test was completely my idea; all she expects is some basic interpretation of the averages). Should I delete the question since I never observed a control group or leave it up so it can focus on the method and not my specific case? :D – Gordon Gustafson Oct 11 '11 at 23:56
• For some reason, reading this question made me think of an Ehrenfest chain... – cardinal Oct 12 '11 at 2:02
• Let me take a step back and ask > What is it that you are trying to find out? > What's your null hypothesis? > Why did you do the study this way? Are you interested in the overall preferences of ants? Then it seems to me you could look at the number of ants at any given time, or total up the counts, or take the average of all the times. On the other hand, if you're interested in the movement of the ants, then you would do something with differences from one time to the next. – Peter Flom Oct 12 '11 at 10:57
• If we closed all questions relating to any not-quite-perfect study, we wouldn't have much of a site left :-). The objective of identifying things like lack of controls is to help frame the problem and circumscribe the possible actions that will be effective. – whuber Oct 12 '11 at 13:42

My thought is that you could define a new variable

diff(t) = num_on_sugar_side(t) - num_on_sugar_side(t-30s)


If the insects do not care about the sugar, then these counts should be randomly distributed, with the average change relating to the probability that a bug chooses to move over a 30s period. The counts should go up or down with equal probability (everything else being equal).

If the insects do care about the sugar, then these counts should be lopsided: i.e. they should be more likely to increase if bugs like sugar, and more likely to decrease otherwise.

If our null hypothesis is that the bugs don't care about sugar, then we aught to be able to test it here.

I might opt to use a non-parametric test because I'm not too sure about how this would be distributed. Maybe Wilcoxon Rank Sum? Perhaps someone who knows more about these things can jump in...

• Actually, none of the conclusions after the first paragraph are likely to be true. If the bugs are initially divided equally between the chambers, then there may initially be some trends, but then the system should settle into a dynamic equilibrium and the counts will no longer be "lopsided." The longer the experiment runs, the closer the average changes during the experiment will be to one another. – whuber Oct 12 '11 at 16:05

One method you might consider for time-course data is Growth curve analysis, a technique that was developed to track agricultural interventions from year to year. More recently it has been applied to the finer time-scale of eye-movements on a display (i.e. milliseconds). This site provides a thorough treatment of the technique in the latter context - http://www.danmirman.org/gca Also available there is R code to implement the technique with your data. I have a basic understanding of R and got this code to work within a couple hours of work. From your description, it sounds like your data would fit well with this method and would give you a much richer understanding of the effects occuring throughout the time-course, versus using time-bins and repeated t-tests, which have the obvious drawback of imposing arbitirary distinctions in your data (i.e. where to draw bin boundaries) just to get a significant effect.