Managing Autocorrelation - Adding Predictors - Example 1 (R)

Notes and Considerations

Montgomery CH03 Example 3.13 p. 139

Output, along with R script, is included in the file "CH03 Example 3-13 manage autocorrelation with additional predictor.docx" attached below.

Example of how, in some situations, adding another predictor (explanatory variable) to a linear model can reduce autocorrelation in the model residuals.

Also includes comparison of R functions for checking autocorrelation using Durbin-Watson

  • Shows possible inconsistency of durbinWatsonTest() function (car package) and provides an alternative using the 'dwtest()' function from the lmtest package.

Data Set

Tables 3.13 & 3.15 soft drink concentrate sales data

See file "DATA Montgomery TS data for chapter examples.xlsx" at the bottom of page Introduction to Time Series Analysis and Forecasting (Montgomery)

Data is also included in the R script file attached below.

Analysis or Script File

See the file "CH03 Example 3-13 manage autocorrelation with additional predictor.R" attached below.