# Appropriateness of time series regression for intensive longitudinal data

I am analyzing time series data in which participants rated their thoughts in real time. I am trying to model the shape of the data.

Details on the time series:

• Sampling rate was 1/4 second
• Length of time series is 30 seconds (for a total of 120 data points)

In some (but not all) of the time series, we see what resembles a loosely periodic pattern of responding. However, we would not expect these patterns to be strictly dependent on the time (I have no reason to expect a participant's data would show a peak exactly every 7 seconds, for example).

For example, in this time series there are semi-regular peaks and valleys, but they don't follow a strict periodic pattern (x-axis is quarter of a second and y is rating of thoughts, from negative to positive): Here is the data corresponding to the above time series:

c(0, 0, 1, 2, 2, 3, 2, 0, 0, -2, -3, -4, -5, -5, -6, -6, -7, -7, -6, -5, -5, -4, -3, -4, -4, -2, 0, 0, 1, 2, 4, 5, 6, 6, 5, 5, 4, 4, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -2, -2, -1, 0, 0, 1, 1, 1, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 3, 4, 4, 4, 5, 4, 4, 3, 3, 3, 2, 1, 0, 0, 0, -1, -1, -2, -2, -2, -2, -2, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -1, -1)


It was suggested to me that time series regression may be an appropriate method to analyze this data. At first, I thought that being able to decompose the series into the seasonal (as well as trend and error) components would be useful. However, the research I have done on this (for example, from the top slide on page 4 of this slide deck) leads me to believe that in time series regression, seasonal patterns must follow strict periodicity with no room for deviation. My impression is that even though there may be some cyclicity in my data, this would not be considered a "seasonal" pattern, and thus time series regression would not be appropriate here. I am hoping that someone can confirm or deny this suspicion.

My questions are: based on what I've described, would time series regression be appropriate for this data set? In time series regression, how strict is the requirement for something to be considered "seasonal"? If a time series shows a peak about every 7 seconds (but sometimes 6 and sometimes 8), could that ever be considered a seasonal pattern?

• Seasonality is of course statistical, with usually random deviation. As a matter of fact, seasonality is the part of the randomness which can be explained by a cycle. Jul 3, 2018 at 8:55
• did you mean "seasonality is part of the variability" ? as it is most certainly not part of the randomness (noise) Jul 4, 2018 at 19:42

A 7 second periodicity in the human brain would indeed be a discovery.

To prove it to yourself, you can make a quick Box-Jenkin's autocorrelation. That is to compute the correlation between $x(t)$ and $x(t+\Delta t)$ (all data series), and plot is against $\Delta t$ (technically $\Delta t$ is called the lag). If you see a peak at, say 7 second, then there is a seasonality of 7 seconds. This will tell you if the periodicity is 7, or 6.98.

To prove it to others, you have two graphs:

• Plot $y(t) = x(t + \Delta t)$ versus $x(t)$. If you recognize a pattern, then you have a periodicity/seasonality. And maybe you discover more to say about it.

• Plot $x(t)$ as a function of a cyclic time: $t \mod \Delta t$. You can use a scatter plot or a radar plot if you want to stress the time is cyclic. If the lines aggregates around a line then you have a seasonality. The seasonality can be estimated as the average line, and the standard deviation line enables you to test if the seasonality is significant.

Before to make these plots, you may have to group your data series by trend: the optimistic with an increasing rating, the pessimistic with a decreasing rating, the decided with a insignificant trend, the determined with a low variance, the ambivalent with a high variance and low seasonality, the hesitant with a high variance and low seasonality.

You will then be challenged by the experimental factors. For example, all the participants may follow the same presentation, and the seasonality in though is simply the mirror of the presentation rhythm.

based on what I've described, would time series regression be appropriate for this data set?

Yes, it would be. You can try following an ARIMA modelling routine:

• Understand whether your timeseries is stationary.
• Apply autocorrelation and partial autocorrelation analyses (this will enable you to formalize both short term and longer spatial dependencies, including seasonality)
• Fit a model by choosing an appropriate order: differencing, autocorrelation, seasonal, residuals. Check resulting coefficients and their standard errors.

In time series regression, how strict is the requirement for something to be considered "seasonal"?

A hypothesis test resulted in rejecting the hypothesis that correlation coefficient is zero.

If a time series shows a peak about every 7 seconds (but sometimes 6 and sometimes 8), could that ever be considered a seasonal pattern?

Try autocorrelation analysis, using, for example, cor.test() in R, where one of the arguments is your timeseries shifted n lags back (6, 7, 8, etc.).

Identifying an arima model one uses correlations and partial correlations reflecting the impact of previous values. One needs to be aware that this must be done in a robust manner when one has data that may have been impacted by anomalies/level shifts/ local time trends.

If you post one of your time series i.e. the actual data, I and others might be able to help further.

At a glance your series seems to have a positive autoregressive structure with possible parameter changes or error variance changes over time and seems remarkably free of anomalies although that would have to be confirmed by analysis.

EDITED AFTER RECEIPT OF DATA:

I took your 120 values into AUTOBOX ( a piece of time series software that I have helped to develop) and lo and behold the identified model is and here .

The Actual/Fit and Forecast graph is here with residual plot here and residual acf here A variance change was detected (down) in the residual variance thus Weighted least Squares was used to remedy this non-constancy . . This error variance change occurred at or about period 26 suggesting that periods 1-25 and periods 26-120 differed in variability.

What you perceive as some sort of 6-7 period effect is in reality just a manifestation of the short-term relationship and is not found after the short term effect (oscillation) is accounted for.

MODIFIED ANSWER TO OP'S QUESTION DETAILING AUT0DEPENDENCE:

The model expressed as a simple lag model is useful , shown here to predict the 121st value ( 1 period ahead) ...shown here as predicting 119 due the the fact the 2 values were deleted form the beginning of the series as negligible ... I could have supressed this feature without effect.

• I updated the question to include the time series. Thanks! Jul 5, 2018 at 14:18
• You are very generous with your time to run this for me. Many thanks for your thorough answer! I want to make sure I understand your conclusions. Where do you find that what I perceived as a period effect is not found after the short term effect (oscillation) is accounted for? Do you conclude this because the variance change was remedied? Is the variance change being accounted for the same as accounting for the short term effect? Jul 6, 2018 at 16:23
• More broadly, I have 2500 different time series in this data set. I picked this exemplar because it had one of the strongest seasonal patterns to my eye. I am more interested in group differences rather than individual series. What I don’t understand so far is whether or not it would make sense to use this approach for all of my data, and if so, what conclusions I could hope to draw. My understanding of your conclusion for this time series is that there is not periodicity but there is an autoregressive structure, but please correct me if I’m wrong. I apologize for my ignorance on this topic. Jul 6, 2018 at 16:32
• You are perfectly correct there is auto-dependency up to and including lag 3 ...besides a few (4) anomlalies and a reduction in volatility/inherent background variance/variability at or around period 26.. I would initially perform a similar analysis for a sample of 100 from the 2500 in order to begin to create/identify homogenous patterns i.e. to classify the 100 into k subgroups. Jul 6, 2018 at 16:51
• the variance change is independent of the short term ( 3 period ) effect. Since the acf of the error process does not suggest any violations there is no evidence of another "period" effect Q.E.D.. Jul 6, 2018 at 16:54