# Methods for conducting hypothesis tests on frequencies/modes in a time-series?

I have time series data over an 8hour period of animals displaying behaviors.

The behavior being displayed by a particular animal is notated as numbers 1-9, with a number corresponding to a given behavior. These are insects and they can only display one feeding behavior at a time.

The most common behavior for each point in time (i.e. mode or most frequent behavior/number at each second from 0s to 28,800s) was calculated and this data was visualized to get a good representation of how the behavior is changing between treatments groups.

After visualizing the data, it was clear that for one treatment, a particular behavior is less common at certain times compared to another treatment, which would make sense according to our original hypothesis.

Are there any statistical tests that can help exclude the possibility of random chance causing the differences that we see in the exploratory figures?

This is a bit of a weird dataset since it involves values that are frequencies, has a few treatments, and is also a timeseries dataset.

Here is an example of the data file generated which was plotted.

time activity
14396 5
14397 5
14398 5
14399 5
14400 5
14401 12

This file shows the most common behavior at each second. It was calculated from ~20 different samples in one treatment group.

Any help or ideas of statistical methods, packages, pipelines, considerations, etc. would be appreciated! I can work in both R and python so please throw out any and every suggestion you can think!

I'm not a statistician and don't know many methods beyond an anova/KW test.

Thanks!

The response variable (a 9-level factor) corresponds nicely with the multinomial distribution. The multinomial is a generalisation of the binomial to $$\ge2$$ categories. If you use a multinomial as the response, you don't have to use the mode summary that you're currently using - the mode is a useful way to summarise the data, but you lose precious information when you're modelling.
I'm not sure what kind of model you want, because I'm not across the research question. But, a reasonable start to explore the data could be a multinomial GAM (I believe you can fit this model using mgcv in R), where the response variable is the insect behaviour factor, and the predictor variable is a smooth on time + treatment (or something like that). You could compare a model where treatment is a factor, and treatment is not a factor, and see if the response probabilities change.