[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: DiD with panel data

From   Fiorenzo Bovenzi <>
Subject   Re: st: DiD with panel data
Date   Sun, 8 Mar 2009 13:32:40 +0000

Many thanks Austin, and apologies for the long delay in responding.

Creating a second panel ID variable via "egen id=group(id_var
country)" effectively solves my problem, it is just what I wanted.
Thanks a lot,


2009/2/19 Austin Nichols <>:
> Fiorenzo Bovenzi <>:
> It all depends on what you have in mind as a D-in-D model. In something like
>  egen id=group(id_var country)
>  xtreg Yist Dist, i(id) fe
> the coef on Dist compares pre-treatment values to post-treatment
> values within firm-country pairs; firm outcomes in countries that
> never have Dist=1 contribute nothing to the estimate, but I think you
> want to use a firm's outcomes in such a country as a control for the
> same firm's outcomes in a country that does have Dist==1 at some
> point.  It's not clear to me whether you want to have firm FE and
> country dummies interacted with Dist.  Perhaps this would all be clear
> if you could be a bit more specific about the research design...
> You may just want
>  xtset id_var
>  xtreg Yist Dist, fe
> or
>  xtset id_var
>  tab country, gen(_c)
>  drop _c1
>  xtreg Yist Dist _c*, fe
> but you need to be clear about what comparison you are trying to draw.
> On Wed, Feb 18, 2009 at 8:21 AM, Fiorenzo Bovenzi
> <> wrote:
>> Dear list,
>> I am trying to estimate a difference-in-difference model with panel
>> data, i.e. Yist (where s indicates the treatment/control group) as a
>> function of a dummy Dist equal to 1 for the treatment group after the
>> treatment occurs, and 0 otherwise.
>> The basic steps I follow to do this are:
>> tsset id_var t_var
>> xtreg Yist Dist, i(id_var) fe
>> However, when I use tsset, I receive the message "repeated time values
>> in sample" because units i are called the same in both the treatment
>> and control groups - e.g. same firm in country A (treatment) and
>> country B (control).
>> Is there a way to fix this, other than assigning a different id to
>> each unit in the treatment and control groups?  Many thanks,
>> fiorenzo
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index