# SPSS Statistics

View Only

## Difference in Differences Estimation in SPSS #### Mark Marti12 days ago #### David Dwyer12 days ago #### Peter Galderisi12 days ago • #### 1.  Difference in Differences Estimation in SPSS

Posted 12 days ago
Dear SPSS community members

I am not able to find a SPSS syntax for running difference in differences (DiD) model in SPSS. I have Time 1 (baseline) and Time 2 (endline) measurement for Intervention group (the group that received a treatment) and Comparison group (did not receive anything). I would like to calculate the DiD coefficient with p value for the difference in change between intervention and comparison groups from baseline to endline. I would really appreciate any support, resource or advice.

Thanks you very much.

------------------------------
Mark Marti
------------------------------

• #### 2.  RE: Difference in Differences Estimation in SPSS

Posted 12 days ago
Edited by David Dwyer 12 days ago

Hi @Mark Marti,
I am unfamiliar with the DiD coefficient.  I am not aware the IBM SPSS Statistics produces such a coefficient.  Perhaps one of my more statistically inclined colleagues will chime in.

However, a quick Google search netted me this example in R

IBM SPSS Statistics can utilize R, so I did:

BEGIN PROGRAM R.
library(foreign)
mydata\$time = ifelse(mydata\$year >= 1994, 1, 0)
mydata\$treated = ifelse(mydata\$country == "E" |
mydata\$country == "F" |
mydata\$country == "G", 1, 0)
mydata\$did = mydata\$time * mydata\$treated
didreg = lm(y ~ treated + time + did, data = mydata)
summary(didreg)
didreg1 = lm(y ~ treated*time, data = mydata)
summary(didreg1)
END PROGRAM.

Here is the output for you to compare to the link to PDF above:

Call:
lm(formula = y ~ treated + time + did, data = mydata)
Residuals:
Min 1Q Median 3Q Max
-9.768e+09 -1.623e+09 1.167e+08 1.393e+09 6.807e+09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.581e+08 7.382e+08 0.485 0.6292
treated 1.776e+09 1.128e+09 1.575 0.1200
time 2.289e+09 9.530e+08 2.402 0.0191 *
did -2.520e+09 1.456e+09 -1.731 0.0882 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.953e+09 on 66 degrees of freedom
Multiple R-squared: 0.08273, Adjusted R-squared: 0.04104
F-statistic: 1.984 on 3 and 66 DF, p-value: 0.1249
Call:
lm(formula = y ~ treated * time, data = mydata)
Residuals:
Min 1Q Median 3Q Max
-9.768e+09 -1.623e+09 1.167e+08 1.393e+09 6.807e+09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.581e+08 7.382e+08 0.485 0.6292
treated 1.776e+09 1.128e+09 1.575 0.1200
time 2.289e+09 9.530e+08 2.402 0.0191 *
treated:time -2.520e+09 1.456e+09 -1.731 0.0882 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.953e+09 on 66 degrees of freedom
Multiple R-squared: 0.08273, Adjusted R-squared: 0.04104
F-statistic: 1.984 on 3 and 66 DF, p-value: 0.1249

I hope this helps,

------------------------------
David Dwyer
SPSS Technical Support
IBM Software
------------------------------

• #### 3.  RE: Difference in Differences Estimation in SPSS

Posted 12 days ago
Can you run the two against each other controlling for time? You would have a coefficient for each year?

• #### 4.  RE: Difference in Differences Estimation in SPSS

Posted 12 days ago
This link explains how to do DiD with a simple regression in SPSS Statistics.

--