# What time series type analysis in R should I use?

I'm trying to determine what type of analysis I should use in R for my data/question. I'm thinking some type of time lag or time series analysis?

My question is how the duration of a behavior changes, on average, for a number of different individuals, in the 5 minutes before versus 5 minutes after an event occurs. Basically, I want to know if there is a change in the duration of a behavior that is contingent on the event occurring.

It needs to be automated because I have a LOT of data (multiple days of data for many different individuals). I have the time that an event occurs and the time (and duration) of a behavior I'm interested in (HH:MM:SS). I want to see the average change in the duration of a behavior per individual for 5 minutes before the event occurs and 5 minutes after the event occurs.

Does anyone have a recommendation for what type of analysis would be best for this question?

You might want to look into behavioral change point analysis. The bcpa package in R can help you.