# How to account for autocorrelation in a multiple linear regression?

I'm trying to create a multiple linear regression with water temperature change as my response variable and four numeric explanatory variables (that influence temperature change). Each numeric variable was recorded prior to the temperature change (e.g. amount of ice added into the water).

My problem is that I do not have the statistical or R background to take into account autocorrelation, given that a previous observation would likely have an influence on a subsequent observation.

My original model is as follows, and is an MLRM with backward selection (however autocorrelation has not been taken into account):

lm(y ~ x1 + x2 + x3 + x4)

Any and all help would be greatly appreciated!

• Please explain your dataset a little bt, do you have n measurements of the independent variables and n variations of temperature in time and you would like t use for predicting the k-th all the k-1-th preceding ones? – Irene Mar 7 '14 at 15:39
• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Nick Stauner Apr 7 '14 at 3:49
• i knew that, but since at the time I didn't have enough reputation I couldn't do it, but since I thought I could be of help I decided to answer, sorry if I acted wrongly, the intent was good. – Irene Apr 7 '14 at 9:12
• No serious harm; just against site policy, hence the collective cleanup action. Hopefully we can just convert this to a comment for you, or if not, hopefully you'll find other ways to help :) – Nick Stauner Apr 7 '14 at 9:17

One of the OLS assumptions is "no perfect multicollinearity". So, if you don't have a perfect linear combination among your independent variables (IV), you do can estimate a OLS regression model.

Including a new IV that affect the DV and is uncorrelated with the other IVs is always good since it reduces error variance. However, if the new IV is somehow correlated with one or more IVs, the effect of increasing the error variance due to collinearity might be stronger.

One way to assess if the collinearity is harmful is evaluating the condition index. See example below:

x1 = rnorm(1000, 1, 1)
x2 = rnorm(1000, 2, 1)
x3 = rnorm(1000, 3, 1)
x4 = 3*x3 + rnorm(1000, 1, 0.1)

library(perturb) # colldiag
colldiag(cbind(x1, x2, x3, x4))

## Condition
## Index    Variance Decomposition Proportions
##            intercept x1    x2    x3    x4
## 1    1.000 0.000     0.017 0.009 0.000 0.000
## 2    2.933 0.000     0.928 0.015 0.000 0.000
## 3    4.766 0.000     0.000 0.755 0.000 0.000
## 4    9.129 0.129     0.051 0.216 0.000 0.000
## 5  289.166 0.870     0.004 0.006 1.000 1.000


Belsley, Kuh, and Welsch (1980) say:

It is suggested that an appropriate means for diagnosing degrading collinearity is the following double condition:

1. A singular value judged to have a high condition index, and which is

2. High variance-decomposition proportions for two or more estimated associated with regression coefficient variances.

They suggest a condition index greater then 30 with variance-decomposition proportions greater than 0.5.

In the example above, you have a condition index of 289.166 associated with two variables (x3 and x4) with variance-decomposition proportion of 1. In this case, it would be advisable to exclude one of these variables from the model.

• The question is about correlated errors, not about correlated predictors. Could you try to reconsider the answer accordingly? – Michael M May 16 '14 at 6:17