I am studying animal behavior and I want to know whether the frequency of a specific behavior changes with time.

I thought it was a common and simple problem but I cannot find papers with examples that suits my case.

So far I proceeded as follows: I binned my time points, and I tested whether the events for each animal and each series followed the poisson distribution with the k-s test. I took as lambda the mean of each vector of value.

I am not sure that this approach is the best. What if the bins with highest numbers are always at the start?

Looking at other possibilities I came across time series analysis but I am totally new to them. I tried to self teach myself but with scarce success.

Basically I would like to show that there is not any time pattern: the frequency of events do not decrease or increase with time. Moreover, I would like to show it considering several individuals. (Maybe one individual shows acclimatization but the population doesn't, especially this last point is not common in time series examples)

How to do this in R? what tests to use?

Example of the original dataset, (actually for each ID I have hundreds of occurrences):

time<-c(7.11447,19.13773, 42.38522, 49.91215, 57.75048, 62.06984, 83.17565,    87.91016, 88.26145, 98.34730, 5.81488,  6.12617, 19.92766, 20.33673, 22.51982, 27.85156, 32.95741, 33.07515, 35.65510, 37.02395,102.6407,  103.6427,  506.1014,  569.6760,  578.3639,  623.6512,  637.4765,  992.3210, 1003.3756, 1016.9787)
ID<-rep(c(1,2,3), each=10)
dat<- data.frame(cbind(time, ID))

Thanks for any solution/direction

  • $\begingroup$ Do you have a baseline to compare against? And could you expand on "I would like to show [no time pattern] considering several individuals." what does that mean? Comparing across individuals, or just you want to do a test for each one of several inviduals? $\endgroup$
    – Wayne
    Aug 25, 2016 at 20:33
  • $\begingroup$ No baseline to compare it against. I just want to test whether there is some pattern in the frequency of this behaviour over time. I meant that I would like to have an answer at the population level if possible. $\endgroup$
    – have fun
    Aug 26, 2016 at 9:16

1 Answer 1


The best solution I found so far is to use the bin values as my outcome variable in a Linear Mixed Model with the name (1 to n) of the bins as explanatory variable and ID as fixed factor. And then check for differences between the bins with post-hoc tests.

If anyone has a better approach I am still open to suggestion.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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