<p>Yes because DiD still requires errors to be iid (see Mostly Harmless Econometrics ch 5).</p>
<p>However, note Durbin-Watson test is not necessarily the best way to test for it. DW test assumes first order autocorrelation, it is possible the dynamics in your data is more complex. If you believe there could be higher order autocorrelation you should use some other test like Berush-Godfrey test.</p>
<p>Moreover, you are right people typically do not use lagged variables in DiD, but you can deal with autocorrelation in large number of ways. You can use Newey-West errors, bootstrapped errors, clustered errors etc. Typically in DiD it does not make sense to use lag or policy dummy, so you could opt to replace standard errors with some autocorrelation consistent ones.</p>

CC BY-SA 4.0
2021-10-02T05:45:24.137Z
It is a great answer, thanks 1muflon1, First, thank you for introducing the B-G test to me. Luckily there is Stata command for it, but it also seems that people normally use the autocorrelation test in timeseries dataset, not in DiD. Regarding "cluster errors", do you mean "cluster" here is to cluster at the unit level ? Because normally, now, when doing a DiD, clustering by unit is a must in any study, if it is the case, it makes sense to me.
Nguyen Lis
CC BY-SA 4.0
2021-10-02T05:45:29.173Z
And I get lost regarding this sentence, can you please clarify it to me ? "**opt to replace standard errors with some autocorrelation consistent ones**", I mean, which is the "**autocorrelation consistent ones**" ?
Nguyen Lis
CC BY-SA 4.0
2021-10-02T06:14:22.677Z
So, in general, you mean that in DiD, we still need to concern autocorrelation; however, we do not use the lag variable but we may need to cluster by unit and that's all? Hope I understand you correctly.
Nguyen Lis
CC BY-SA 4.0
2021-10-02T07:19:04.960Z
@NguyenLis 1. Time series is data structure and DiD estimator don’t mix those. 2. BG test can be used on panel data, there should be command for it in Stata I think the command is ‘lmabpgxt’ or something like that you can google it. 3. Yes clustering means using clustered errors 4. Usually unit level is the appropriate level of clustering but it depends on specifics of your research with multilevel data you might not always want to cluster on unit level. 5. I wouldn’t say clustering is a must you should use it when appropriate, also clustering requires about 40 clusters to work if you
1muflon1
CC BY-SA 4.0
2021-10-02T07:19:37.293Z
Don’t have that many clusters than you wanna use other day options like bootstrapped errors. Autocorrelation consistent errors are any errors that are valid in presence of autocorrelation. Standard errors are not, clustered errors can be if properly clustered at correct level, etc.
1muflon1
CC BY-SA 4.0
2021-10-02T07:24:43.680Z
@NguyenLis you could use lag variable in *some cases* it but it is very uncommon to do so. Also, that depends in clustering is the correct solution read above. You have to get rid of that autocorrelation problem *somehow*. Often clustering will do that for you but it’s always case dependent clustering cannot be always blindly used
1muflon1
CC BY-SA 4.0
2021-10-02T07:50:07.880Z
Thanks 1muflon1. Let's get back to the 4th point regarding the multi-level data, an example is "firms in a country", so you mean, in this case, we may think of cluster by countries rather by firms?
Nguyen Lis
CC BY-SA 4.0
2021-10-02T08:04:54.773Z
@NguyenLis yes in *some* cases, depends on what level you believe the heteroskedasticity or autocorrelation occurs on.
1muflon1
CC BY-SA 4.0
2021-10-01T21:00:23.903Z
2021-10-01T21:00:23.903Z
1muflon1
<p>Sometimes we should put the lag of response variable to a model due to auto-correlation (how to check <strong>auto-correlation</strong> can be seen <a href="https://www.statalist.org/forums/forum/general-stata-discussion/general/1595478-durbin-watson-d-statistic" rel="nofollow noreferrer">here</a> in Stata (comment #11) by using Durbin Watson test).</p>
<p>However, sometimes, I did not see the author put the lag variable into the Difference-in-Difference model, for example <a href="https://academic.oup.com/rfs/article-abstract/32/7/2587/5079300?redirectedFrom=fulltext" rel="nofollow noreferrer">Dasgupta, 2019</a>, that confuses me because I think adding the lag of response variable is almost a must in any research study, especially for the accounting variable that the following year data would be highly correlate to the previous year.</p>
<p>Many thanks and warm regards.</p>

<econometrics>
Is it a need to test auto-correlation in Difference-in-Difference?
Nguyen Lis
# Is it a need to test auto-correlation in Difference-in-Difference?

(Asked by: username_0 on 2021-09-30)

Sometimes we should put the lag of response variable to a model due to auto-correlation (how to check **auto-correlation** can be seen [here](https://www.statalist.org/forums/forum/general-stata-discussion/general/1595478-durbin-watson-d-statistic) in Stata (comment #11) by using Durbin Watson test).

However, sometimes, I did not see the author put the lag variable into the Difference-in-Difference model, for example [Dasgupta, 2019](https://academic.oup.com/rfs/article-abstract/32/7/2587/5079300?redirectedFrom=fulltext), that confuses me because I think adding the lag of response variable is almost a must in any research study, especially for the accounting variable that the following year data would be highly correlate to the previous year.

Many thanks and warm regards.

**Tags:** econometrics

---

## 1 answers

### Answer by username_1 on 2021-10-01. Score: 1 | Accepted answer

Yes because DiD still requires errors to be iid (see Mostly Harmless Econometrics ch 5).

However, note Durbin-Watson test is not necessarily the best way to test for it. DW test assumes first order autocorrelation, it is possible the dynamics in your data is more complex. If you believe there could be higher order autocorrelation you should use some other test like Berush-Godfrey test.

Moreover, you are right people typically do not use lagged variables in DiD, but you can deal with autocorrelation in large number of ways. You can use Newey-West errors, bootstrapped errors, clustered errors etc. Typically in DiD it does not make sense to use lag or policy dummy, so you could opt to replace standard errors with some autocorrelation consistent ones.

> **Comments:**
> **username_0**: It is a great answer, thanks 1muflon1, First, thank you for introducing the B-G test to me. Luckily there is Stata command for it, but it also seems that people normally use the autocorrelation test in timeseries dataset, not in DiD. Regarding "cluster errors", do you mean "cluster" here is to cluster at the unit level ? Because normally, now, when doing a DiD, clustering by unit is a must in any study, if it is the case, it makes sense to me.  
> **username_0**: And I get lost regarding this sentence, can you please clarify it to me ? "**opt to replace standard errors with some autocorrelation consistent ones**", I mean, which is the "**autocorrelation consistent ones**" ?  
> **username_0**: So, in general, you mean that in DiD, we still need to concern autocorrelation; however, we do not use the lag variable but we may need to cluster by unit and that's all? Hope I understand you correctly.  
> **username_1**: @NguyenLis 1. Time series is data structure and DiD estimator don’t mix those. 2. BG test can be used on panel data, there should be command for it in Stata I think the command is ‘lmabpgxt’ or something like that you can google it. 3. Yes clustering means using clustered errors 4. Usually unit level is the appropriate level of clustering but it depends on specifics of your research with multilevel data you might not always want to cluster on unit level. 5. I wouldn’t say clustering is a must you should use it when appropriate, also clustering requires about 40 clusters to work if you  
> **username_1**: Don’t have that many clusters than you wanna use other day options like bootstrapped errors. Autocorrelation consistent errors are any errors that are valid in presence of autocorrelation. Standard errors are not, clustered errors can be if properly clustered at correct level, etc.  
> **username_1**: @NguyenLis you could use lag variable in *some cases* it but it is very uncommon to do so. Also, that depends in clustering is the correct solution read above. You have to get rid of that autocorrelation problem *somehow*. Often clustering will do that for you but it’s always case dependent clustering cannot be always blindly used  
> **username_0**: Thanks 1muflon1. Let's get back to the 4th point regarding the multi-level data, an example is "firms in a country", so you mean, in this case, we may think of cluster by countries rather by firms?  
> **username_1**: @NguyenLis yes in *some* cases, depends on what level you believe the heteroskedasticity or autocorrelation occurs on.  

---

