# Confidence interval for Difference in Differences?

#### Weibull

##### New Member
I am familiar with how to do a Difference in Differences (DiD) but have never had to compute a confidence interval for it. I'm curious how one might go about that?

As an example, here is some made up data:
Code:
data DID;
input ID time group value;
cards;
1 1 1 1
2 1 1 2
3 1 1 1
4 1 1 3
5 1 1 2

6 1 2 5
7 1 2 4
8 1 2 6
9 1 2 4
10 1 2 6

1 2 1 5
2 2 1 4
3 2 1 5
4 2 1 6
5 2 1 5

6 2 2 6
7 2 2 6
8 2 2 7
9 2 2 5
10 2 2 6
;
run;

proc means data=DID mean;
class time group;
var value;
run;
Group 1 has means of 1.8 in time=1 and 5 in time=2.
Group 2 has means of 5 in time=1 and 6 in time=2.

Thus, the DiD estimate would be (6-5) - (5-1.8) = -2.2 (i.e. group 1 increased 2.2 more than group 2). But how would one go about putting a confidence interval on this estimate?

I guess some sort of bootstrapping approach could work but I'm curious if there is a more straight forward approach, perhaps something similar to the S.E calculation for a difference in 2 means?

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I see you used SAS code, so check out this reference. You may be able to adjust the code to output CIs. Also, I am using this reference in case you did not randomize group assignments, so you have a risk of non-ignorability of treatment assignment - AKA confounding based on baseline covariate imbalances. If so, these models allow you to control for secondary variables of interest.

https://www.lexjansen.com/wuss/2016/49_Final_Paper_PDF.pdf

#### Weibull

##### New Member
Thank you! This is the exact kind of information I was searching for but was unable to find (my google searches simply kept leading to differences in means rather differences in differences).

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Yes, I refer to this article about once a year or so to remember some of the intricacies.