Managing Autocorrelation - Regression with Time Series Errors - Example 1 (R)

Notes and Considerations

Montgomery CH03 Example 3.15 p. 150

Output, along with R script, is included in the file "CH03 Example 3-15 manage autocorrelation using regression with time series errors.docx" attached below.

Example of using time series error terms in a linear model to reduce autocorrelation in the model residuals.  Two approaches are shown:
  • Using the 'gls' function from the nmle package
  • Using the 'arima' function from the stats package

Also includes the R function for checking autocorrelation using Box.test

Data Set

Table 3.17 toothpaste market share 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-15 Regression with time series errors.R" attached below.