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!
auto.arima
function in R using thexreg
option for putting in the regressors). $\endgroup$