1

For my analysis of time series data in R I am following a tutorial paper describing the analysis step-by-step:

Wagner, A. K., Soumerai, S. B., Zhang, F., & Ross‐Degnan, D. (2002). Segmented regression analysis of interrupted time series studies in medication use research. Journal of clinical pharmacy and therapeutics, 27(4), 299-309.

One section attends to "Correcting for correlation between values of the outcome measure over time"

After applying different methods to check for autocorrelation (visually inspecting residual plots/ ACFs / PACFs and checking the Durbin-Watson-Statistic), I conclude that autocorrelation is present.

The paper now suggest to "estimate the autocorrelation parameter and include it in the segmented regression model if necessary."

My question is now: How can this be achieved? The above mentioned description makes it sound like a very simple step, however, so far I wasn't able to find a simple solution to this problem.

Thank you very much!

lisannceline
  • 363
  • 1
  • 8
  • 1
    Consider also fitting a regression with ARMA errors (e.g. as facilitated by the `auto.arima` function in R using the `xreg` option for putting in the regressors). – Richard Hardy Sep 23 '19 at 12:39
  • @RichardHardy Thanks for your reply! Can you recommend an example source for using your approach? And by "also", do you mean there is another way to do this? – lisannceline Sep 23 '19 at 13:10
  • 1
    There are other ways, yes. Using vanilla regression + HAC-robust covariance estimators is one, using ARDL or transfer function modelling are other. Regarding sources, check out "regression with ARMA errors" here on CV or generally online. – Richard Hardy Sep 23 '19 at 13:19
  • @RichardHardy I have also read about using gls instead of lm and adding an autoregressive progress. Is that a valid option as well? Thanks again! – lisannceline Sep 23 '19 at 14:52
  • 1
    I think that would be very similar to regression with ARMA errors. I am not sure exactly what the difference would be in a special case of, say, the simple AR(1) error structure. I have a gut feeling that regression with ARMA errors might be a bit sounder of an approach, but I would need to work out the details to be able to give a definite answer. – Richard Hardy Sep 23 '19 at 15:36
  • 2
    I have checked Hayashi's ["Econometrics"](https://press.princeton.edu/titles/6946.html) textbook and found the following on p. 416: *As we emphasized in Chapter 2, the regressors are not strictly exogenous in most time series models. It follows that GLS should not be used to correct for serial correlation in the error term for models lacking strict exogeneity [because of inconsistency]. In particular, <...> the correct procedure to adjust for serial correlation is to leave the [OLS] point estimate unchanged while incorporating serial correlation in the estimate of the asymptotic variance.* – Richard Hardy Sep 23 '19 at 18:36
  • 2
    See also [this thread](https://stats.stackexchange.com/questions/226279/) and my answer there for more options and argumentation on choice between them. Also [this one](https://stats.stackexchange.com/questions/110757/). – Richard Hardy Sep 23 '19 at 18:42
  • 1
    I have posted a related question [here](https://stats.stackexchange.com/questions/428395/). – Richard Hardy Sep 23 '19 at 19:13
  • Thank you very much again! Something that really surprises me that in multiple papers, the process of accounting for the correlated nature of time series data seems like a simple thing to do using SAS, as there seems to be a function called "proc autoreg". Is there no sucequivalent for R? – lisannceline Sep 24 '19 at 13:52
  • 1
    What is simple is not necessarily correct or best. I think R has many options to choose from. Whatever SAS has, I would expect R would have it, too. – Richard Hardy Sep 24 '19 at 15:01
  • I have read through your links and learnt a lot! Something I still don't fully understand how I can use ARIMA processes in my segmented regression or in other words how to integrate the results, as they seem to be different approaches to analyzing time series data. Am I wrong in this? – lisannceline Sep 25 '19 at 09:41
  • 1
    Consider asking this on a separate (new) thread. Also, at the moment there is too little information about the general setup of your problem, so it is difficult to comment. – Richard Hardy Sep 25 '19 at 09:49

0 Answers0