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

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

 From natasha agarwal To statalist@hsphsun2.harvard.edu Subject Re: st: RE: RE: estimation with a time trend. Date Mon, 5 Jul 2010 17:03:13 +0100

```On Mon, Jul 5, 2010 at 4:49 PM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- 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"?

The results with the time dummies showed that the estimated
coefficients on the time dummies was increasing over time. I am
pasting the results of the same.

Fixed-effects (within) regression               Number of obs      =     46959
Group variable: number                          Number of groups   =     12911

R-sq:  within  = 0.2300                         Obs per group: min =         1
between = 0.4727                                        avg =       3.6
overall = 0.4656                                        max =         5

F(7,12910)         =    626.65
corr(u_i, Xb)  = 0.1507                         Prob > F           =    0.0000

(Std. Err. adjusted for 12911 clusters in number)

Robust
lnrval       Coef.   Std. Err.      t    P>t     [95% Conf. Interval]

lnk    .2036338   .0107336    18.97   0.000     .1825942    .2246733
lnw    .5677307   .0168696    33.65   0.000     .5346637    .6007977
lnvfdi    .0217376   .0198568     1.09   0.274    -.0171848    .0606599
y14   -.3255905   .0171191   -19.02   0.000    -.3591466   -.2920345
y15   -.2313728   .0130272   -17.76   0.000     -.256908   -.2058375
y16   -.1464979   .0097877   -14.97   0.000    -.1656832   -.1273126
y17   -.1293191   .0081628   -15.84   0.000    -.1453195   -.1133188
y18   (dropped)
_cons    .3633778   .2559695     1.42   0.156    -.1383602    .8651158

sigma_u   .95102062
sigma_e   .55962159
rho   .74279561   (fraction of variance due to u_i)

So I decided to introduce one a time variable like a trend which is
shown as before.

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/
>

*
*   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/
```