Managing Autocorrelation - Cochrane Orcutt - Example 1 (R)


Notes and Considerations


Montgomery CH03 Example 3.14 p. 143

Output, along with R script, is included in the file "CH03 Example 3-14 manage autocorrelation with Cochrane Orcutt.docx" attached below.

Example of applying the Cochrane-Orcutt method to the results of a linear model to reduce autocorrelation in the model residuals.


Note on the use of durbinWatsonTest (car package) vs. dwtest (lmtest package):
  • Shows the need to use the durbinWatsonTest instead of the dwtest.  The lmtest function requires output based on an lm object, while durbinWatsonTest can use an lm object or raw residuals from a model.

ALSO
Example of determining rho using Excel.  See file "CH03 Example 3-14 Excel Model for Cochrane-Orcutt.xlsx" attached below.



Data Set

 
Table 3.17 Toothpaste market share data


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



Analysis or Script File

 
See the file "CH03 Example 3-14 Cochrane-Orcutt.R" attached below.




Comments