# Estimating the autocorrelation parameter and include it in segmented regression model

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!

• 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 at 12:39
• 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 at 13:19
• 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 at 15:36
• I have checked Hayashi's "Econometrics" 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 at 18:36
• See also this thread and my answer there for more options and argumentation on choice between them. Also this one. – Richard Hardy Sep 23 at 18:42