Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: RE: RE: estimation with a time trend.


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: RE: estimation with a time trend.
Date   Mon, 5 Jul 2010 15:49:31 +0000 (GMT)

--- On Mon, 5/7/10, natasha agarwal wrote:
> I wanted to introduce a time trend in my estimation where
> my years go from 2001-2005.
> 
> With time trend I mean:
> 
> panel identifier    year      time trend
> 1                   2001        1
> 1                   2002        2
> 1                   2003        3
> 1                   2004        4
> 1                   2005        5
> 2                   2001        1
> 2                   2002        2
> 
> The only way I knew how to do it was to use the egen
> -group- command.That is why I wanted to do the egen
> -group- command.

I am still confused: What is "time trend" supposed to
measure that cannot be measured with "year"? Given your
earlier remarks you did not think that "the 0 outside the 
range of your data" was a problem in your fixed effects 
model. So what problem did you want to solve by creating
that "time trend" variable?

Mind you, I don't think it is a bad idea to ensure that
0 happens at a meaningful point in time, but it does not
seem to be the problem that you wanted to solve. We need
to make sure we understand what the problem is you want
to solve before we can help.

Again, there is no need to use -egen group()-, and it is
dangerous as your year variable may be unequally spaced 
(even if you think that it is not, real data has the 
nasty property of always deviating from what you think 
should be true in your data...).  You could easily check 
it before hand, but there is an easier and much saver 
solution: just subtract a constant: 

*--------- begin example --------
drop _all
input id  year 
      1   2001
      1   2002
      1   2003
      1   2004
      1   2005
      2   2001
      2   2002
end
gen trend = year - 2000
list
*--------- end example ----------
(For more on examples I sent to the Statalist see: 
http://www.maartenbuis.nl/example_faq )

To repeat: do not use -egen group()- for this purpose, 
it is dangerous. It will work in this example, but it
can just too easily backfire in real data.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index