# Tobit with difference-in-differences specification

Is it possible to estimate a tobit model (e.g. a nonlinear model) with a DiD (difference-in-differences) specification? If so, how does such specification look like?

If it is possible is this implemented in R or Stata?

Comment: @Dimitriy V. Masterov: Thanks for your answer! Would this still work if I used lognormal data? I mean a log transformation of the dependent variable y causes a missing if y=0. Cameron & Trivedi suggest to "trick" Stata for lognormal data in tobit models by setting the censoring point "slightly smaller than the minimum noncensored value of ln(y)". Does this also work with a DID specification?

-
Welcome to the site! To get a better answer, you might want to be more specific: What is DiD specification? What software are you using? – Peter Flom Oct 6 '12 at 12:50
I've merged your two accounts, Steven. (Thanks to @gung who noticed that.) – chl Oct 16 '12 at 14:21
@Steven See my response in my post. I would also take a look at Censored Least Absolute Deviations (CLAD) as a possible alternative. – Dimitriy V. Masterov Oct 16 '12 at 16:54

You can easily convince yourself that this works with a simulation, though this is not really a substitute for a proof.

D-in-D is really the just the difference between 4 means, so any model that estimates the expected value can be turned into a D-in-D estimator by using a dummy for belonging to the treatment group, a dummy for the after-treatment periods, and their interaction. The interaction is the coefficient you care about. Here's a 2 period simulation done in Stata with censoring below zero:

. clear

. set obs 10000
obs was 0, now 10000

. gen id=_n

. gen TG = mod(_n,2)

. expand 2
(10000 observations created)

. bys id: gen after =_n

. set seed 12345

. replace after = after - 1

. gen ystar = 2 + TG + after*TG *3 + rnormal()

. bys TG after: sum ystar

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> TG = 0, after = 0

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
ystar |      5000    2.002076    1.003261  -2.200537    5.71231

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> TG = 0, after = 1

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
ystar |      5000    2.012059     1.00011  -1.647926   5.297162

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> TG = 1, after = 0

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
ystar |      5000    2.987374    .9996143  -1.112056   6.657701

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> TG = 1, after = 1

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
ystar |      5000    5.972865    .9933744   2.354758    9.37486

. gen y = cond(ystar>0,ystar,0)

. tobit y i.after##i.TG, ll(0)

Tobit regression                                  Number of obs   =      20000
LR chi2(3)      =   25812.39
Prob > chi2     =     0.0000
Log likelihood = -28325.453                       Pseudo R2       =     0.3130

------------------------------------------------------------------------------
y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.after |   .0092987   .0199684     0.47   0.641     -.029841    .0484384
1.TG |   .9836551   .0199577    49.29   0.000     .9445363    1.022774
|
after#TG |
1 1  |   2.976207   .0282234   105.45   0.000     2.920886    3.031527
|
_cons |   2.003704   .0141204   141.90   0.000     1.976027    2.031382
-------------+----------------------------------------------------------------
/sigma |   .9972531   .0050298                      .9873942    1.007112
------------------------------------------------------------------------------
Obs. summary:        214  left-censored observations at y<=0
19786     uncensored observations
0 right-censored observations


You could have also used a panel version of the Tobit here, though you could only assume random effects unless you want to go the semi-parametric route for your problem. Finally, the Tobit relies on normality and homoskedasticity of the error term, so you may want to play with that in your simulation, as well as the degree of censoring.

On the Tobit model in logs:

I am not a huge fan of doing this. In Microeconometrics Using Stata, Cameron & Trivedi recommend replacing $\log (y)=\min\{\log(y \mid y>0)\}-0.0000001$ for cases where $y=0$. I've often found my estimates to be sensitive to how many zeros there are, so that is definitely something to play with and be honest about when reporting your results. The DiD estimator will inherit this sensitivity.

-
(This comment was posted by an anonymous user as an edit to the OP's question I don't know if it was the OP not under his login): @Dimitriy V. Masterov: Thanks for your answer. Missing any reference in textbooks/ journals I am unsure how to estimate a type II tobit( heckman selection two stage) with a DiD specification. E.g. how do I implement/ interpret a DiD specification in each stage? – gung Oct 6 '12 at 12:09
I answered your Type II Tobit in the separate question you started. – Dimitriy V. Masterov Oct 8 '12 at 19:45
@DimitriyV.Masterov concerning tobit model in logs. Do you know an alternative to the Cameron&Trivedi approach? E.g GLM as supposed by Austin Nichols link? – Steven Oct 18 '12 at 14:37
GLM with the log link is great, but I am not sure how it helps with the censoring issue. – Dimitriy V. Masterov Oct 18 '12 at 17:43

I can see no reason why DID estimation should not be possible with a Tobit model. However, I believe there is a caveat, please correct me if I'm wrong. I assume that you are interested in the marginal effects as the Tobit-coefficients are not really informative. Say, you include a dummy "After" for the period after the policy intervention or whatever you want to analyze and a dummy "TG" for the treatment group as well as an interaction of the two. In a linear model the coefficient of the interaction gives the effect of the policy reform. The marginal effect of a dummy variable is the change from 0 to 1 and in nonlinear models the marginal effect of a variable depends on were you evaluate it (e.g., the atmeans option in Stata), so it is important to specify the fact that you work with dummy variables and where you want to evaluate the marginal effect, especially at what values of the dummies included for DID you want to evaluate the marginal effects of the other ones. Just including an interaction gives you wrong results. The DID is taking the differences between the following means, where the first number is 1 if the individual belongs to the treatment group and the second is 1 for observations in the period after the policy reform:
(1,1)-(1,0) - [(0,1)-(0,0)]. So my take in Stata 12 is the following:

1. Run Tobit with the two dummies indicating affiliation to treatment group (TG) and the period after the reform (A, or possibly more periods),
2. margins, predict(ystar(0,.)) over (TG A)
3. lincom 1.TG#1.A-1.TG#0.A-(0.TG#1.A-0.TG#0.A)

I am not sure whether it is even necessary to include the interaction, as it indicates the marginal effect of a variable on the marginal effect of another one and the same is achieved by step 3 in the above.

Take a look at http://www.maartenbuis.nl/publications/interactions.pdf on dummy variables in non-linear models in Stata including the syntax I use in step 2. The reasoning of the paper surely applies to other software as well. He refers to the logit and Poisson model, but the points should apply to the Tobit model too.

-